Change CircleCI to run CLI tests, then GUI tests

This commit is contained in:
Micah Lee 2020-10-14 20:42:20 -07:00
parent 09e9ed3878
commit 33d522d0da
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
4 changed files with 38 additions and 116 deletions

View file

@ -8,14 +8,13 @@ workflows:
version: 2 version: 2
test: test:
jobs: jobs:
- test-3.6 - test-cli
- test-3.7 - test-gui
- test-3.8
jobs: jobs:
test-3.6: &test-template test-cli:
docker: docker:
- image: circleci/python:3.6-buster - image: circleci/python:3.8-buster
working_directory: ~/repo working_directory: ~/repo
@ -23,42 +22,40 @@ jobs:
- checkout - checkout
- run: - run:
name: Install Qt5 binaries name: Install dependencies
command: | command: |
sudo apt-get update sudo apt-get update
sudo apt-get install xvfb libdbus-1-3 libxkbcommon-x11-0 libxkbcommon-x11-dev sudo apt-get -y install tor obfs4proxy
cd ~/ pip install poetry
wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run cd ~/repo/cli
chmod +x qt-opensource-linux-x64-5.14.0.run poetry install
xvfb-run ./qt-opensource-linux-x64-5.14.0.run --script ~/repo/.circleci/qt-installer-script.js --platform minimal --verbose
- run:
name: Run tests
command: |
cd ~/repo/cli
poetry run pytest -v ./tests
test-gui:
docker:
- image: circleci/python:3.8-buster
working_directory: ~/repo
steps:
- checkout
- run: - run:
name: Install dependencies name: Install dependencies
command: | command: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y python3-pip xvfb tor obfs4proxy sudo apt-get install -y xvfb tor obfs4proxy gcc python3-dev
sudo pip3 install poetry flake8 cd ~/repo/desktop
poetry install pip install briefcase pytest pytest-briefcase pytest-faulthandler pytest-qt
pip install $(python -c 'import toml; print(" ".join(toml.loads(open("pyproject.toml").read())["tool"]["briefcase"]["app"]["onionshare"]["requires"]))')
- run: - run:
name: Run flake tests name: Run tests
command: | command: |
# stop the build if there are Python syntax errors or undefined names cd ~/repo/desktop
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics xvfb-run ./tests/run.sh
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- run:
name: Run unit tests
command: |
xvfb-run -s "-screen 0 1280x1024x24" poetry run ./tests/run.sh --rungui
test-3.7:
<<: *test-template
docker:
- image: circleci/python:3.7-buster
test-3.8:
<<: *test-template
docker:
- image: circleci/python:3.8-buster

View file

@ -1,75 +0,0 @@
function Controller() {
installer.installationFinished.connect(proceed)
}
function logCurrentPage() {
var pageName = page().objectName
var pagePrettyTitle = page().title
console.log("At page: " + pageName + " ('" + pagePrettyTitle + "')")
}
function page() {
return gui.currentPageWidget()
}
function proceed(button, delay) {
gui.clickButton(button || buttons.NextButton, delay)
}
Controller.prototype.WelcomePageCallback = function() {
logCurrentPage()
proceed(buttons.NextButton, 2000)
}
Controller.prototype.CredentialsPageCallback = function() {
logCurrentPage()
page().loginWidget.EmailLineEdit.text = installer.environmentVariable("QT_EMAIL");
page().loginWidget.PasswordLineEdit.text = installer.environmentVariable("QT_PASSWORD");
proceed()
}
Controller.prototype.IntroductionPageCallback = function() {
logCurrentPage()
proceed()
}
Controller.prototype.TargetDirectoryPageCallback = function() {
logCurrentPage()
proceed()
}
Controller.prototype.ComponentSelectionPageCallback = function() {
logCurrentPage()
page().deselectAll()
page().selectComponent("qt.qt5.5140.gcc_64")
proceed()
}
Controller.prototype.LicenseAgreementPageCallback = function() {
logCurrentPage()
page().AcceptLicenseRadioButton.checked = true
gui.clickButton(buttons.NextButton)
}
Controller.prototype.ReadyForInstallationPageCallback = function() {
logCurrentPage()
proceed()
}
Controller.prototype.PerformInstallationPageCallback = function() {
logCurrentPage()
}
Controller.prototype.FinishedPageCallback = function() {
logCurrentPage()
page().LaunchQtCreatorCheckBoxForm.launchQtCreatorCheckBox.checked = false
proceed(buttons.FinishButton)
}
Controller.prototype.DynamicTelemetryPluginFormCallback = function() {
logCurrentPage()
console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox))
var radioButtons = page().TelemetryPluginForm.statisticGroupBox
radioButtons.disableStatisticRadioButton.checked = true
proceed()
}

View file

@ -56,7 +56,7 @@ poetry run onionshare-cli
To run tests: To run tests:
``` ```
poetry run pytest -vvv ./tests poetry run pytest -v ./tests
``` ```
### Making a release ### Making a release

View file

@ -58,7 +58,7 @@ Then run the tests:
./tests/run.sh ./tests/run.sh
``` ```
If you want to run tests while hiding the GUI, you must have the `xorg-x11-server-Xvfb` package installed, and then: If you want to run tests while hiding the GUI, you must have the `xvfb` package installed, and then:
```sh ```sh
xvfb-run ./tests/run.sh xvfb-run ./tests/run.sh