Skip to content

Commit

Permalink
NO-OPIK fix locator for next page buttons (#1085)
Browse files Browse the repository at this point in the history
* fix locator for next page buttons

* linter fixes

---------

Co-authored-by: Andrei Căutișanu <andreicautisanu@Andreis-MacBook-Pro.local>
  • Loading branch information
AndreiCautisanu and Andrei Căutișanu authored Jan 21, 2025
1 parent e31b125 commit 7c5b9c0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
10 changes: 7 additions & 3 deletions tests_end_to_end/page_objects/DatasetItemsPage.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from playwright.sync_api import Page
import re


class DatasetItemsPage:
def __init__(self, page: Page):
self.page = page
self.next_page_button_locator = self.page.locator(
"div:has(> button:nth-of-type(4))"
).locator("button:nth-of-type(3)")
self.next_page_button_locator = (
self.page.locator("div")
.filter(has_text=re.compile(r"^Showing (\d+)-(\d+) of (\d+)"))
.nth(2)
.locator("button:nth-of-type(3)")
)

def remove_default_columns(self):
self.page.get_by_role("button", name="Columns").click()
Expand Down
9 changes: 6 additions & 3 deletions tests_end_to_end/page_objects/ExperimentItemsPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
class ExperimentItemsPage:
def __init__(self, page: Page):
self.page = page
self.next_page_button_locator = self.page.locator(
"div:has(> button:nth-of-type(4))"
).locator("button:nth-of-type(3)")
self.next_page_button_locator = (
self.page.locator("div")
.filter(has_text=re.compile(r"^Showing (\d+)-(\d+) of (\d+)"))
.nth(2)
.locator("button:nth-of-type(3)")
)

def get_pagination_button(self) -> Locator:
return self.page.get_by_role("button", name="Showing")
Expand Down
2 changes: 1 addition & 1 deletion tests_end_to_end/page_objects/FeedbackDefinitionsPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def fill_categorical_values(self, categories):
category1_name.click()
category1_name.fill("a")
category1_val.click()
category1_val.fill("1")
category1_val.fill("2")

category2_name.click()
category2_name.fill("b")
Expand Down
10 changes: 7 additions & 3 deletions tests_end_to_end/page_objects/PromptPage.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from playwright.sync_api import Page, expect, Locator
import re


class PromptPage:
def __init__(self, page: Page):
self.page = page
self.next_page_button_locator = self.page.locator(
"div:has(> button:nth-of-type(4))"
).locator("button:nth-of-type(3)")
self.next_page_button_locator = (
self.page.locator("div")
.filter(has_text=re.compile(r"^Showing (\d+)-(\d+) of (\d+)"))
.nth(2)
.locator("button:nth-of-type(3)")
)

def edit_prompt(self, new_prompt: str):
self.page.get_by_role("button", name="Edit prompt").click()
Expand Down
9 changes: 6 additions & 3 deletions tests_end_to_end/page_objects/TracesPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ def __init__(self, page: Page):
self.traces_table = self.page.get_by_role("table")
self.trace_names_selector = "tr td:nth-child(3) div span"
self.trace_id_selector = "tr:nth-child({}) > td:nth-child(2) > div".format
self.next_page_button_locator = self.page.locator(
"div:has(> button:nth-of-type(4))"
).locator("button:nth-of-type(3)")
self.next_page_button_locator = (
self.page.locator("div")
.filter(has_text=re.compile(r"^Showing (\d+)-(\d+) of (\d+)"))
.nth(2)
.locator("button:nth-of-type(3)")
)
self.delete_button_locator = (
self.page.locator("div")
.filter(has_text=re.compile(r"^Add to dataset$"))
Expand Down

0 comments on commit 7c5b9c0

Please sign in to comment.