Update the tests

This commit is contained in:
Michael Mintz 2022-11-17 13:50:43 -05:00
parent ad7569ba3b
commit b621669f5f
3 changed files with 15 additions and 10 deletions

View File

@ -92,8 +92,7 @@ class HackTests(BaseCase):
self.highlight('form[role="search"]', loops=8)
self.open("https://github.com/features/actions")
self.set_text_content('a[href="/team"]', ayb)
self.set_text_content('a[href="/enterprise"]', abtu)
self.set_text_content('a[href="/pricing"]', aybabtu)
self.set_text_content("h1 span:nth-child(1)", ayb)
self.set_text_content("h1 span:nth-of-type(2)", "ARE")
self.set_text_content("h1 span:nth-of-type(3)", "BELONG")
@ -101,7 +100,7 @@ class HackTests(BaseCase):
self.set_text_content("h1 span:nth-of-type(5)", "US")
self.type('input[name="q"]', aybabtu.lower())
self.click("h1", scroll=False)
self.highlight("nav", loops=5, scroll=False)
self.highlight('a[href="/pricing"]', loops=5, scroll=False)
self.highlight('input[name="q"]', loops=5, scroll=False)
self.highlight("h1", loops=8, scroll=False)

View File

@ -5,6 +5,5 @@ class AngularMaterialInputTests(BaseCase):
def test_invalid_input(self):
# Test that there's an error for an invalid input
self.open("https://material.angular.io/components/input/examples")
self.assert_element(".mat-button-wrapper > .mat-icon")
self.type("#mat-input-1", "invalid")
self.assert_element("mat-error")

View File

@ -5,14 +5,21 @@ from seleniumbase import BaseCase
class AngularMaterialPaginatorTests(BaseCase):
def test_pagination(self):
self.open("https://material.angular.io/components/paginator/examples")
self.assert_element(".mat-button-wrapper > .mat-icon")
# Set pagination to 5 items per page
self.click("mat-select > div")
self.click("#mat-option-0")
# Verify navigation to the next page
self.click('button[aria-label="Next page"]')
self.assert_exact_text("Page 2 of 10", ".mat-paginator-range-label")
self.assert_exact_text(
"Page 2 of 10", ".mat-mdc-paginator-range-label"
)
# Verify navigation to the previous page
self.click('button[aria-label="Previous page"]')
self.assert_exact_text("Page 1 of 10", ".mat-paginator-range-label")
# Verify changed list length to 5 items per page
self.assert_exact_text(
"Page 1 of 10", ".mat-mdc-paginator-range-label"
)
# Set pagination to 10 items per page
self.click("mat-select > div")
self.click("mat-option > .mat-option-text")
self.assert_exact_text("Page 1 of 20", ".mat-paginator-range-label")
self.click("#mat-option-1")
# Verify page with correct number of pages
self.assert_exact_text("Page 1 of 5", ".mat-mdc-paginator-range-label")