diff --git a/tests/jdi_uitests_webtests/main/enums/preconditions.py b/tests/jdi_uitests_webtests/main/enums/preconditions.py index 4e12f84..06c9b97 100644 --- a/tests/jdi_uitests_webtests/main/enums/preconditions.py +++ b/tests/jdi_uitests_webtests/main/enums/preconditions.py @@ -13,6 +13,7 @@ class Preconditions(str, Enum): SUPPORT_PAGE = ("/support.html",) DATES_PAGE = "/dates.html" SIMPLE_TABLE_PAGE = "/simple-table.html" + SEARCH_PAGE = "/search.html" def is_in_state(self): str_value = self.value[0] if isinstance(self.value, tuple) else self.value diff --git a/tests/jdi_uitests_webtests/main/page_objects/epam_jdi_site.py b/tests/jdi_uitests_webtests/main/page_objects/epam_jdi_site.py index 10eed84..425c418 100644 --- a/tests/jdi_uitests_webtests/main/page_objects/epam_jdi_site.py +++ b/tests/jdi_uitests_webtests/main/page_objects/epam_jdi_site.py @@ -10,6 +10,7 @@ MetalColorPage, SupportPage, ) +from tests.jdi_uitests_webtests.main.page_objects.pages.search_page import SearchPage from tests.jdi_uitests_webtests.main.page_objects.pages.simple_table_page import SimpleTablePage from tests.jdi_uitests_webtests.main.page_objects.sections.footer import Footer from tests.jdi_uitests_webtests.main.page_objects.sections.header import Header @@ -23,9 +24,11 @@ class EpamJDISite(WebSite): contact_form_page = ContactFormPage(url=Preconditions.CONTACT_PAGE.value, title="Contact Form") support_page = SupportPage(url=Preconditions.SUPPORT_PAGE.value, title="Support") - dates_page = DatesPage(url=Preconditions.DATES_PAGE.value, title="Simple Table") + dates_page = DatesPage(url=Preconditions.DATES_PAGE.value, title="Dates") simple_table_page = SimpleTablePage(url=Preconditions.SIMPLE_TABLE_PAGE.value, title="Simple Table") + search_page = SearchPage(url=Preconditions.SEARCH_PAGE.value, + title="Simple Table") # elements actions_log = TextList(By.css(".logs li")) diff --git a/tests/jdi_uitests_webtests/main/page_objects/pages/search_page.py b/tests/jdi_uitests_webtests/main/page_objects/pages/search_page.py new file mode 100644 index 0000000..bc930a8 --- /dev/null +++ b/tests/jdi_uitests_webtests/main/page_objects/pages/search_page.py @@ -0,0 +1,10 @@ +from JDI.web.selenium.elements.api_interact.find_element_by import By +from JDI.web.selenium.elements.complex.table.table import Table +from JDI.web.selenium.elements.composite.web_page import WebPage + + +class SearchPage(WebPage): + def __init__(self, url, title): + super(SearchPage, self).__init__(url=url, title=title) + + # TODO: Implement SearchPage diff --git a/tests/jdi_uitests_webtests/test/composite/page_test.py b/tests/jdi_uitests_webtests/test/composite/page_test.py index ac03829..5dfbd31 100644 --- a/tests/jdi_uitests_webtests/test/composite/page_test.py +++ b/tests/jdi_uitests_webtests/test/composite/page_test.py @@ -27,7 +27,7 @@ def setUp(self): def test_refresh(self): EpamJDISite.contact_form_page.contact_form.submit.click() - Assert.assert_equal(EpamJDISite.contact_form_page.result.get_text(), "Summary: 3") + Assert.assert_equal(EpamJDISite.contact_form_page.result.get_text(), "Summary: 3\nVegetables:") EpamJDISite.contact_form_page.refresh() Assert.assert_equal(EpamJDISite.contact_form_page.result.get_text(), "") EpamJDISite.contact_form_page.check_opened() diff --git a/tests/jdi_uitests_webtests/test/composite/pagination_test.py b/tests/jdi_uitests_webtests/test/composite/pagination_test.py index 3c09d96..e64fb37 100644 --- a/tests/jdi_uitests_webtests/test/composite/pagination_test.py +++ b/tests/jdi_uitests_webtests/test/composite/pagination_test.py @@ -7,8 +7,8 @@ from tests.jdi_uitests_webtests.test.init_tests import InitTests -def check_page_opened(num): - Assert.assert_true(JDISettings.get_driver_factory().get_driver().current_url.endswith("/page{0}.htm".format(num))) +def check_page_opened(verifier): + Assert.assert_true(JDISettings.get_driver_factory().get_driver().current_url.endswith(verifier)) @pytest.mark.web @@ -20,17 +20,19 @@ def setUp(self): Preconditions.SIMPLE_TABLE_PAGE.is_in_state() def test_next(self): + self.pagination.first() self.pagination.next() - check_page_opened(7) + check_page_opened("dates.html") def test_previous(self): + self.pagination.last() self.pagination.previous() - check_page_opened(5) + check_page_opened("table-pages.html") def test_first(self): self.pagination.first() - check_page_opened(1) + check_page_opened("support.html") def test_last(self): self.pagination.last() - check_page_opened(2) + check_page_opened("performance.html") diff --git a/tests/jdi_uitests_webtests/test/composite/search_test.py b/tests/jdi_uitests_webtests/test/composite/search_test.py index 1f976e9..ea7b485 100644 --- a/tests/jdi_uitests_webtests/test/composite/search_test.py +++ b/tests/jdi_uitests_webtests/test/composite/search_test.py @@ -13,4 +13,4 @@ def setUp(self): def test_fill(self): EpamJDISite.header.search_section.find("something") - EpamJDISite.support_page.check_opened() + EpamJDISite.search_page.check_opened()