From e756d5026b99951e9200758fca992134bf4f6739 Mon Sep 17 00:00:00 2001 From: Otto Mehes Date: Mon, 17 Jun 2024 17:40:08 -0500 Subject: [PATCH] amended selectors and authentication --- tests/ui/pages/home.py | 15 +++++++++++++-- tests/ui/test_home_ui.py | 9 ++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/ui/pages/home.py b/tests/ui/pages/home.py index f6dae06a..671fe27e 100644 --- a/tests/ui/pages/home.py +++ b/tests/ui/pages/home.py @@ -320,7 +320,7 @@ def private_repo_warning_is_visible(self): @property def gitpod_user_dropdown(self): - return self.page.wait_for_selector("div:nth-child(1) > div.relative") + return self.page.wait_for_selector("div:nth-child(1) > button:nth-child(1)") def click_gitpod_user_dropdown(self): self.gitpod_user_dropdown.click() @@ -328,7 +328,7 @@ def click_gitpod_user_dropdown(self): @property def gitpod_user_selector(self): return self.page.wait_for_selector( - "div:nth-child(1) > div.relative :text('openstax')" + "div:nth-child(1) > button:nth-child(1) :text('openstax')" ) def click_gitpod_user_selector(self): @@ -349,6 +349,17 @@ def continue_with_github_button(self): def click_continue_with_github_button(self): self.continue_with_github_button.click() + @property + def continue_with_workspace_is_visible(self): + return self.page.is_visible("div.flex:nth-child(4)") + + @property + def continue_with_workspace_button(self): + return self.page.locator("button").get_by_text("Continue (⌘Enter)", exact=True) + + def click_continue_with_workspace_button(self): + self.continue_with_github_button.click() + def wait_for_validation_end( self, condition, timeout_seconds=900, interval_seconds=10 ): diff --git a/tests/ui/test_home_ui.py b/tests/ui/test_home_ui.py index 3f781019..2284fb62 100644 --- a/tests/ui/test_home_ui.py +++ b/tests/ui/test_home_ui.py @@ -23,11 +23,18 @@ def test_home_ui(chrome_page, github_user, github_password, gitpod_repo_url): github_login_window.click(sign_in_button_selector) + if home.continue_with_github_is_visible: + home.click_continue_with_github_button() + if home.gitpod_user_dropdown.inner_text() != "0 openstax": home.click_gitpod_user_dropdown() home.click_gitpod_user_selector() - home.click_workspace_continue_button() + if home.continue_with_github_is_visible: + home.click_continue_with_github_button() + + if home.continue_with_workspace_is_visible: + home.click_workspace_continue_button() # THEN: openstax extension launches and icon appears assert home.openstax_icon_is_visible