Skip to content

Commit b896e7d

Browse files
committed
Add 118805, 118800 tests
1 parent 48e1f12 commit b896e7d

6 files changed

+97
-93
lines changed

modules/browser_object_panel_ui.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ def get_all_history(self) -> List[WebElement]:
192192
history_items = self.get_elements("bookmark-item")
193193
return history_items
194194

195+
@BasePage.context_chrome
196+
def verify_most_recent_history_item(self, expected_value: str) -> BasePage:
197+
"""
198+
Verify that the specified value is the most recent item in the history menu.
199+
Argument:
200+
Expected_value (str): The expected value of the most recent history entry
201+
"""
202+
203+
recent_history_items = self.get_elements("recent-history-content")
204+
actual_value = recent_history_items[0].get_attribute("value")
205+
assert actual_value == expected_value
206+
207+
return self
208+
195209
@BasePage.context_chrome
196210
def get_random_history_entry(self) -> Optional[Tuple[str, str]]:
197211
"""
@@ -217,13 +231,9 @@ def get_random_history_entry(self) -> Optional[Tuple[str, str]]:
217231

218232
def _extract_url_from_history(self, raw_url: str) -> str:
219233
"""
220-
Extract a valid HTTP(S) URL from a raw history image attribute.
221-
222-
Firefox stores history URLs using special schemes like:
223-
'moz-anno:favicon:https://example.com'
224-
This method locates the first occurrence of "http" and returns the substring from there.
225-
226-
Args:
234+
Extract a valid HTTP(S) URL from a raw history image attribute. This method locates the first occurrence of
235+
"http" and returns the substring from there.
236+
Argument:
227237
raw_url (str): The raw string value from the 'image' attribute of a history entry.
228238
"""
229239
if not raw_url:

tests/bookmarks_and_history/test_opened_website_in_new_tab_present_in_toolbar_history.py renamed to tests/bookmarks_and_history/test_opened_website_in_new_tab_present_in_hamburger_history_menu.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object import PanelUi, TabBar
5-
from modules.page_object_generics import GenericPage
5+
from modules.page_object import GenericPage
66

77

88
@pytest.fixture()
@@ -15,7 +15,7 @@ def use_profile():
1515
return "theme_change"
1616

1717

18-
ETSY_URL = "https://www.etsy.com/"
18+
WIKIPEDIA_URL = "https://www.wikipedia.org/"
1919

2020

2121
def test_the_website_opened_in_new_tab_is_present_in_history_menu(driver: Firefox):
@@ -25,14 +25,14 @@ def test_the_website_opened_in_new_tab_is_present_in_history_menu(driver: Firefo
2525
"""
2626
# Instantiate objects
2727
tabs = TabBar(driver)
28-
page = GenericPage(driver, url=ETSY_URL)
28+
page = GenericPage(driver, url=WIKIPEDIA_URL)
2929
panel = PanelUi(driver)
3030

31-
# Open a new tab, switch to it and verify is the url contains the desired domain
31+
# Open a new tab, switch to it and verify is the url contains the desired page name
3232
tabs.open_web_page_in_new_tab(page, 2)
33-
page.url_contains("etsy")
33+
page.url_contains("wikipedia")
3434

35-
# Verify Etsy is present in the Hamburger Menu, History section and is on top of the list as the most recent
35+
# Verify Wikipedia is present in the Hamburger Menu, History section and is on top of the list as the most recent
3636
# website visited
3737
panel.open_history_menu()
38-
panel.expect_element_attribute_contains("recent-history-content", "value", "Etsy")
38+
panel.verify_most_recent_history_item("Wikipedia")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_panel_ui import PanelUi
5+
from modules.page_object import GenericPage
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "118805"
11+
12+
13+
@pytest.fixture()
14+
def use_profile():
15+
return "theme_change"
16+
17+
18+
WIKIPEDIA_URL = "https://www.wikipedia.org/"
19+
20+
21+
def test_the_website_opened_in_new_window_is_present_in_history_menu(driver: Firefox):
22+
"""
23+
C118805 - Verify that the website opened in new window is displayed in Hamburger Menu, History section, on top of the
24+
list
25+
"""
26+
27+
# Instantiate objects
28+
page = GenericPage(driver, url=WIKIPEDIA_URL)
29+
panel = PanelUi(driver)
30+
31+
# Open a new window, switch to it and verify is the url contains the desired page name
32+
panel.open_and_switch_to_new_window("window")
33+
page.open()
34+
page.url_contains("wikipedia")
35+
36+
# Verify Wikipedia is present in the history menu and is on top of the list as the most recent website visited
37+
panel.open_history_menu()
38+
panel.verify_most_recent_history_item("Wikipedia")

tests/bookmarks_and_history/test_opened_website_in_new_window_present_in_toolbar_history.py

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_panel_ui import PanelUi
5+
from modules.page_object import GenericPage
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "118800"
11+
12+
13+
@pytest.fixture()
14+
def use_profile():
15+
return "theme_change"
16+
17+
18+
WIKIPEDIA_URL = "https://www.wikipedia.org/"
19+
20+
21+
def test_the_most_recent_website_is_present_in_history_menu(driver: Firefox):
22+
"""
23+
C118800 - Verify that the most recently opened website is displayed in Hamburger Menu, History section, on top of the
24+
list
25+
"""
26+
# Instantiate objects
27+
page = GenericPage(driver, url=WIKIPEDIA_URL)
28+
panel = PanelUi(driver)
29+
30+
# Open the desired webpage
31+
page.open()
32+
33+
# Verify Wikipedia is present in the history menu and is on top of the list as the most recent website visited
34+
panel.open_history_menu()
35+
panel.verify_most_recent_history_item("Wikipedia")

tests/bookmarks_and_history/test_opened_website_present_in_toolbar_history.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)