Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Commit

Permalink
Add automated test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kelly committed Jul 23, 2018
1 parent cadba26 commit aac9247
Show file tree
Hide file tree
Showing 13 changed files with 871 additions and 5 deletions.
11 changes: 10 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ version: 2
jobs:
build:
docker:
- image: circleci/node:10-browsers
- image: circleci/python:2.7-node-browsers
steps:
- checkout
- run:
name: Install dependencies
command: |
pipenv install
npm install
pipenv run mozdownload --version latest --destination $HOME/firefox.tar.bz2
pipenv run mozinstall --destination $HOME $HOME/firefox.tar.bz2
- run:
name: Build extension
command: |
Expand All @@ -17,9 +20,15 @@ jobs:
name: Run linting checks
command: |
npm run lint
- run:
name: Run automated tests
command: |
pipenv run test -- --firefox_bin $HOME/firefox/firefox
- run:
name: Package extension as XPI
command: |
npm run package
- store_artifacts:
path: web-ext-artifacts
- store_artifacts:
path: gecko.log
18 changes: 18 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]

[packages]
click = "*"
marionette-client = "*"
mozdownload = "*"
mozinstall = "*"

[requires]
python_version = "2.7"

[scripts]
test = "npm test"
251 changes: 251 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,35 @@ Prerequisites:
npm start
```

## NPM Scripts
## Running Tests

Automated tests are run in a Firefox browser instance using [Marionette][]. We use the Python client for Marionette since there is no up-to-date JavaScript client.

To set up your environment for running the tests, you must have:

- A Firefox binary. On MacOS, this can be found within the `.app` folder at `Firefox.app/Contents/MacOS/firefox`.
- Python 2.7
- [Pipenv][]

With these installed, you can set up the test suite:

1. Install Python dependencies:

```sh
pipenv install
```
2. Save the path to your Firefox binary with `npm`:

```sh
npm config set webext-commerce:firefox_bin <PATH_TO_FIREFOX_BINARY>
```

After this, you can run `pipenv run test` to run the automated test suite.

[Marionette]: https://firefox-source-docs.mozilla.org/testing/marionette/marionette/index.html
[Pipenv]: https://docs.pipenv.org/

## Scripts

| Command | Description |
| --- | --- |
Expand All @@ -39,6 +67,7 @@ Prerequisites:
| `npm run build` | Compile source files with Webpack |
| `npm run watch` | Watch for changes and rebuild |
| `npm run package` | Package the extension into an XPI file |
| `pipenv run test` | Run test suite (See "Running Tests" for setup) |

## License

Expand Down
Loading

0 comments on commit aac9247

Please sign in to comment.