Skip to content

Commit 8d32686

Browse files
authored
Merge pull request #3 from andr0306/develop
new params test and some fixes
2 parents 0debfe3 + 3f7a11a commit 8d32686

File tree

12 files changed

+32
-21
lines changed

12 files changed

+32
-21
lines changed

elements/dropdown_element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import allure
22

33
from elements.base_element import BaseElement
4-
from utils.Locators import GeneralLocators
4+
from utils.locators import GeneralLocators
55

66
class DropdownElement(BaseElement):
77
def __init__(self, page, locator, name):

pages/exercises_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from elements.base_element import BaseElement
22
from pages.base_page import BasePage
3-
from utils.Locators import ExercisesPageLocators
3+
from utils.locators import ExercisesPageLocators
44

55
class ExercisePage(BasePage):
66
def __init__(self, page):

pages/home_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from elements.input_element import InputElement
66
from pages.base_page import BasePage
77
from elements.base_element import BaseElement
8-
from utils.Locators import HomePageLocators
8+
from utils.locators import HomePageLocators
99

1010
class HomePage(BasePage):
1111
def __init__(self, page):

pages/navigation_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from elements.base_element import BaseElement
44
from pages.base_page import BasePage
5-
from utils.Locators import NavigationLocators
5+
from utils.locators import NavigationLocators
66

77

88
class NavigationPage(BasePage):

pages/tutorial_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from elements.button_element import ButtonElement
77
from pages.base_page import BasePage
88
from elements.base_element import BaseElement
9-
from utils.Locators import TutorialPageLocators
9+
from utils.locators import TutorialPageLocators
1010

1111
class TutorialPage(BasePage):
1212
def __init__(self, page):

tests/test_home.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import random
2-
31
import allure
4-
from utils.Assertions import Assertions
5-
import utils.Constants as Constants
6-
from utils.Random import Random
2+
import pytest
3+
4+
from utils.assertions import Assertions
5+
import utils.constants as Constants
6+
from utils.random import Random
7+
from utils.data_generators import HomeTestsDataGenerator
78

89
@allure.title("Home page transitions")
910
def test_home_check_transitions(home_page, tutorial_page):
@@ -24,18 +25,17 @@ def test_home_check_sections(home_page):
2425
Assertions.assert_all_elements_are_visible(block_elements)
2526

2627
@allure.title("Home page verify search tutorial input")
27-
def test_home_verify_search(home_page, tutorial_page):
28-
tutorial_to_search = Constants.Tutorials.PYTHON
29-
tutorial_to_select = Constants.Titles.JAVA_TUTORIAL
28+
@pytest.mark.parametrize("text_to_search, text_to_select, title_text", list(HomeTestsDataGenerator.verify_search_generator()))
29+
def test_home_verify_search(home_page, tutorial_page, text_to_search, text_to_select, title_text):
3030
invalid_tutorial_to_search = Random.get_random_letter_string(10)
31-
options_found = home_page.enter_tutorial_and_get_all_options(tutorial_to_search)
32-
Assertions.assert_text_contain_all_values(tutorial_to_search, options_found)
31+
options_found = home_page.enter_tutorial_and_get_all_options(text_to_search)
32+
Assertions.assert_text_contain_all_values_ignoring_case(text_to_search, options_found)
3333
options_found = home_page.enter_tutorial_and_get_all_options(invalid_tutorial_to_search)
3434
Assertions.assert_count(options_found, 1)
3535
Assertions.assert_is_visible(home_page.no_tutorials_found)
36-
home_page.enter_tutorial_and_select_option(tutorial_to_select)
36+
home_page.enter_tutorial_and_select_option(text_to_select)
3737
Assertions.assert_is_visible(tutorial_page.tutorial_title)
38-
Assertions.assert_text_equals_ignoring_case(tutorial_page.tutorial_title, Constants.Titles.JAVA_TUTORIAL)
38+
Assertions.assert_text_equals_ignoring_case(tutorial_page.tutorial_title, title_text)
3939

4040

4141

tests/test_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import allure
22

3-
from utils import Constants
4-
from utils.Assertions import Assertions
3+
from utils import constants
4+
from utils.assertions import Assertions
55

66
@allure.description("Check tutorial titles changing")
77
def test_tutorial_verify_titles(home_page, tutorial_page):
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ def assert_text_contain_all_values(text: str, texts_list: list[str]):
5454
for t in texts_list:
5555
assert text in t
5656

57+
@staticmethod
58+
@allure.step("Check text contains all values from list ignoring case")
59+
def assert_text_contain_all_values_ignoring_case(text: str, texts_list: list[str]):
60+
for t in texts_list:
61+
assert text.lower() in t.lower()
62+
5763
@staticmethod
5864
@allure.step("Check element count")
5965
def assert_count(elements, count: int):
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import allure
2-
31
class Titles:
42
HTML_TUTORIAL = "HTML Tutorial"
53
JAVA_TUTORIAL = "JAVA Tutorial"

utils/data_generators.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
class HomeTestsDataGenerator:
3+
@staticmethod
4+
def verify_search_generator():
5+
yield "Java", "Java Array Tutorial", "Java Arrays"
6+
yield "Java", "JavaScript Array Tutorial", "JavaScript Arrays"
7+
yield "Python", "Python Arrays", "Python Arrays"

0 commit comments

Comments
 (0)