diff --git a/pages/queries.py b/pages/queries.py index 3d6581d..f6f11a0 100644 --- a/pages/queries.py +++ b/pages/queries.py @@ -12,7 +12,10 @@ Locator = typing.Tuple[typing.Any, str] class QueryDetailPage(Page): - _query_description_locator: Locator = (By.CSS_SELECTOR, ".edit-in-place p") + _query_description_locator: Locator = ( + By.CSS_SELECTOR, + "edit-in-place:nth-child(1) > span:nth-child(1) > p:nth-child(1)", + ) _query_publish_button_locator: Locator = (By.CSS_SELECTOR, ".btn-publish") @property @@ -25,7 +28,7 @@ class QueryDetailPage(Page): class QueryRow(Region): - _query_link_locator: Locator = (By.CSS_SELECTOR, "td a") + _query_link_locator: Locator = (By.CSS_SELECTOR, ".table-main-title a") @property def link(self) -> typing.Any: @@ -40,9 +43,13 @@ class QueryPage(Page): URL_TEMPLATE = "{server_url}/{queries}" - _query_table_locator: Locator = (By.TAG_NAME, "table") + _query_table_locator: Locator = (By.CSS_SELECTOR, ".table") _table_row_locator: Locator = (By.TAG_NAME, "tr") + def wait_for_page_to_load(self) -> typing.Any: + self.wait.until(lambda _: self.is_element_displayed(*self._query_table_locator)) + return self + @property def queries(self) -> typing.List[QueryRow]: table = self.selenium.find_element(*self._query_table_locator) diff --git a/tests/conftest.py b/tests/conftest.py index a75398d..ce9e35e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -133,7 +133,7 @@ def fixture_create_user( """ # look up user by email and return if found. If not, create user. response = root_session.get(f"{server_url}/api/users") - for user in response.json(): + for user in response.json()["results"]: if user["email"] == email: return user_factory.create_user( name=name, password=password, email=email, id=user["id"] diff --git a/tests/test_queries.py b/tests/test_queries.py index 1ba8935..62c3b68 100644 --- a/tests/test_queries.py +++ b/tests/test_queries.py @@ -14,7 +14,7 @@ from pages.login import LoginPage @pytest.mark.parametrize( "search_term, description", [ - ("Default Query", "Test query for redash UI tests."), + ("Default Query", "Test default query for redash UI tests."), ("Ashleys Query", "Query created by Ashley."), ], ) @@ -35,7 +35,7 @@ def test_query_by_username( @pytest.mark.parametrize( "search_term, description", [ - ("Default Query", "Test query for redash UI tests."), + ("Default Query", "Test default query for redash UI tests."), ("Ashleys Query", "Query created by Ashley."), ], ) diff --git a/variables.json b/variables.json index bf76705..34e89cd 100644 --- a/variables.json +++ b/variables.json @@ -13,7 +13,7 @@ }, "default": { "data_source_id": "1", - "description": "Test query for redash UI tests.", + "description": "Test default query for redash UI tests.", "name": "Default Query", "query": "this is a test query.", "schedule": 60