Skip to content

Commit

Permalink
UI locator fixes for 0.11.7 MAS build
Browse files Browse the repository at this point in the history
  • Loading branch information
dhlavac committed Aug 14, 2023
1 parent 84501ee commit 4fbb3ac
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_no_sca_ui_invoice(braintree, ui_invoice):
invoice_view = ui_invoice()
invoice_view.charge()
braintree.assert_payment(invoice_view.invoice.read())
assert invoice_view.state_field.text == "Paid"
assert invoice_view.state_field.text == "State Paid"


def test_api(braintree, invoice):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/ui/billing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _ui_invoice():
invoice_view = navigator.navigate(InvoiceDetailView, account=account, invoice=invoice[0])
invoice_view.add_items(line_items)
invoice_view.issue()
invoice_view.assert_issued()
assert invoice_view.charge_button.wait_displayed(), "Issuing the invoice through UI failed"
return invoice_view

return _ui_invoice
Expand Down
10 changes: 2 additions & 8 deletions testsuite/ui/views/admin/audience/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class AccountInvoicesView(BaseAudienceView):

path_pattern = "/buyers/accounts/{account_id}/invoices"
create_button = Text(".action.new")
table = PatternflyTable(".data")
table = PatternflyTable("//table[@aria-label='Invoices table']")

def __init__(self, parent, account):
super().__init__(parent, account_id=account.entity_id)
Expand Down Expand Up @@ -315,7 +315,7 @@ class InvoiceDetailView(BaseAudienceView):
notification = View.nested(FlashMessage)

# Selector which we can use to check if the charge has finished
paid_field = Text("//td[@id='field-state' and text()='Paid']")
paid_field = Text("//div[text()='Paid']")
add_item_btn = GenericLocatorWidget("//a[contains(@class,'action add')]")
line_item_form = View.nested(LineItemForm)

Expand Down Expand Up @@ -344,12 +344,6 @@ def charge(self):
# Wait until charge is done
self.browser.wait_for_element(self.paid_field, timeout=5)

def assert_issued(self):
"""Assert that invoice was correctly issued"""
assert self.notification.is_displayed, "No notification was displayed after issuing an invoice."
assert self.notification.string_in_flash_message("invoice issued."), "Issuing the invoice through UI failed"
assert self.charge_button.wait_displayed, "Issuing the invoice through UI failed"

def prerequisite(self):
return AccountInvoicesView

Expand Down
4 changes: 2 additions & 2 deletions testsuite/ui/views/admin/audience/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ApplicationsView(BaseAudienceView):
"""View representation of Application Listing page"""

path_pattern = "/p/admin/applications"
table = PatternflyTable("//*[@class='data']")
table = PatternflyTable("//table[@aria-label='Applications table']", column_widgets={"Name": Text("./a")})
all_app_checkbox = ThreescaleCheckBox(locator="//input[@class='select-all']")
send_email_btn = GenericLocatorWidget(".//button[text()='Send email']")
email_window = View.nested(ApplicationsBulkEmailWindow)
Expand All @@ -66,7 +66,7 @@ def send_email_to_all_apps(self, subject=None, body=None):
@step("ApplicationDetailView")
def detail(self, application):
"""Opens detail app by ID"""
self.table.row(_row__attr=("id", f"contract_{application.entity_id}")).name.click()
self.table.row(_row__attr=("id", f"contract_{application.entity_id}")).name.widget.click()

def prerequisite(self):
return BaseAudienceView
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/audience/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BillingView(BaseAudienceView):
"""View representation of Earnings by Month page"""

path_pattern = "/finance"
table = PatternflyTable("//*[@class='data']")
table = PatternflyTable("//table[@aria-label='Earnings by month table']")

def prerequisite(self):
return BaseAudienceView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ class DeveloperPortalGroupView(BaseAudienceView):

