From ba0060d4b064511efd50de398b63edf327429df7 Mon Sep 17 00:00:00 2001 From: Alena Krauch Date: Fri, 24 Jan 2025 00:56:20 +0300 Subject: [PATCH 1/2] ref test_erw_04.01 Verify images on the web page, update exercises_ru_words_page_test.py, exercises_ru_words_page.py, exercises_ru_words_page_data.py, base_page.py --- pages/base_page.py | 3 +++ pages/exercises_ru_words_page.py | 2 +- test_data/exercises_ru_words_page_data.py | 26 +++++++++++------------ tests/exercises_ru_words_page_test.py | 2 ++ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pages/base_page.py b/pages/base_page.py index 707874c0fa..0b87b8c625 100644 --- a/pages/base_page.py +++ b/pages/base_page.py @@ -89,6 +89,9 @@ def get_text(self, locator): def get_link_href(self, locator): return self.driver.find_element(*locator).get_attribute("href") + def get_link_style(self, locator): + return self.driver.find_element(*locator).get_attribute("style") + def get_link_title(self, locator): return self.driver.find_element(*locator).get_attribute("title") diff --git a/pages/exercises_ru_words_page.py b/pages/exercises_ru_words_page.py index ccb4997211..c4657b094e 100644 --- a/pages/exercises_ru_words_page.py +++ b/pages/exercises_ru_words_page.py @@ -269,5 +269,5 @@ def click_on_subgroup_link_beloved_home_food_clothes(self): @allure.step("Get the list of attribute 'style' values of images in links") def get_links_style(self): style = [image.get_attribute('style') for image in self.get_list4_of_links()] - print(len(style), *style, sep='\n') + # print(len(style), *style, sep='\n') return style diff --git a/test_data/exercises_ru_words_page_data.py b/test_data/exercises_ru_words_page_data.py index 5e4446be6c..5fd02b6568 100644 --- a/test_data/exercises_ru_words_page_data.py +++ b/test_data/exercises_ru_words_page_data.py @@ -114,19 +114,17 @@ class ExercisesRuWordsPageData: links_status_code = 200 + a = 'background-image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme' subgroup_links_style = [ - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/family.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/home.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/food.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/clothes.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/school.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/math.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/pets.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/animals.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/transport.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/colors.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/city.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/country.svg"");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/walk.svg");', - 'background - image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/weather.svg");' + f'{a}/family.svg");', f'{a}/home.svg");', f'{a}/food.svg");', f'{a}/clothes.svg");', f'{a}/school.svg");', + f'{a}/math.svg");', f'{a}/pets.svg");', f'{a}/animals.svg");', f'{a}/transport.svg");', f'{a}/colors.svg");', + f'{a}/city.svg");', f'{a}/country.svg");', f'{a}/walk.svg");', f'{a}/weather.svg");', f'{a}/future.svg");', + f'{a}/body.svg");', f'{a}/game.svg");', f'{a}/adventure.svg");', f'{a}/hospital.svg");', f'{a}/feelings.svg");', + f'{a}/toys.svg");', f'{a}/insects.svg");', f'{a}/interior.svg");', f'{a}/kitchen.svg");', f'{a}/music.svg");', + f'{a}/musical_instruments.svg");', f'{a}/birds.svg");', f'{a}/jewelry.svg");', f'{a}/history.svg");', + f'{a}/actions.svg");', f'{a}/audible_actions.svg");', f'{a}/more_transport.svg");', + f'{a}/special_transport.svg");', f'{a}/fruit_trees.svg");', f'{a}/plants.svg");', f'{a}/trees.svg");', + f'{a}/sport.svg");', f'{a}/shop.svg");', f'{a}/artiodactyls.svg");', f'{a}/dogs.svg");', + f'{a}/stationery.svg");', f'{a}/flowers.svg");', f'{a}/literature.svg");', f'{a}/physics.svg");', + f'{a}/biology.svg");', f'{a}/instruments.svg");' ] diff --git a/tests/exercises_ru_words_page_test.py b/tests/exercises_ru_words_page_test.py index 042032bd09..c970a82b7e 100644 --- a/tests/exercises_ru_words_page_test.py +++ b/tests/exercises_ru_words_page_test.py @@ -177,3 +177,5 @@ def test_erw_04_01_verify_images_attributes(self, driver, exercises_ru_words_pag page = ExercisesRuWordsPage(driver) links_style = page.get_links_style() assert links_style, "The 'style' attribute value of links is empty" + assert all(element in ExRuWoPaData.subgroup_links_style for element in links_style), \ + "The 'style' attribute value of links do not match the valid values" From 4d6802a6655de948f38925da19a3184126b21743 Mon Sep 17 00:00:00 2001 From: Alena Krauch Date: Fri, 24 Jan 2025 23:54:26 +0300 Subject: [PATCH 2/2] ref test_erw_04.01 Verify images on the web page, update exercises_ru_words_page_data.py --- test_data/exercises_ru_words_page_data.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test_data/exercises_ru_words_page_data.py b/test_data/exercises_ru_words_page_data.py index 5fd02b6568..bb935d9165 100644 --- a/test_data/exercises_ru_words_page_data.py +++ b/test_data/exercises_ru_words_page_data.py @@ -114,17 +114,16 @@ class ExercisesRuWordsPageData: links_status_code = 200 - a = 'background-image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme' + s = 'background-image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/' + e = '.svg");' subgroup_links_style = [ - f'{a}/family.svg");', f'{a}/home.svg");', f'{a}/food.svg");', f'{a}/clothes.svg");', f'{a}/school.svg");', - f'{a}/math.svg");', f'{a}/pets.svg");', f'{a}/animals.svg");', f'{a}/transport.svg");', f'{a}/colors.svg");', - f'{a}/city.svg");', f'{a}/country.svg");', f'{a}/walk.svg");', f'{a}/weather.svg");', f'{a}/future.svg");', - f'{a}/body.svg");', f'{a}/game.svg");', f'{a}/adventure.svg");', f'{a}/hospital.svg");', f'{a}/feelings.svg");', - f'{a}/toys.svg");', f'{a}/insects.svg");', f'{a}/interior.svg");', f'{a}/kitchen.svg");', f'{a}/music.svg");', - f'{a}/musical_instruments.svg");', f'{a}/birds.svg");', f'{a}/jewelry.svg");', f'{a}/history.svg");', - f'{a}/actions.svg");', f'{a}/audible_actions.svg");', f'{a}/more_transport.svg");', - f'{a}/special_transport.svg");', f'{a}/fruit_trees.svg");', f'{a}/plants.svg");', f'{a}/trees.svg");', - f'{a}/sport.svg");', f'{a}/shop.svg");', f'{a}/artiodactyls.svg");', f'{a}/dogs.svg");', - f'{a}/stationery.svg");', f'{a}/flowers.svg");', f'{a}/literature.svg");', f'{a}/physics.svg");', - f'{a}/biology.svg");', f'{a}/instruments.svg");' + f'{s}family{e}', f'{s}home{e}', f'{s}food{e}', f'{s}clothes{e}', f'{s}school{e}', f'{s}math{e}', f'{s}pets{e}', + f'{s}animals{e}', f'{s}transport{e}', f'{s}colors{e}', f'{s}city{e}', f'{s}country{e}', f'{s}walk{e}', + f'{s}weather{e}', f'{s}future{e}', f'{s}body{e}', f'{s}game{e}', f'{s}adventure{e}', f'{s}hospital{e}', + f'{s}feelings{e}', f'{s}toys{e}', f'{s}insects{e}', f'{s}interior{e}', f'{s}kitchen{e}', f'{s}music{e}', + f'{s}musical_instruments{e}', f'{s}birds{e}', f'{s}jewelry{e}', f'{s}history{e}', f'{s}actions{e}', + f'{s}audible_actions{e}', f'{s}more_transport{e}', f'{s}special_transport{e}', f'{s}fruit_trees{e}', + f'{s}plants{e}', f'{s}trees{e}', f'{s}sport{e}', f'{s}shop{e}', f'{s}artiodactyls{e}', f'{s}dogs{e}', + f'{s}stationery{e}', f'{s}flowers{e}', f'{s}literature{e}', f'{s}physics{e}', f'{s}biology{e}', + f'{s}instruments{e}' ]