Skip to content

Commit

Permalink
fixing tests on new site
Browse files Browse the repository at this point in the history
  • Loading branch information
vklonin committed Mar 13, 2024
1 parent cb77e07 commit 92bb95c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/jdi_uitests_webtests/main/enums/preconditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down
10 changes: 10 additions & 0 deletions tests/jdi_uitests_webtests/main/page_objects/pages/search_page.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/jdi_uitests_webtests/test/composite/page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions tests/jdi_uitests_webtests/test/composite/pagination_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
2 changes: 1 addition & 1 deletion tests/jdi_uitests_webtests/test/composite/search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 92bb95c

Please sign in to comment.