Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/github/system-testing/e2e-playwright.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ test() {
source .venv/bin/activate
pushd tests/e2e-playwright
make test-sleepers
make test-platform
popd
}

Expand Down
23 changes: 23 additions & 0 deletions tests/e2e-playwright/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,29 @@ test-sleepers-dev: _check_venv_active ## runs sleepers test on local deploy
--autoregister \
$(CURDIR)/tests/sleepers/test_sleepers.py

.PHONY: test-platform
test-platform: _check_venv_active
@pytest \
-sxvv \
--color=yes \
--pdb \
--product-url=http://$(get_my_ip):9081 \
--autoregister \
--tracing=on \
$(CURDIR)/tests/platform_CI_tests/test_platform.py

.PHONY: test-platform-dev
test-platform-dev: _check_venv_active ## runs platform test on local deploy (with PWDEBUG=1)
@PWDEBUG=1 pytest \
-sxvv \
--color=yes \
--pdb \
--product-url=http://$(get_my_ip):9081 \
--headed \
--autoregister \
--tracing=on \
$(CURDIR)/tests/platform_CI_tests/test_platform.py


# Define the files where user input will be saved
SLEEPERS_INPUT_FILE := .e2e-playwright-sleepers-env.txt
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e-playwright/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ def _do() -> AutoRegisteredUser:
return _do


@pytest.fixture(scope="session")
def store_browser_context() -> bool:
return False


@pytest.fixture
def log_in_and_out(
page: Page,
Expand All @@ -331,6 +336,8 @@ def log_in_and_out(
user_password: Secret4TestsStr,
auto_register: bool,
register: Callable[[], AutoRegisteredUser],
store_browser_context: bool,
context: BrowserContext,
) -> Iterator[RestartableWebSocket]:
with log_context(
logging.INFO,
Expand Down Expand Up @@ -389,6 +396,9 @@ def log_in_and_out(
if quickStartWindowCloseBtnLocator.is_visible():
quickStartWindowCloseBtnLocator.click()

if store_browser_context:
context.storage_state(path="state.json")

# with web_socket_default_log_handler(ws):
yield restartable_wb

Expand Down
Empty file.
68 changes: 68 additions & 0 deletions tests/e2e-playwright/tests/platform_CI_tests/test_platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments
# pylint: disable=too-many-statements
# pylint: disable=no-name-in-module

from pathlib import Path

import pytest


@pytest.fixture(scope="session")
def store_browser_context() -> bool:
return True


@pytest.fixture
def logged_in_context(
playwright,
store_browser_context: bool,
request: pytest.FixtureRequest,
pytestconfig,
):
is_headed = "--headed" in pytestconfig.invocation_params.args

file_path = Path("state.json")
if not file_path.exists():
request.getfixturevalue("log_in_and_out")

browser = playwright.chromium.launch(headless=not is_headed)
context = browser.new_context(storage_state="state.json")
yield context
context.close()
browser.close()


@pytest.fixture(scope="module")
def test_module_teardown():

yield # Run the tests

file_path = Path("state.json")
if file_path.exists():
file_path.unlink()


def test_simple_folder_workflow(logged_in_context, product_url, test_module_teardown):
page = logged_in_context.new_page()

page.goto(f"{product_url}")
page.wait_for_timeout(1000)
page.get_by_test_id("dashboard").get_by_text("New folder", exact=True).click()
page.get_by_placeholder("Title").fill("My new folder")
page.get_by_placeholder("Title").press("Enter")

page.get_by_test_id("dashboard").get_by_text("My new folder").click()
page.get_by_test_id("contextTree").get_by_text("My Workspace").click()


def test_simple_workspace_workflow(
logged_in_context, product_url, test_module_teardown
):
page = logged_in_context.new_page()

page.goto(f"{product_url}")
page.wait_for_timeout(1000)
page.get_by_text("Shared Workspaces").click()
Loading