Upgrade to fxtest-jenkins-pipeline v1.10 (#411)

* With fxtest-jenkins-pipeline v1.10 we no longer require Git

* Add --variables command line argument to Docker default command

* Improve README for running tests against Sauce Labs

* Fix JSON syntax for example variables file
This commit is contained in:
Dave Hunt 2018-01-16 02:38:06 +00:00 коммит произвёл Stephen Donner
Родитель a5f18bfbc3
Коммит cb34cdf7fb
4 изменённых файлов: 18 добавлений и 11 удалений

Просмотреть файл

@ -1,4 +1,5 @@
.cache
.git
**/__pycache__
**/*.pyc
results

Просмотреть файл

@ -6,8 +6,7 @@ RUN mkdir /opt
RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk --no-cache add \
curl \
firefox@testing \
git
firefox@testing
WORKDIR /src
COPY requirements.txt /src
@ -24,4 +23,4 @@ RUN curl -fsSLo /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/r
COPY . /src
CMD pytest
CMD pytest --variables=/variables.json

2
Jenkinsfile поставляемый
Просмотреть файл

@ -8,7 +8,7 @@ def capabilities = [
pipeline {
agent any
libraries {
lib('fxtest@1.9')
lib('fxtest@1.10')
}
options {
ansiColor('xterm')

Просмотреть файл

@ -63,7 +63,7 @@ as many vouched users as you intend to have tests running in parallel.
"username": "vouched",
"email": "vouched@example.com",
"name": "Vouched User"
},
}
],
"unvouched": {
"username": "unvouched",
@ -80,13 +80,13 @@ as many vouched users as you intend to have tests running in parallel.
}
```
Then you can run the tests using [Docker]:
Then you can run the tests using [Docker][]:
```bash
$ docker build -t mozillians-tests .
$ docker run -it \
--mount type=bind,source=/path/to/variables.json,destination=/variables.json,readonly \
mozillians-tests pytest --variables=/path/to/variables.json
mozillians-tests
```
### Run the tests using Sauce Labs
@ -100,17 +100,23 @@ username = username
key = secret
```
Then you can run the tests using [Docker][]. The `--mount` argument is
important, as it allows your `.saucelabs` file to be accessed by the Docker container:
Then you can run the tests against Sauce Labs using [Docker][] by passing the
`--driver SauceLabs` argument as shown below. The `--mount` argument is
important, as it allows your `.saucelabs` file to be accessed by the Docker
container:
```bash
$ docker build -t mozillians-tests .
$ docker run -it \
--mount type=bind,source=$HOME/.saucelabs,destination=/src/.saucelabs,readonly \
--mount type=bind,source=/path/to/variables.json,destination=/variables.json,readonly \
mozillians-tests pytest --variables=/path/to/variables.json
mozillians-tests --variables /variables.json \
--driver SauceLabs --capability browserName Chrome
```
See the documentation on [specifying capabilities][] and the Sauce Labs
[platform configurator][] for selecting the target platform.
## Writing tests
If you want to get involved and add more tests, then there are just a few
@ -127,5 +133,6 @@ things we'd like to ask you to do:
[git clone]: https://help.github.com/articles/cloning-a-repository/
[git fork]: https://help.github.com/articles/fork-a-repo/
[staging]: https://web-mozillians-staging.production.paas.mozilla.community/
[install tox]: https://tox.readthedocs.io/en/latest/install.html
[specifying capabilities]: http://pytest-selenium.readthedocs.io/en/latest/user_guide.html#specifying-capabilities
[platform configurator]: http://pytest-selenium.readthedocs.io/en/latest/user_guide.html#specifying-capabilities
[style guide]: https://wiki.mozilla.org/QA/Execution/Web_Testing/Docs/Automation/StyleGuide