c4t


Namec4t JSON
Version 1.4.0 PyPI version JSON
download
home_pageNone
SummaryInstall Chrome for Testing assets.
upload_time2024-05-01 00:04:37
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8.10
licenseNone
keywords chrome testing selenium chromedriver cft
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://dev.azure.com/p4irin/c4t/_apis/build/status%2Fp4irin.c4t?branchName=master&jobName=BuildAndTest&configuration=BuildAndTest%20Python38)](https://dev.azure.com/p4irin/c4t/_build/latest?definitionId=5&branchName=master)
[![c4t publish](https://github.com/p4irin/c4t/actions/workflows/python-publish.yml/badge.svg)](https://github.com/p4irin/c4t/actions/workflows/python-publish.yml)
![PyPI - Version](https://img.shields.io/pypi/v/c4t)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/c4t)
![PyPI - Format](https://img.shields.io/pypi/format/c4t)
![PyPI - License](https://img.shields.io/pypi/l/c4t)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
# c4t: Chrome for Testing - v1.4.0

Install _Chrome for Testing_ assets. A flavor of Chrome, specifically for testing and a matching chromedriver. The version of assets installed are from the stable channel and currently only for _linux64_ platforms.

## Why Chrome for Testing?

Taken from [the Chrome Developers Blog](https://developer.chrome.com/blog/chrome-for-testing/)

> ...setting up an adequate browser testing environment is notoriously difficult...
>
> You want consistent, reproducible results across repeated test runs—but this may not happen if the browser executable or binary decides to update itself in between two runs.
>
>You want to pin a specific browser version and check that version number into your source code repository, so that you can check out old commits and branches and re-run the tests against the browser binary from that point in time.
>
> Not only do you have to download a Chrome binary somehow, you also need a correspondingly-versioned ChromeDriver binary to ensure the two binaries are compatible.
>
> Chrome for Testing is a dedicated flavor of Chrome targeting the testing use case, without auto-update, integrated into the Chrome release process, made available for every Chrome release
>
> ...finding a matching Chrome and ChromeDriver binary can be completely eliminated by integrating the ChromeDriver release process into the Chrome for Testing infrastructure.

## Installation

### From PyPI

```bash
(venv) $ pip install c4t
(venv) $
```

### From GitHub

```bash
(venv) $ pip install git+https://github.com/p4irin/c4t.git
(venv) $
```

## Verify

### In a REPL

#### Show version

```bash
(venv) $ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import c4t
>>> c4t.__version__
'<major>.<minor>.<patch>'
>>>
```

### Or on the command line

#### Show version

```bash
(venv) $ c4t --version
v1.1.0
(venv) $
```

#### Display package documentation

```bash
(venv) $ python -m pydoc c4t
(venv) $
```

## Usage

### In code

#### Install the default, the latest stable version and use it with Selenium

```bash
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import c4t
>>> assets = c4t.Assets()
>>> assets.install()
Create directory ${HOME}/.c4t-assets/124.0.6367.91
Downloading chrome-linux64.zip.
100% [......................................................................] 146689409 / 146689409

Downloading chromedriver-linux64.zip.
100% [..........................................................................] 7508443 / 7508443

Unzipping chrome-linux64.zip
Unzipping chromedriver-linux64.zip
Creating symlink to chrome version 117.0.5938.62
Creating symlink to chromedriver version 117.0.5938.62
Finished installing version 117.0.5938.62 of Chrome for Testing and Chromedriver.
-------------------------------------------
Version 117.0.5938.62 is the active version
-------------------------------------------
>>> from selenium.webdriver import ChromeOptions, ChromeService, Chrome
>>> options = ChromeOptions()
>>> options.binary_location = c4t.location.chrome
>>> service = ChromeService(executable_path=c4t.location.chromedriver)
>>> browser = Chrome(options=options, service=service)
>>> browser.get('https://pypi.org/user/p4irin/')
>>> browser.close()
>>> browser.quit()
>>>
```

### On the command line

#### Display command line help

```bash
(venv) $ c4t --help
```

```bash
(venv) $ c4t install --help
```

#### Install the default, the latest stable version

```bash
# By default assets are installed in ${HOME}/.c4t-assets
# To use a different path, set the C4T_PATH_TO_ASSETS environment variable.
# e.g.: export C4T_PATH_TO_ASSETS=<path>
# Add this export to your .bashrc so the path is set for every bash session.
(venv) $ c4t install
```

#### Install a specific version

```bash
(venv) $ c4t install --version 116.0.5794.0
```

#### Show the currently active version

```bash
(venv) $ c4t --active
Active version of 'Chrome for Testing' assets installed: 124.0.6367.91
```

#### Show installation path of assets

```bash
(venv) $ c4t path
Path to assets: /home/p4irin/.c4t-assets
```

#### Show a list of installed versions

```bash
(venv) $ c4t list
1 - 124.0.6367.91
2 - 116.0.5794.0
```

#### Switch active version

```bash
(venv) $ c4t switch
1 - 124.0.6367.91
2 - 116.0.5794.0
Select a version by number: 2
Creating symlink to chrome version 116.0.5794.0
Creating symlink to chromedriver version 116.0.5794.0
Active version is now: 116.0.5794.0
```

### Common workflow

1. Install one or more versions of Chrome for testing assets
1. Set/switch the active version
1. Run your Selenium Webdriver tests with the active version of Chrome for testing

This allows for quickly switching back to a previous version of Chrome to run your tests against in case of a regression on a recent/latest version. For example, a test failing against the latest of Chrome, did it pass consistently on the previous version or is it flaky and in need for a more robust implementation?

## Reference

- [Blog](https://developer.chrome.com/blog/chrome-for-testing/)
- [GitHub](https://github.com/GoogleChromeLabs/chrome-for-testing)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "c4t",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.10",
    "maintainer_email": null,
    "keywords": "chrome, testing, selenium, chromedriver, cft",
    "author": null,
    "author_email": "p4irin <139928764+p4irin@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/2d/58/996cf08a63cb038e4722e3ed96ef850556622ca5f2bbd6895d0c4ef9c2f1/c4t-1.4.0.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://dev.azure.com/p4irin/c4t/_apis/build/status%2Fp4irin.c4t?branchName=master&jobName=BuildAndTest&configuration=BuildAndTest%20Python38)](https://dev.azure.com/p4irin/c4t/_build/latest?definitionId=5&branchName=master)\n[![c4t publish](https://github.com/p4irin/c4t/actions/workflows/python-publish.yml/badge.svg)](https://github.com/p4irin/c4t/actions/workflows/python-publish.yml)\n![PyPI - Version](https://img.shields.io/pypi/v/c4t)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/c4t)\n![PyPI - Format](https://img.shields.io/pypi/format/c4t)\n![PyPI - License](https://img.shields.io/pypi/l/c4t)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n# c4t: Chrome for Testing - v1.4.0\n\nInstall _Chrome for Testing_ assets. A flavor of Chrome, specifically for testing and a matching chromedriver. The version of assets installed are from the stable channel and currently only for _linux64_ platforms.\n\n## Why Chrome for Testing?\n\nTaken from [the Chrome Developers Blog](https://developer.chrome.com/blog/chrome-for-testing/)\n\n> ...setting up an adequate browser testing environment is notoriously difficult...\n>\n> You want consistent, reproducible results across repeated test runs\u2014but this may not happen if the browser executable or binary decides to update itself in between two runs.\n>\n>You want to pin a specific browser version and check that version number into your source code repository, so that you can check out old commits and branches and re-run the tests against the browser binary from that point in time.\n>\n> Not only do you have to download a Chrome binary somehow, you also need a correspondingly-versioned ChromeDriver binary to ensure the two binaries are compatible.\n>\n> Chrome for Testing is a dedicated flavor of Chrome targeting the testing use case, without auto-update, integrated into the Chrome release process, made available for every Chrome release\n>\n> ...finding a matching Chrome and ChromeDriver binary can be completely eliminated by integrating the ChromeDriver release process into the Chrome for Testing infrastructure.\n\n## Installation\n\n### From PyPI\n\n```bash\n(venv) $ pip install c4t\n(venv) $\n```\n\n### From GitHub\n\n```bash\n(venv) $ pip install git+https://github.com/p4irin/c4t.git\n(venv) $\n```\n\n## Verify\n\n### In a REPL\n\n#### Show version\n\n```bash\n(venv) $ python\nPython 3.8.10 (default, Jun  2 2021, 10:49:15) \n[GCC 9.4.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import c4t\n>>> c4t.__version__\n'<major>.<minor>.<patch>'\n>>>\n```\n\n### Or on the command line\n\n#### Show version\n\n```bash\n(venv) $ c4t --version\nv1.1.0\n(venv) $\n```\n\n#### Display package documentation\n\n```bash\n(venv) $ python -m pydoc c4t\n(venv) $\n```\n\n## Usage\n\n### In code\n\n#### Install the default, the latest stable version and use it with Selenium\n\n```bash\nPython 3.8.10 (default, May 26 2023, 14:05:08) \n[GCC 9.4.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import c4t\n>>> assets = c4t.Assets()\n>>> assets.install()\nCreate directory ${HOME}/.c4t-assets/124.0.6367.91\nDownloading chrome-linux64.zip.\n100% [......................................................................] 146689409 / 146689409\n\nDownloading chromedriver-linux64.zip.\n100% [..........................................................................] 7508443 / 7508443\n\nUnzipping chrome-linux64.zip\nUnzipping chromedriver-linux64.zip\nCreating symlink to chrome version 117.0.5938.62\nCreating symlink to chromedriver version 117.0.5938.62\nFinished installing version 117.0.5938.62 of Chrome for Testing and Chromedriver.\n-------------------------------------------\nVersion 117.0.5938.62 is the active version\n-------------------------------------------\n>>> from selenium.webdriver import ChromeOptions, ChromeService, Chrome\n>>> options = ChromeOptions()\n>>> options.binary_location = c4t.location.chrome\n>>> service = ChromeService(executable_path=c4t.location.chromedriver)\n>>> browser = Chrome(options=options, service=service)\n>>> browser.get('https://pypi.org/user/p4irin/')\n>>> browser.close()\n>>> browser.quit()\n>>>\n```\n\n### On the command line\n\n#### Display command line help\n\n```bash\n(venv) $ c4t --help\n```\n\n```bash\n(venv) $ c4t install --help\n```\n\n#### Install the default, the latest stable version\n\n```bash\n# By default assets are installed in ${HOME}/.c4t-assets\n# To use a different path, set the C4T_PATH_TO_ASSETS environment variable.\n# e.g.: export C4T_PATH_TO_ASSETS=<path>\n# Add this export to your .bashrc so the path is set for every bash session.\n(venv) $ c4t install\n```\n\n#### Install a specific version\n\n```bash\n(venv) $ c4t install --version 116.0.5794.0\n```\n\n#### Show the currently active version\n\n```bash\n(venv) $ c4t --active\nActive version of 'Chrome for Testing' assets installed: 124.0.6367.91\n```\n\n#### Show installation path of assets\n\n```bash\n(venv) $ c4t path\nPath to assets: /home/p4irin/.c4t-assets\n```\n\n#### Show a list of installed versions\n\n```bash\n(venv) $ c4t list\n1 - 124.0.6367.91\n2 - 116.0.5794.0\n```\n\n#### Switch active version\n\n```bash\n(venv) $ c4t switch\n1 - 124.0.6367.91\n2 - 116.0.5794.0\nSelect a version by number: 2\nCreating symlink to chrome version 116.0.5794.0\nCreating symlink to chromedriver version 116.0.5794.0\nActive version is now: 116.0.5794.0\n```\n\n### Common workflow\n\n1. Install one or more versions of Chrome for testing assets\n1. Set/switch the active version\n1. Run your Selenium Webdriver tests with the active version of Chrome for testing\n\nThis allows for quickly switching back to a previous version of Chrome to run your tests against in case of a regression on a recent/latest version. For example, a test failing against the latest of Chrome, did it pass consistently on the previous version or is it flaky and in need for a more robust implementation?\n\n## Reference\n\n- [Blog](https://developer.chrome.com/blog/chrome-for-testing/)\n- [GitHub](https://github.com/GoogleChromeLabs/chrome-for-testing)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Install Chrome for Testing assets.",
    "version": "1.4.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/p4irin/c4t/issues",
        "Homepage": "https://github.com/p4irin/c4t"
    },
    "split_keywords": [
        "chrome",
        " testing",
        " selenium",
        " chromedriver",
        " cft"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a784806ccfd2cf4886039f6a79fb7ccfbe5a2687acbec5b88ff34ea934a3d60",
                "md5": "038401b5c4ca712665ffff3b1a5f921d",
                "sha256": "7ed97344595511c446186167da7c9eb4087cfdd5db7d91b0b7a2d7bf08c59f8f"
            },
            "downloads": -1,
            "filename": "c4t-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "038401b5c4ca712665ffff3b1a5f921d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.10",
            "size": 9242,
            "upload_time": "2024-05-01T00:04:36",
            "upload_time_iso_8601": "2024-05-01T00:04:36.122514Z",
            "url": "https://files.pythonhosted.org/packages/4a/78/4806ccfd2cf4886039f6a79fb7ccfbe5a2687acbec5b88ff34ea934a3d60/c4t-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d58996cf08a63cb038e4722e3ed96ef850556622ca5f2bbd6895d0c4ef9c2f1",
                "md5": "7d6acb573e73f0d2608b2a8c45cdcc60",
                "sha256": "2a437374cf00a0a5ee6e90be5dde5d8d410f453a6aa068b0eb49df2b9f2b4609"
            },
            "downloads": -1,
            "filename": "c4t-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7d6acb573e73f0d2608b2a8c45cdcc60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.10",
            "size": 12230,
            "upload_time": "2024-05-01T00:04:37",
            "upload_time_iso_8601": "2024-05-01T00:04:37.843176Z",
            "url": "https://files.pythonhosted.org/packages/2d/58/996cf08a63cb038e4722e3ed96ef850556622ca5f2bbd6895d0c4ef9c2f1/c4t-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-01 00:04:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "p4irin",
    "github_project": "c4t",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "c4t"
}
        
Elapsed time: 0.25787s