Skip to content

Commit

Permalink
Merge branch 'UI_test_scripts_group_display' into e2e_tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/e2e_tests/conftest.py
  • Loading branch information
AnnaShepa committed Apr 25, 2021
2 parents 7d23e5c + 53c0cb7 commit bea773e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/e2e_tests/common/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ def get_script_link_by_name(self, name):
except (NoSuchElementException, ElementNotInteractableException):
return None

def get_scripts_group_by_name(self, name):
try:
return self.browser.find_element_by_xpath("//span[contains(text(), '{}')]/parent::a[contains(@class,'collection-item')][contains(@class,'script-group')]".format(name))
except (NoSuchElementException, ElementNotInteractableException):
return None

def get_scripts_inside_group(self, group_link):
try:
return get_parent_element(group_link).find_elements_by_css_selector("a")
except (NoSuchElementException, ElementNotInteractableException):
return None

def get_random_script_link(self):
return random.choice(self.all_script_links)

Expand Down
3 changes: 1 addition & 2 deletions src/e2e_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
SUPPORTED_BROWSERS = ['chrome', 'firefox', 'ie']
DEFAULT_HEADLESS_MODE = True
DEFAULT_SCREENSHOTS_NEEDED = False
DEFAULT_SCRIPTS = ["Bash formatting", "colortest", "destroy_world", "Download kittens", "Multiple words",
"Very parameterized", "Write to file (WIN)", "Ploty HTML output", "Simple HTML output"]
DEFAULT_SCRIPTS = ["Bash formatting", "colortest", "destroy_world", "Download kittens", "Multiple words", "Very parameterized", "Write to file (WIN)", "HTML"]


with open(CONFIG_PATH) as config_file:
Expand Down
46 changes: 46 additions & 0 deletions src/e2e_tests/sample_scripts/test_html_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from common.pages import Page
import allure
from common.pages import is_displayed
from delayed_assert import expect, assert_expectations
from allure import severity, severity_level


subscripts_list = ["Ploty HTML output", "Simple HTML output"]

@severity(severity_level.NORMAL)
@allure.title("Check presented scripts group 'HTML'")
def test_presented_group_link(browser, config_host):
home_page = Page(browser, config_host)
home_page.load()

group_link = home_page.get_scripts_group_by_name("HTML")
expect(is_displayed(group_link), "Group 'HTML' link not displayed")
expect(is_displayed(home_page.find_element("i.material-icons", group_link)), "Icon 'Show more' not displayed")

assert_expectations()


@severity(severity_level.NORMAL)
@allure.title("Check subscripts are hide by default")
def test_subscripts_are_hide_by_default(browser, config_host):
home_page = Page(browser, config_host)
home_page.load()

for subscript in subscripts_list:
expect(not is_displayed(home_page.get_script_link_by_name(subscript)), "Subscript {} is displayed by default".format(subscript))

assert_expectations()


@severity(severity_level.NORMAL)
@allure.title("Check subscripts are shown after click")
def test_subscripts_are_shown_on_click(browser, config_host):
home_page = Page(browser, config_host)
home_page.load()

home_page.get_scripts_group_by_name("HTML").click()

for subscript in subscripts_list:
expect(is_displayed(home_page.get_script_link_by_name(subscript)), "Subscript {} is not displayed after group name click".format(subscript))

assert_expectations()
2 changes: 1 addition & 1 deletion src/e2e_tests/sample_scripts/test_presented_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def test_presented_scripts_by_name(browser, config_host, scripts):
def test_presented_scripts_amount(browser, config_host, scripts):
home_page = Page(browser, config_host)

assert len(scripts) == len(home_page.all_script_links)
assert len(scripts) == len(home_page.all_script_links)

0 comments on commit bea773e

Please sign in to comment.