-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH - Add Playwright for automated testing (#293)
* add playwright files, add github ci test * fix typo * fix another typo... * take a different approach to yarn start * take a different approach to yarn start * gh action syntax fix * add wait-for-it * ensure conda env is activated * yarm immutable installs false * screenshot is a forbidden pytest option, create .env file * switch to expect new ui on 8080 * switch to look on port 8081 for the test * i obviously didn't know how to envsubst works * why does this work differently on my machine??? * switch back to 5000 for conda-store-server and 8080 for the ui * add a long timeout for the first page load to ensure startup is complete * use 5000 for server port * one. more. try. * cleanup * env var in ci * gh actions doesnt support env vars in env vars * add a few more doc strings * attempt to fix mamba issues with unknown symbol * fix for setup-miniconda solver issues
- Loading branch information
Showing
6 changed files
with
439 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
REACT_APP_API_URL=$REACT_APP_API_URL | ||
REACT_APP_AUTH_METHOD=$REACT_APP_AUTH_METHOD | ||
REACT_APP_LOGIN_PAGE_URL=$REACT_APP_LOGIN_PAGE_URL | ||
REACT_APP_AUTH_TOKEN=$REACT_APP_AUTH_TOKEN | ||
REACT_APP_STYLE_TYPE=$REACT_APP_STYLE_TYPE | ||
REACT_APP_CONTEXT=$REACT_APP_CONTEXT | ||
REACT_APP_SHOW_AUTH_BUTTON=$REACT_APP_SHOW_AUTH_BUTTON | ||
REACT_APP_LOGOUT_PAGE_URL=$REACT_APP_LOGOUT_PAGE_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Playwright Tests | ||
|
||
env: | ||
CONDA_STORE_SERVER_PORT: 8080 | ||
CONDA_STORE_BASE_URL: http://localhost:8080 | ||
CONDA_STORE_AUTH: basic | ||
CONDA_STORE_USERNAME: username | ||
CONDA_STORE_PASSWORD: password | ||
REACT_APP_API_URL: http://localhost:5000/conda-store/ | ||
REACT_APP_AUTH_METHOD: cookie | ||
REACT_APP_LOGIN_PAGE_URL: http://localhost:5000/conda-store/login?next= | ||
REACT_APP_AUTH_TOKEN: | ||
REACT_APP_STYLE_TYPE: green-accent | ||
REACT_APP_CONTEXT: webapp | ||
REACT_APP_SHOW_AUTH_BUTTON: true | ||
REACT_APP_LOGOUT_PAGE_URL: http://localhost:5000/conda-store/logout?next=/ | ||
YARN_ENABLE_IMMUTABLE_INSTALLS: false | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-conda-store-ui: | ||
name: 'unit-test conda-store-ui' | ||
strategy: | ||
matrix: | ||
# cannot run on windows due to needing fake-chroot for conda-docker | ||
# osx takes forever to get a scheduled job | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
steps: | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@master | ||
|
||
- name: Set up Python | ||
uses: conda-incubator/setup-miniconda@v2 | ||
env: | ||
CONDA_SOLVER: libmamba | ||
with: | ||
activate-environment: test-env | ||
environment-file: environment_dev.yml | ||
auto-activate-base: false | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt install wait-for-it -y | ||
- name: Deploy conda-store-server docker container | ||
run: | | ||
docker-compose -f docker-compose-dev.yml up -d --build | ||
docker ps | ||
wait-for-it localhost:5000 # conda-store-server | ||
- name: Deploy webpack dev server | ||
shell: bash -el {0} | ||
run: | | ||
conda list | ||
playwright install chromium | ||
yarn install | ||
yarn run build | ||
yarn run start & | ||
pytest --video on --output test-results --screenshots true test/playwright/test_ux.py | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: playwright-tests | ||
path: test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,3 +149,6 @@ coverage | |
*.swp | ||
|
||
src/version.ts | ||
|
||
# playwright screenshots | ||
static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Environment for developing the conda-store-ui and for running | ||
# playwright tests | ||
|
||
name: test-env | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- python=3.10 | ||
- yarn | ||
- nodejs==16.14.2 | ||
- pytest | ||
- pip: | ||
- playwright | ||
- pytest-playwright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--screenshots", action="store", default="false") | ||
|
||
@pytest.fixture(scope="session") | ||
def screenshot(pytestconfig): | ||
if pytestconfig.getoption("screenshots") == 'false': | ||
return False | ||
else: | ||
return True |
Oops, something went wrong.