From 6a53bb952d33ea5becde6c525b621e911b148df8 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 11:56:15 -0500 Subject: [PATCH 01/24] add playwright files, add github ci test --- .github/workflows/test.yml | 69 +++++++++ .gitignore | 3 + environment_dev.yml | 13 ++ test/playwright/conftest.py | 12 ++ test/playwright/test_ux.py | 276 ++++++++++++++++++++++++++++++++++++ 5 files changed, 373 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 environment_dev.yml create mode 100644 test/playwright/conftest.py create mode 100644 test/playwright/test_ux.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..39d18145 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,69 @@ +name: Tests + +env: + CONDA_STORE_URL: http://localhost:5000/conda-store + 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=/ + +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 + with: + mamba-version: "*" + activate-environment: test-env + environment-file: environment-dev.yaml + auto-activate-base: false + + - name: Deploy conda-store-server docker container + run: | + docker-compose -f docker-compose-dev.yml up --build + docker ps + + wait-for-it localhost:5000 # conda-store-server + + - name: Deploy webpack dev server + run: | + yarn install + yarn run build + yarn run start + + - name: Run Playwright tests + run: | + playwright install + pytest --video on test/playwright/test_ux.py + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: playwright-tests + path: screenshots diff --git a/.gitignore b/.gitignore index 87a392b0..5c10c913 100644 --- a/.gitignore +++ b/.gitignore @@ -149,3 +149,6 @@ coverage *.swp src/version.ts + +# playwright screenshots +static diff --git a/environment_dev.yml b/environment_dev.yml new file mode 100644 index 00000000..b38ff1ab --- /dev/null +++ b/environment_dev.yml @@ -0,0 +1,13 @@ +# 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 +- pip: + - playwright + - pytest-playwright diff --git a/test/playwright/conftest.py b/test/playwright/conftest.py new file mode 100644 index 00000000..8b24a1bf --- /dev/null +++ b/test/playwright/conftest.py @@ -0,0 +1,12 @@ +import pytest + + +def pytest_addoption(parser): + parser.addoption("--screenshot", action="store", default="false") + +@pytest.fixture(scope="session") +def screenshot(pytestconfig): + if pytestconfig.getoption("screenshot") == 'false': + return False + else: + return True diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py new file mode 100644 index 00000000..e3dd9012 --- /dev/null +++ b/test/playwright/test_ux.py @@ -0,0 +1,276 @@ +"""Test suite for user interactions with the UI. It is designed to run both +inside and outside of pytest to make future development easier. +""" +import os + +import pytest +from playwright.sync_api import Page +from playwright.sync_api import sync_playwright +import random + + +CONDA_STORE_SERVER_PORT = os.environ.get( + "CONDA_STORE_SERVER_PORT", f"5000" +) +CONDA_STORE_BASE_URL = os.environ.get( + "CONDA_STORE_BASE_URL", f"http://localhost:{CONDA_STORE_SERVER_PORT}/conda-store/" +) +CONDA_STORE_USERNAME = os.environ.get("CONDA_STORE_USERNAME", "username") +CONDA_STORE_PASSWORD = os.environ.get("CONDA_STORE_PASSWORD", "password") + + +@pytest.fixture +def test_config(): + return { + 'base_url': CONDA_STORE_BASE_URL, + 'username': CONDA_STORE_USERNAME, + 'password': CONDA_STORE_PASSWORD, + 'server_port': CONDA_STORE_SERVER_PORT, + } + + +def login_sequence(page, screenshot=False): + """Conda-store ui login sequence. From the default UI interface, click log + in and go through the log in UI on the following page. The UI will be + returned back to the default UI. + """ + # Log in sequence + # Click Login + page.locator("text=Log in").click() + + if screenshot: + page.screenshot(path="screenshots/conda-store-login_screen.png") + + # Fill in the Username field + page.locator('[placeholder="Username"]').fill("username") + + # Fill in the Password field + page.locator('[placeholder="Password"]').fill("password") + + with page.expect_navigation(): + page.locator('button:has-text("Sign In")').click() + + if screenshot: + page.screenshot(path="screenshots/conda-store-authenticated.png") + + +def create_new_environment(page, screenshot=False): + """Workflow to create a new environment in the UI. The env will be + in the "username" workspace and will have a semi-random number to + ensure that the env is indeed new since if the environment already + exists we get a different UI. This allows this test to be run multiple + times without needing to empty the database. + + Note: this environment takes about a minute to create + WARNING: Changes to this method will require reflective changes on + `existing_environment_interactions` since it uses this env. + + Parameters + ---------- + page: playwright.Page + page object for the current test being run + screenshot: bool + [Optional] Flag to trigger screenshot collection, set to True to + grab screenshots + """ + # ensure new filename in case this test is run multiple times + new_env_name = f'test_env_{random.randint(0, 100000)}' + # set timeout for building the environment + time_to_build_env = 2 * 60 * 1000 # 2 minutes in milliseconds + + # Create the new environment + # click the + to create a new env + page.get_by_label("Create a new environment in the username namespace").click() + if screenshot: + page.screenshot(path="screenshots/conda-store-new-env.png") + # fill in the env name + page.get_by_placeholder("Environment name").fill(new_env_name) + # fill in the description + page.get_by_placeholder("Enter here the description of your environment").fill("description") + # click the + to add a package + page.get_by_role("button", name="+ Add Package").click() + # add a package to the ui + page.get_by_label("Enter package").fill("rich") + page.get_by_role("option", name="rich", exact=True).click() + # open up the channels accordian card + page.get_by_role("button", name="Channels").click() + # click the + to add a channel + page.get_by_role("button", name="+ Add Channel").click() + # fill in conda-forge as the new channel name + page.get_by_label("Enter channel").fill("conda-forge") + # press enter to submit the channel to the list + page.get_by_label("Enter channel").press("Enter") + # click create to start building the env + page.get_by_role("button", name="Create", exact=True).click() + + # Interact with the environment shortly after creation + # click to open the Active environment dropdown manu + page.get_by_role("button", name=" - Active", exact=False).click() + # click on the Active environment on the dropdown menu item (which is currently building) + page.get_by_role("option", name=" - Active", exact=False).click() + # ensure that the environment is building + assert page.get_by_text("Building").is_visible() + # wait until the status is `Completed` + completed = page.get_by_text("Completed", exact=False) + completed.wait_for(state='attached', timeout=time_to_build_env) + assert completed.is_visible() + + return new_env_name + + +def close_environment_tabs(page): + """Close any open tabs in the UI. This will continue closing tabs + until no tabs remain open. + + Paramaters + ---------- + page: playwright.Page + page object for the current test being run + """ + close_tab = page.get_by_test_id("closeTab") + while close_tab.count() > 0: + close_tab.first.click() + + +def existing_environment_interactions(page, env_name, time_to_build_env=2*60*1000, screenshot=False): + """test interactions with existing environments. + During this test, the test will be rebuilt twice. + + Note: This test assumes the environment being tested is the one from + `create_new_environment`. Changes to that method will require changes + here as well (expected existing packages, etc). + + Parameters + ---------- + page: playwright.Page + page object for the current test being run + screenshot: bool + [Optional] Flag to trigger screenshot collection, set to True to + grab screenshots + + """ + # edit existing environment throught the YAML editor + page.get_by_role("button", name=env_name).click() + page.get_by_role("button", name="Edit").click() + page.get_by_label("Switch to YAML Editor").check() + if screenshot: + page.screenshot(path="screenshots/conda-store-yaml-editor.png") + page.get_by_text("- rich").click() + # TODO: is "-pip: nothing" a bug? + page.get_by_text("channels: - conda-forgedependencies: - rich - pip: - nothing - ipykernel").fill("channels:\n - conda-forge\ndependencies:\n - rich\n - python\n - pip:\n - nothing\n - ipykernel\n\n") + page.get_by_role("button", name="Save").click() + # wait until the status is `Completed` + completed = page.get_by_text("Completed", exact=False) + completed.wait_for(state='attached', timeout=time_to_build_env) + + # ensure the namespace is expanded + if not page.get_by_role("button", name=env_name).is_visible(): + # click to expand the `username` name space (but not click the +) + page.get_by_role("button", name="username Create a new environment in the username namespace").click() + + # edit existing environment + page.get_by_role("button", name=env_name).click() + page.get_by_role("button", name="Edit").click() + # page.get_by_placeholder("Enter here the description of your environment").click() + # change the description + page.get_by_placeholder("Enter here the description of your environment").fill("new description") + # change the vesion spec of an existing package + page.get_by_role("row", name="ipykernel", exact=False).get_by_role("button").first.click() + page.get_by_role("option", name=">=").click() + # Note: purposefully not testing version constraint since there is inconsistent behavior here + + # add a new package + page.get_by_role("button", name="+ Add Package").click() + page.get_by_label("Enter package").fill("click") + page.get_by_role("option", name="click", exact=True).click() + # Note: purposefully not testing version constraint since there is inconsistent behavior here + + # delete a package + page.get_by_role("row", name="rich", exact=False).get_by_test_id("RemovePackageTest").click() + + # promote a package installed as dependency to specified package + page.locator("#infScroll > .infinite-scroll-component__outerdiv > .infinite-scroll-component > div > div > .MuiButtonBase-root").first.click() + + # delete conda-forge channel + page.get_by_test_id("DeleteIcon").click() + # add conda-forge channel + page.get_by_role("button", name="+ Add Channel").click() + page.get_by_label("Enter channel").fill("conda-forge") + page.get_by_label("Enter channel").press("Enter") + # click save to start the new env build + page.get_by_role("button", name="Save").click() + + # wait until the status is `Completed` + completed = page.get_by_text("Completed", exact=False) + completed.wait_for(state='attached', timeout=time_to_build_env) + + + # Edit -> Cancel editing + page.get_by_role("button", name=env_name).click() + page.get_by_role("button", name="Edit").click() + page.get_by_role("button", name="Cancel").click() + + # Edit -> Delete environment + page.get_by_role("button", name="Edit").click() + page.get_by_text("Delete environment").click() + page.get_by_role("button", name="Delete").click() + + assert not page.get_by_role("button", name=env_name).is_visible() + + + +def test_integration(page: Page, test_config, screenshot): + + # Go to http://localhost:{server_port} + page.goto(test_config['base_url'], wait_until="domcontentloaded") + + page.screenshot(path="screenshots/conda-store-unauthenticated.png") + if screenshot: + page.screenshot(path="screenshots/conda-store-unauthenticated.png") + + login_sequence(page, screenshot=screenshot) + + + + +if __name__ == "__main__": + """Note that if you are testing locally on dev install, you will likely need + to change the server port to 8081 since the old UI will be running on 8080. + Also note that the local base_url is slightly different. + """ + + CONDA_STORE_SERVER_PORT = 8081 + config = { + 'base_url': f"http://localhost:{CONDA_STORE_SERVER_PORT}", + 'username': CONDA_STORE_USERNAME, + 'password': CONDA_STORE_PASSWORD, + 'server_port': CONDA_STORE_SERVER_PORT, + } + screenshot = False + + # ######################################################################## + # Start playwright and setup + playwright = sync_playwright().start() + # Use playwright.chromium, playwright.firefox or playwright.webkit + # Pass headless=False to launch() to see the browser UI + # slow_mo adds milliseconds to each playwright command so humans can follow along + browser = playwright.chromium.launch(headless=False, slow_mo=500) + page = browser.new_page() + + # Go to http://localhost:{server_port} + page.goto(config['base_url'], wait_until="domcontentloaded") + + # Log in to conda-store + login_sequence(page) + + # create a new environment + env_name = create_new_environment(page, screenshot=screenshot) + + # close any open tabs on the conda-store ui + close_environment_tabs(page) + + # interact with an existing environment + existing_environment_interactions(page, env_name, screenshot=screenshot) + + browser.close() + playwright.stop() \ No newline at end of file From dc14b04c5ce0b70620c63471983b1d5678a1d49f Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 12:03:44 -0500 Subject: [PATCH 02/24] fix typo --- .github/workflows/test.yml | 7 ++++--- test/playwright/test_ux.py | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39d18145..16250632 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: with: mamba-version: "*" activate-environment: test-env - environment-file: environment-dev.yaml + environment-file: environment_dev.yaml auto-activate-base: false - name: Deploy conda-store-server docker container @@ -56,14 +56,15 @@ jobs: yarn install yarn run build yarn run start + yarn test - name: Run Playwright tests run: | playwright install - pytest --video on test/playwright/test_ux.py + pytest --video on --output test-results test/playwright/test_ux.py - uses: actions/upload-artifact@v2 if: ${{ always() }} with: name: playwright-tests - path: screenshots + path: test-results diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py index e3dd9012..784aa268 100644 --- a/test/playwright/test_ux.py +++ b/test/playwright/test_ux.py @@ -39,7 +39,7 @@ def login_sequence(page, screenshot=False): page.locator("text=Log in").click() if screenshot: - page.screenshot(path="screenshots/conda-store-login_screen.png") + page.screenshot(path="test-results/conda-store-login_screen.png") # Fill in the Username field page.locator('[placeholder="Username"]').fill("username") @@ -51,7 +51,7 @@ def login_sequence(page, screenshot=False): page.locator('button:has-text("Sign In")').click() if screenshot: - page.screenshot(path="screenshots/conda-store-authenticated.png") + page.screenshot(path="test-results/conda-store-authenticated.png") def create_new_environment(page, screenshot=False): @@ -82,7 +82,7 @@ def create_new_environment(page, screenshot=False): # click the + to create a new env page.get_by_label("Create a new environment in the username namespace").click() if screenshot: - page.screenshot(path="screenshots/conda-store-new-env.png") + page.screenshot(path="test-results/conda-store-new-env.png") # fill in the env name page.get_by_placeholder("Environment name").fill(new_env_name) # fill in the description @@ -154,7 +154,7 @@ def existing_environment_interactions(page, env_name, time_to_build_env=2*60*100 page.get_by_role("button", name="Edit").click() page.get_by_label("Switch to YAML Editor").check() if screenshot: - page.screenshot(path="screenshots/conda-store-yaml-editor.png") + page.screenshot(path="test-results/conda-store-yaml-editor.png") page.get_by_text("- rich").click() # TODO: is "-pip: nothing" a bug? page.get_by_text("channels: - conda-forgedependencies: - rich - pip: - nothing - ipykernel").fill("channels:\n - conda-forge\ndependencies:\n - rich\n - python\n - pip:\n - nothing\n - ipykernel\n\n") @@ -224,9 +224,9 @@ def test_integration(page: Page, test_config, screenshot): # Go to http://localhost:{server_port} page.goto(test_config['base_url'], wait_until="domcontentloaded") - page.screenshot(path="screenshots/conda-store-unauthenticated.png") + page.screenshot(path="test-results/conda-store-unauthenticated.png") if screenshot: - page.screenshot(path="screenshots/conda-store-unauthenticated.png") + page.screenshot(path="test-results/conda-store-unauthenticated.png") login_sequence(page, screenshot=screenshot) From aa21b48bff1f353d75cd314abdb8203d50881c94 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 12:55:47 -0500 Subject: [PATCH 03/24] fix another typo... --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16250632..6f68ff5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: with: mamba-version: "*" activate-environment: test-env - environment-file: environment_dev.yaml + environment-file: environment_dev.yml auto-activate-base: false - name: Deploy conda-store-server docker container @@ -56,6 +56,9 @@ jobs: yarn install yarn run build yarn run start + + - name: Test webpack dev server + run: | yarn test - name: Run Playwright tests From 4e6a4baaf450e06c319afa544092cf953c528af4 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 13:07:55 -0500 Subject: [PATCH 04/24] take a different approach to yarn start --- .github/workflows/test.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f68ff5b..0374cab6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,26 +46,38 @@ jobs: - name: Deploy conda-store-server docker container run: | - docker-compose -f docker-compose-dev.yml up --build + 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 - run: | - yarn install - yarn run build - yarn run start - - name: Test webpack dev server + - name: Deployed UI tests + uses: ./ + with: + build: yarn run build + start: yarn start + # wait-on: 'http://localhost:5001' run: | yarn test - - - name: Run Playwright tests - run: | playwright install pytest --video on --output test-results test/playwright/test_ux.py + # - name: Deploy webpack dev server + # run: | + # yarn install + # yarn run build + # yarn run start + + # - name: Test webpack dev server + # run: | + # yarn test + + # - name: Run Playwright tests + # run: | + # playwright install + # pytest --video on --output test-results test/playwright/test_ux.py + - uses: actions/upload-artifact@v2 if: ${{ always() }} with: From 3b99b39bd79fdf2b1cb1f61f6b3f26cef04d7aa6 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 13:48:35 -0500 Subject: [PATCH 05/24] take a different approach to yarn start --- .github/workflows/test.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0374cab6..2b146f6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,23 +52,26 @@ jobs: wait-for-it localhost:5000 # conda-store-server - - name: Deployed UI tests - uses: ./ - with: - build: yarn run build - start: yarn start - # wait-on: 'http://localhost:5001' + # - name: Deployed UI tests + # uses: ./ + # with: + # build: yarn run build + # start: yarn start + # # wait-on: 'http://localhost:5001' + # run: | + # yarn test + # playwright install + # pytest --video on --output test-results test/playwright/test_ux.py + + - name: Deploy webpack dev server run: | + yarn install + yarn run build + yarn run start & yarn test playwright install pytest --video on --output test-results test/playwright/test_ux.py - # - name: Deploy webpack dev server - # run: | - # yarn install - # yarn run build - # yarn run start - # - name: Test webpack dev server # run: | # yarn test @@ -78,6 +81,7 @@ jobs: # playwright install # pytest --video on --output test-results test/playwright/test_ux.py + - name: Upload artifacts - uses: actions/upload-artifact@v2 if: ${{ always() }} with: From ceb95aea08ee3f8288203b2ad2e487fce3cf02a0 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 13:53:05 -0500 Subject: [PATCH 06/24] gh action syntax fix --- .github/workflows/test.yml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b146f6b..2ba4cf48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,17 +52,6 @@ jobs: wait-for-it localhost:5000 # conda-store-server - # - name: Deployed UI tests - # uses: ./ - # with: - # build: yarn run build - # start: yarn start - # # wait-on: 'http://localhost:5001' - # run: | - # yarn test - # playwright install - # pytest --video on --output test-results test/playwright/test_ux.py - - name: Deploy webpack dev server run: | yarn install @@ -72,17 +61,8 @@ jobs: playwright install pytest --video on --output test-results test/playwright/test_ux.py - # - name: Test webpack dev server - # run: | - # yarn test - - # - name: Run Playwright tests - # run: | - # playwright install - # pytest --video on --output test-results test/playwright/test_ux.py - - name: Upload artifacts - - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v2 if: ${{ always() }} with: name: playwright-tests From 45947bdde9596f0d8ffde4312da0393dd4551c9c Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 14:00:36 -0500 Subject: [PATCH 07/24] add wait-for-it --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ba4cf48..594eb344 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,10 @@ jobs: 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 From 3402f33b681a6ad1e0e290cc6cbd0d8e7954c5e1 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 14:21:43 -0500 Subject: [PATCH 08/24] ensure conda env is activated --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 594eb344..c893f2ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,12 +57,13 @@ jobs: - name: Deploy webpack dev server + shell: bash -el {0} run: | + conda list + playwright install yarn install yarn run build yarn run start & - yarn test - playwright install pytest --video on --output test-results test/playwright/test_ux.py - name: Upload artifacts From 70a58c32f3ceb6869a52b5d8ec0bb10dbad2a107 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 14:43:06 -0500 Subject: [PATCH 09/24] yarm immutable installs false --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c893f2ed..c3754a41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,7 @@ env: 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: From 6dd6a5d5f93dc5c9fd209aa2b1eb8ad72ee40469 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 18 Sep 2023 15:11:43 -0500 Subject: [PATCH 10/24] screenshot is a forbidden pytest option, create .env file --- .github/workflows/test.yml | 6 +++++- test/playwright/conftest.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3754a41..c256577a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,10 @@ jobs: environment-file: environment_dev.yml auto-activate-base: false + - name: Create Environment variables file + run: | + envsubst < .env.example > .env + - name: Install Dependencies run: | sudo apt install wait-for-it -y @@ -65,7 +69,7 @@ jobs: yarn install yarn run build yarn run start & - pytest --video on --output test-results test/playwright/test_ux.py + pytest --video on --output test-results --screenshots true test/playwright/test_ux.py - name: Upload artifacts uses: actions/upload-artifact@v2 diff --git a/test/playwright/conftest.py b/test/playwright/conftest.py index 8b24a1bf..1b09f67e 100644 --- a/test/playwright/conftest.py +++ b/test/playwright/conftest.py @@ -2,11 +2,11 @@ def pytest_addoption(parser): - parser.addoption("--screenshot", action="store", default="false") + parser.addoption("--screenshots", action="store", default="false") @pytest.fixture(scope="session") def screenshot(pytestconfig): - if pytestconfig.getoption("screenshot") == 'false': + if pytestconfig.getoption("screenshots") == 'false': return False else: return True From 09399d1f4fbb773c426238d3e86bc46eaa7bd72d Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Tue, 19 Sep 2023 11:43:47 -0500 Subject: [PATCH 11/24] switch to expect new ui on 8080 --- .github/workflows/test.yml | 3 ++- test/playwright/test_ux.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c256577a..aa00a70a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,8 @@ name: Tests env: - CONDA_STORE_URL: http://localhost:5000/conda-store + CONDA_STORE_SERVER_PORT: 8080 + CONDA_STORE_BASE_URL: http://localhost:{{ $CONDA_STORE_SERVER_PORT }} CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username CONDA_STORE_PASSWORD: password diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py index 784aa268..c7ea14ad 100644 --- a/test/playwright/test_ux.py +++ b/test/playwright/test_ux.py @@ -10,7 +10,7 @@ CONDA_STORE_SERVER_PORT = os.environ.get( - "CONDA_STORE_SERVER_PORT", f"5000" + "CONDA_STORE_SERVER_PORT", f"8080" ) CONDA_STORE_BASE_URL = os.environ.get( "CONDA_STORE_BASE_URL", f"http://localhost:{CONDA_STORE_SERVER_PORT}/conda-store/" From aa9e0391480c916d86565ed997e1e10d145a156d Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Wed, 20 Sep 2023 10:34:10 -0500 Subject: [PATCH 12/24] switch to look on port 8081 for the test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa00a70a..a0f704a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Tests env: - CONDA_STORE_SERVER_PORT: 8080 + CONDA_STORE_SERVER_PORT: 8081 CONDA_STORE_BASE_URL: http://localhost:{{ $CONDA_STORE_SERVER_PORT }} CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username From 4c57eb6385a78659a3b715947a6aa19b60b64586 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Wed, 20 Sep 2023 12:28:15 -0500 Subject: [PATCH 13/24] i obviously didn't know how to envsubst works --- .env.example | 6 +++--- .env.tpl | 8 ++++++++ .github/workflows/test.yml | 10 +++++----- 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .env.tpl diff --git a/.env.example b/.env.example index 132e8662..e20a1fde 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ -REACT_APP_API_URL=http://localhost:5000/conda-store/ +REACT_APP_API_URL=http://localhost:8080/conda-store/ REACT_APP_AUTH_METHOD=cookie -REACT_APP_LOGIN_PAGE_URL=http://localhost:5000/conda-store/login?next= +REACT_APP_LOGIN_PAGE_URL=http://localhost:8080/conda-store/login?next= REACT_APP_AUTH_TOKEN= REACT_APP_STYLE_TYPE=grayscale REACT_APP_CONTEXT=webapp REACT_APP_SHOW_AUTH_BUTTON=true -REACT_APP_LOGOUT_PAGE_URL=http://localhost:5000/conda-store/logout?next=/ \ No newline at end of file +REACT_APP_LOGOUT_PAGE_URL=http://localhost:8080/conda-store/logout?next=/ \ No newline at end of file diff --git a/.env.tpl b/.env.tpl new file mode 100644 index 00000000..8b23ef41 --- /dev/null +++ b/.env.tpl @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0f704a6..a666073d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,14 +6,14 @@ env: CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username CONDA_STORE_PASSWORD: password - REACT_APP_API_URL: http://localhost:5000/conda-store/ + REACT_APP_API_URL: http://localhost:8080/conda-store/ REACT_APP_AUTH_METHOD: cookie - REACT_APP_LOGIN_PAGE_URL: http://localhost:5000/conda-store/login?next= + REACT_APP_LOGIN_PAGE_URL: http://localhost:8080/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=/ + REACT_APP_LOGOUT_PAGE_URL: http://localhost:8080/conda-store/logout?next=/ YARN_ENABLE_IMMUTABLE_INSTALLS: false on: @@ -48,7 +48,7 @@ jobs: - name: Create Environment variables file run: | - envsubst < .env.example > .env + envsubst < .env.tpl > .env - name: Install Dependencies run: | @@ -66,7 +66,7 @@ jobs: shell: bash -el {0} run: | conda list - playwright install + playwright install chromium yarn install yarn run build yarn run start & From 8da719f761b615917661c5e93af69f722be425cb Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Wed, 20 Sep 2023 12:40:11 -0500 Subject: [PATCH 14/24] why does this work differently on my machine??? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a666073d..878d8dab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Tests env: - CONDA_STORE_SERVER_PORT: 8081 + CONDA_STORE_SERVER_PORT: 8080 CONDA_STORE_BASE_URL: http://localhost:{{ $CONDA_STORE_SERVER_PORT }} CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username From 25ca867ec591e553eadfd06bc8260c4256d7c831 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Fri, 22 Sep 2023 10:50:23 -0500 Subject: [PATCH 15/24] switch back to 5000 for conda-store-server and 8080 for the ui --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 878d8dab..c00d89fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,14 +6,14 @@ env: CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username CONDA_STORE_PASSWORD: password - REACT_APP_API_URL: http://localhost:8080/conda-store/ + REACT_APP_API_URL: http://localhost:5000/conda-store/ REACT_APP_AUTH_METHOD: cookie - REACT_APP_LOGIN_PAGE_URL: http://localhost:8080/conda-store/login?next= + 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:8080/conda-store/logout?next=/ + REACT_APP_LOGOUT_PAGE_URL: http://localhost:5000/conda-store/logout?next=/ YARN_ENABLE_IMMUTABLE_INSTALLS: false on: From 6f54bd1e521010377c707fb53b8d21a70584cdb9 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Fri, 22 Sep 2023 13:47:23 -0500 Subject: [PATCH 16/24] add a long timeout for the first page load to ensure startup is complete --- test/playwright/test_ux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py index c7ea14ad..a6488b8f 100644 --- a/test/playwright/test_ux.py +++ b/test/playwright/test_ux.py @@ -222,7 +222,7 @@ def existing_environment_interactions(page, env_name, time_to_build_env=2*60*100 def test_integration(page: Page, test_config, screenshot): # Go to http://localhost:{server_port} - page.goto(test_config['base_url'], wait_until="domcontentloaded") + page.goto(test_config['base_url'], wait_until="domcontentloaded", timeout=4*60*1000) page.screenshot(path="test-results/conda-store-unauthenticated.png") if screenshot: From 56cc4f0269c9efe7d2bb37a3585f0b5f6c44ebd7 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 2 Oct 2023 10:43:13 -0500 Subject: [PATCH 17/24] use 5000 for server port --- .env.example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index e20a1fde..132e8662 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ -REACT_APP_API_URL=http://localhost:8080/conda-store/ +REACT_APP_API_URL=http://localhost:5000/conda-store/ REACT_APP_AUTH_METHOD=cookie -REACT_APP_LOGIN_PAGE_URL=http://localhost:8080/conda-store/login?next= +REACT_APP_LOGIN_PAGE_URL=http://localhost:5000/conda-store/login?next= REACT_APP_AUTH_TOKEN= REACT_APP_STYLE_TYPE=grayscale REACT_APP_CONTEXT=webapp REACT_APP_SHOW_AUTH_BUTTON=true -REACT_APP_LOGOUT_PAGE_URL=http://localhost:8080/conda-store/logout?next=/ \ No newline at end of file +REACT_APP_LOGOUT_PAGE_URL=http://localhost:5000/conda-store/logout?next=/ \ No newline at end of file From dc982470f52ba0f908fdf2dd570f2b82d834bed3 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 2 Oct 2023 14:19:25 -0500 Subject: [PATCH 18/24] one. more. try. --- .github/workflows/test.yml | 1 + environment_dev.yml | 1 + test/playwright/test_ux.py | 22 ++++++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) mode change 100644 => 100755 environment_dev.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c00d89fb..9bbd98fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,6 +72,7 @@ jobs: yarn run start & pytest --video on --output test-results --screenshots true test/playwright/test_ux.py +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() }} diff --git a/environment_dev.yml b/environment_dev.yml old mode 100644 new mode 100755 index b38ff1ab..4d3c10b3 --- a/environment_dev.yml +++ b/environment_dev.yml @@ -8,6 +8,7 @@ dependencies: - python=3.10 - yarn - nodejs==16.14.2 +- pytest - pip: - playwright - pytest-playwright diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py index a6488b8f..bddb6074 100644 --- a/test/playwright/test_ux.py +++ b/test/playwright/test_ux.py @@ -2,6 +2,8 @@ inside and outside of pytest to make future development easier. """ import os +import requests +import time import pytest from playwright.sync_api import Page @@ -13,7 +15,7 @@ "CONDA_STORE_SERVER_PORT", f"8080" ) CONDA_STORE_BASE_URL = os.environ.get( - "CONDA_STORE_BASE_URL", f"http://localhost:{CONDA_STORE_SERVER_PORT}/conda-store/" + "CONDA_STORE_BASE_URL", f"http://localhost:{CONDA_STORE_SERVER_PORT}" ) CONDA_STORE_USERNAME = os.environ.get("CONDA_STORE_USERNAME", "username") CONDA_STORE_PASSWORD = os.environ.get("CONDA_STORE_PASSWORD", "password") @@ -220,6 +222,21 @@ def existing_environment_interactions(page, env_name, time_to_build_env=2*60*100 def test_integration(page: Page, test_config, screenshot): + """Basic integration test. + + When this test runs in CI, we launch the webpack server as a detached + service at the same time that this test is run. For this reason, we + have a try/except here to allow the webpack server to finish deploying + before the test begins. + """ + # wait for server to spin up if necessary + server_running = False + while not server_running: + try: + requests.head(test_config['base_url'], allow_redirects=True).status_code != 200 + server_running = True + except requests.exceptions.ConnectionError: + time.sleep(2) # Go to http://localhost:{server_port} page.goto(test_config['base_url'], wait_until="domcontentloaded", timeout=4*60*1000) @@ -231,15 +248,12 @@ def test_integration(page: Page, test_config, screenshot): login_sequence(page, screenshot=screenshot) - - if __name__ == "__main__": """Note that if you are testing locally on dev install, you will likely need to change the server port to 8081 since the old UI will be running on 8080. Also note that the local base_url is slightly different. """ - CONDA_STORE_SERVER_PORT = 8081 config = { 'base_url': f"http://localhost:{CONDA_STORE_SERVER_PORT}", 'username': CONDA_STORE_USERNAME, From 9300c5b89a82f97016ff039ce74340c57412cedd Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 2 Oct 2023 14:35:15 -0500 Subject: [PATCH 19/24] cleanup --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9bbd98fa..05d718a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Tests +name: Playwright Tests env: CONDA_STORE_SERVER_PORT: 8080 @@ -72,7 +72,6 @@ jobs: yarn run start & pytest --video on --output test-results --screenshots true test/playwright/test_ux.py -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() }} From 84039b042ef8482a5a0e2789a5407a2e7b2bfeff Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Mon, 2 Oct 2023 15:20:42 -0500 Subject: [PATCH 20/24] env var in ci --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05d718a7..438ca7f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Playwright Tests env: CONDA_STORE_SERVER_PORT: 8080 - CONDA_STORE_BASE_URL: http://localhost:{{ $CONDA_STORE_SERVER_PORT }} + CONDA_STORE_BASE_URL: http://localhost:$CONDA_STORE_SERVER_PORT CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username CONDA_STORE_PASSWORD: password From da7a1ec15c96528e755c16e2f7de4f05aaff9fa9 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Tue, 3 Oct 2023 09:04:34 -0500 Subject: [PATCH 21/24] gh actions doesnt support env vars in env vars --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 438ca7f5..b5a86bb4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Playwright Tests env: CONDA_STORE_SERVER_PORT: 8080 - CONDA_STORE_BASE_URL: http://localhost:$CONDA_STORE_SERVER_PORT + CONDA_STORE_BASE_URL: http://localhost:8080 CONDA_STORE_AUTH: basic CONDA_STORE_USERNAME: username CONDA_STORE_PASSWORD: password From b28084d99133065256f54adfe6146cd648d83f44 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Thu, 5 Oct 2023 16:24:16 -0400 Subject: [PATCH 22/24] add a few more doc strings --- .github/workflows/test.yml | 4 --- test/playwright/test_ux.py | 69 ++++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5a86bb4..84e44a87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,10 +46,6 @@ jobs: environment-file: environment_dev.yml auto-activate-base: false - - name: Create Environment variables file - run: | - envsubst < .env.tpl > .env - - name: Install Dependencies run: | sudo apt install wait-for-it -y diff --git a/test/playwright/test_ux.py b/test/playwright/test_ux.py index bddb6074..1b1f8e4c 100644 --- a/test/playwright/test_ux.py +++ b/test/playwright/test_ux.py @@ -31,10 +31,18 @@ def test_config(): } -def login_sequence(page, screenshot=False): +def _login_sequence(page, screenshot=False): """Conda-store ui login sequence. From the default UI interface, click log in and go through the log in UI on the following page. The UI will be returned back to the default UI. + + Parameters + ---------- + page: playwright.Page + page object for the current test being run + screenshot: bool + [Optional] Flag to trigger screenshot collection, set to True to + grab screenshots """ # Log in sequence # Click Login @@ -56,7 +64,7 @@ def login_sequence(page, screenshot=False): page.screenshot(path="test-results/conda-store-authenticated.png") -def create_new_environment(page, screenshot=False): +def _create_new_environment(page, screenshot=False): """Workflow to create a new environment in the UI. The env will be in the "username" workspace and will have a semi-random number to ensure that the env is indeed new since if the environment already @@ -65,7 +73,7 @@ def create_new_environment(page, screenshot=False): Note: this environment takes about a minute to create WARNING: Changes to this method will require reflective changes on - `existing_environment_interactions` since it uses this env. + `_existing_environment_interactions` since it uses this env. Parameters ---------- @@ -120,7 +128,7 @@ def create_new_environment(page, screenshot=False): return new_env_name -def close_environment_tabs(page): +def _close_environment_tabs(page): """Close any open tabs in the UI. This will continue closing tabs until no tabs remain open. @@ -134,18 +142,22 @@ def close_environment_tabs(page): close_tab.first.click() -def existing_environment_interactions(page, env_name, time_to_build_env=2*60*1000, screenshot=False): +def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*1000, screenshot=False): """test interactions with existing environments. During this test, the test will be rebuilt twice. Note: This test assumes the environment being tested is the one from - `create_new_environment`. Changes to that method will require changes + `_create_new_environment`. Changes to that method will require changes here as well (expected existing packages, etc). Parameters ---------- page: playwright.Page page object for the current test being run + env_name: str + Name of existing environment to interact with - must already exist! + time_to_build_env: float + [Optional] Time to wait for an updated environment to rebuild in ms screenshot: bool [Optional] Flag to trigger screenshot collection, set to True to grab screenshots @@ -158,7 +170,6 @@ def existing_environment_interactions(page, env_name, time_to_build_env=2*60*100 if screenshot: page.screenshot(path="test-results/conda-store-yaml-editor.png") page.get_by_text("- rich").click() - # TODO: is "-pip: nothing" a bug? page.get_by_text("channels: - conda-forgedependencies: - rich - pip: - nothing - ipykernel").fill("channels:\n - conda-forge\ndependencies:\n - rich\n - python\n - pip:\n - nothing\n - ipykernel\n\n") page.get_by_role("button", name="Save").click() # wait until the status is `Completed` @@ -228,15 +239,30 @@ def test_integration(page: Page, test_config, screenshot): service at the same time that this test is run. For this reason, we have a try/except here to allow the webpack server to finish deploying before the test begins. + + Parameters + ---------- + page: playwright.Page + page object for the current test being run + test_config: + Fixture containing the configuration env vars + screenshot: bool + Fixture flag to trigger screenshot collection, set to True to + grab screenshots """ # wait for server to spin up if necessary server_running = False - while not server_running: + retry_wait_time = 2 # seconds + max_wait_time = 4 * 60 # 4 minutes + elapsed_wait_time = 0 + # loop until server is running or max_wait_time is reached + while not server_running and elapsed_wait_time < max_wait_time: try: requests.head(test_config['base_url'], allow_redirects=True).status_code != 200 server_running = True except requests.exceptions.ConnectionError: - time.sleep(2) + elapsed_wait_time += retry_wait_time + time.sleep(retry_wait_time) # Go to http://localhost:{server_port} page.goto(test_config['base_url'], wait_until="domcontentloaded", timeout=4*60*1000) @@ -245,13 +271,22 @@ def test_integration(page: Page, test_config, screenshot): if screenshot: page.screenshot(path="test-results/conda-store-unauthenticated.png") - login_sequence(page, screenshot=screenshot) + # Log in to conda-store + _login_sequence(page, screenshot=screenshot) + + # create a new environment + env_name = _create_new_environment(page, screenshot=screenshot) + + # close any open tabs on the conda-store ui + _close_environment_tabs(page) + + # interact with an existing environment + _existing_environment_interactions(page, env_name, screenshot=screenshot) if __name__ == "__main__": - """Note that if you are testing locally on dev install, you will likely need - to change the server port to 8081 since the old UI will be running on 8080. - Also note that the local base_url is slightly different. + """This sequence runs through the basic UI test outside of pytest to allow + for more control during development. It is not intended to be used in CI. """ config = { @@ -275,16 +310,16 @@ def test_integration(page: Page, test_config, screenshot): page.goto(config['base_url'], wait_until="domcontentloaded") # Log in to conda-store - login_sequence(page) + _login_sequence(page) # create a new environment - env_name = create_new_environment(page, screenshot=screenshot) + env_name = _create_new_environment(page, screenshot=screenshot) # close any open tabs on the conda-store ui - close_environment_tabs(page) + _close_environment_tabs(page) # interact with an existing environment - existing_environment_interactions(page, env_name, screenshot=screenshot) + _existing_environment_interactions(page, env_name, screenshot=screenshot) browser.close() playwright.stop() \ No newline at end of file From 71537bf53df71b42605fc54ba1953cac185b0f7a Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Thu, 5 Oct 2023 17:32:01 -0400 Subject: [PATCH 23/24] attempt to fix mamba issues with unknown symbol --- environment_dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment_dev.yml b/environment_dev.yml index 4d3c10b3..bdbcdadc 100755 --- a/environment_dev.yml +++ b/environment_dev.yml @@ -11,4 +11,4 @@ dependencies: - pytest - pip: - playwright - - pytest-playwright + - pytest-playwright \ No newline at end of file From 00da8d6fe8b24a98e1b4efd2023dc806eefbad02 Mon Sep 17 00:00:00 2001 From: Kim Pevey Date: Fri, 6 Oct 2023 09:32:37 -0500 Subject: [PATCH 24/24] fix for setup-miniconda solver issues --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84e44a87..54708819 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,8 +40,9 @@ jobs: - name: Set up Python uses: conda-incubator/setup-miniconda@v2 + env: + CONDA_SOLVER: libmamba with: - mamba-version: "*" activate-environment: test-env environment-file: environment_dev.yml auto-activate-base: false