Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion test/ui/fixtures/ui_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def is_container_healthy() -> bool:
return result.returncode == 0


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def browser_setup(
request: pytest.FixtureRequest,
) -> Generator[tuple[WebDriver, str], None, None]:
Expand Down
67 changes: 13 additions & 54 deletions test/ui/test_80_lightspeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
vscode_playbook_generation,
vscode_prediction,
vscode_role_generation,
vscode_run_command,
vscode_run_command_f1,
wait_displayed,
)

Expand All @@ -30,55 +30,19 @@
tasks:
- name: install dnsutils"""

MULTI_SUGGESTIONS_PLAYBOOK = """---
- name: Playbook
hosts: all
tasks:
- name: Install dnsutils"""
logged_in_flag = False


def vscode_login_wrapper(driver: Any) -> None:
"""Log in with VSCode at the scope of this file."""
vscode_login(driver)
vscode_login(driver, device_login=True)
global logged_in_flag # noqa: PLW0603
logged_in_flag = True


# @pytest.mark.flaky(reruns=6, reruns_delay=10)
@pytest.mark.skip(reason="See https://redhat.atlassian.net/browse/AAP-67210")
def test_vscode_widget(
browser_setup: Any,
screenshot_on_fail: Any,
close_editors: Any,
) -> None:
"""Test that the vs-code widget shows up and works correctly.

Tests widget behavior when multiple suggestion extensions are installed.
"""
driver, _ = browser_setup

vscode_login_wrapper(driver)
vscode_prediction(
driver,
"playbook.yaml",
MULTI_SUGGESTIONS_PLAYBOOK,
accept=False,
mutil_provider=True,
)
# validate the widget is working correctly
wait_displayed(
driver,
"//span[contains(normalize-space(.), 'pilot')]",
timeout=20,
)


@pytest.mark.skip(reason="See https://redhat.atlassian.net/browse/AAP-67210")
def test_vscode_playbook_explanation(
browser_setup: Any,
screenshot_on_fail: Any,
close_editors: Any,
) -> None:
"""Test the playbook explanation feature from VSCode."""
driver, _ = browser_setup
Expand All @@ -105,11 +69,9 @@ def test_vscode_playbook_explanation(
assert phrase in explanation, msg


@pytest.mark.skip(reason="See https://redhat.atlassian.net/browse/AAP-67210")
def test_vscode_playbook_generation(
browser_setup: Any,
screenshot_on_fail: Any,
close_editors: Any,
) -> None:
"""Test the playbook generation feature from VSCode."""
driver, _ = browser_setup
Expand All @@ -127,11 +89,9 @@ def test_vscode_playbook_generation(
assert all(txt in playbook for txt in expected_playbook), "Error- bad playbook"


@pytest.mark.skip(reason="See https://redhat.atlassian.net/browse/AAP-67210")
def test_vscode_role_generation(
browser_setup: Any,
screenshot_on_fail: Any,
close_editors: Any,
) -> None:
"""Test the role generation feature from VSCode."""
driver, _ = browser_setup
Expand All @@ -144,39 +104,38 @@ def test_vscode_role_generation(
assert "ansible.builtin.package" in tasks


@pytest.mark.skip(reason="See https://redhat.atlassian.net/browse/AAP-67210")
def test_vscode_lightspeed_explorer(
browser_setup: Any,
screenshot_on_fail: Any,
close_editors: Any,
) -> None:
"""Test the Lightspeed explorer view from VSCode."""
driver, _ = browser_setup

if not logged_in_flag:
vscode_login_wrapper(driver)

vscode_run_command(driver, ">Ansible: Focus on Ansible Lightspeed View")
find_element_across_iframes(
vscode_run_command_f1(driver, "Ansible: Focus on Ansible Lightspeed View")
# verify logged-in state via the Accounts menu
accounts_button = wait_displayed(driver, "//a[@aria-label='Accounts']")
accounts_button.click()
wait_displayed(
driver,
# After https://github.com/tomershinhar/selenium-vscode-container/pull/16
# is deployed
# "//p[@class='user-content' and contains(normalize-space(.), 'Logged in as:')]",
"//*[contains(normalize-space(.), 'Logged in as:')]",
"//*[contains(normalize-space(.), 'lightspeed-test-user')]",
timeout=5,
)
find_element_across_iframes(
driver,
"//vscode-button[contains(normalize-space(.), 'Generate a playbook')]",
"//*[contains(normalize-space(.), 'Generate Playbook')]",
)
find_element_across_iframes(
driver,
"//vscode-button[contains(normalize-space(.), 'Explain the current playbook')]",
"//*[contains(normalize-space(.), 'Explain Playbook')]",
)
find_element_across_iframes(
driver,
"//vscode-button[contains(normalize-space(.), 'Generate a role')]",
"//*[contains(normalize-space(.), 'Generate Role')]",
)
find_element_across_iframes(
driver,
"//vscode-button[contains(normalize-space(.), 'Explain the current role')]",
"//*[contains(normalize-space(.), 'Explain Role')]",
)
Loading
Loading