path_pattern = "/p/admin/cms/groups"
table = PatternflyTable(
".//table[@class='data']", column_widgets={3: GenericLocatorWidget("./a[contains(@class, 'delete')]")}
"//table[@aria-label='Groups table']",
column_widgets={3: GenericLocatorWidget("./a[contains(@class, 'delete')]")},
)
create_button = GenericLocatorWidget(".//*[@href='/p/admin/cms/groups/new']")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ class SSOIntegrationsView(BaseAudienceView):
"""View representation of SSO Integrations page for developer portal"""

path_pattern = "/p/admin/authentication_providers"
table = PatternflyTable("//table[@class='data']")
table = PatternflyTable(
"//table[@aria-label='Authentication providers table']", column_widgets={"Integration": Text("./a")}
)

@step("Auth0IntegrationDetailView")
def auth0(self):
"""Open Auth0 integration"""
self.table.row(integration__contains="Auth0").integration.click()
self.table.row(integration__contains="Auth0").integration.widget.click()

@step("RHSSOIntegrationDetailView")
def rhsso(self):
"""Open RHSSO integration"""
self.table.row(integration__contains="Red Hat Single Sign-On").integration.click()
self.table.row(integration__contains="Red Hat Single Sign-On").integration.widget.click()

def prerequisite(self):
return BaseAudienceView
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/audience/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MessagesView(BaseAudienceView):
"""View representation of accounts messages inbox page"""

path_pattern = "/p/admin/messages"
table = PatternflyTable("//*[@class='data']")
table = PatternflyTable("//table[@aria-label='Messages table']")
compose_msg_link = GenericLocatorWidget("//*[contains(@href,'/p/admin/messages/outbox/new')]")

def prerequisite(self):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/backend/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def select_metric(self, value):

def read_metric(self):
"""Read specific metric and parse it to integer"""
return int(self.traffic_dropdown.text().split(".")[0])
return int(self.traffic_dropdown.text().split(" ")[0])

def prerequisite(self):
return BaseBackendView
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/product/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def select_metric(self, value):

def read_metric(self):
"""Read specific metric and parse it to integer"""
return int(self.traffic_dropdown.text().split(".")[0])
return int(self.traffic_dropdown.text().split(" ")[0])

def prerequisite(self):
return BaseProductView
Expand Down
5 changes: 3 additions & 2 deletions testsuite/ui/views/admin/product/integration/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class ProductBackendsView(BaseProductView):
path_pattern = "/apiconfig/services/{product_id}/backend_usages"
add_backend_button = Text("//*[contains(@href,'/backend_usages/new')]")
backend_table = PatternflyTable(
"//*[@id='backend_api_configs']", column_widgets={3: GenericLocatorWidget("./a[contains(@class, 'delete')]")}
"//table[@aria-label='Backends table']",
column_widgets={3: GenericLocatorWidget("//div/a[contains(@class, 'delete')]")},
)

@step("ProductAddBackendView")
Expand All @@ -24,7 +25,7 @@ def add_backend(self):

def remove_backend(self, backend):
"""Remove backend"""
next(row for row in self.backend_table.rows() if row[0].text == backend["name"])[3].widget.click(True)
self.backend_table.row(name__contains=backend["name"])[3].widget.click(True)

def prerequisite(self):
return BaseProductView
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/settings/sso_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SSOIntegrationsView(BaseSettingsView):

path_pattern = "/p/admin/account/authentication_providers"
new_integration = Text("//a[@href='/p/admin/account/authentication_providers/new']")
table = PatternflyTable("//table[@class='data']")
table = PatternflyTable("//table[@aria-label='Authentication providers table']")

@step("NewSSOIntegrationView")
def new(self):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/ui/views/admin/settings/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TokenNewView(BaseSettingsView):
scopes = CheckBoxGroup("//*[@id='access_token_scopes_input']")
permissions = ThreescaleDropdown("//*[@id='access_token_permission']")
create_button = ThreescaleSubmitButton()
token_value = Text(".//code[contains(@class,'AccessTokenBox-token')]")
token_value = Text(".//div/dt/span[text()='Token']/ancestor::dt/following-sibling::dd")

def create(self, name: str, scopes: List[Scopes], write: bool):
"""Create Token"""
Expand Down

0 comments on commit 4fbb3ac

Please sign in to comment.