Skip to content

Commit 662d5b3

Browse files
authored
Merge pull request #594 from mozilla/as/fix-add-new-other-bookmark-from-context-menu
Anca/ Test stabilization - Fix Win failures for Other Bookmarks
2 parents e13cf3e + a092471 commit 662d5b3

File tree

3 files changed

+32
-35
lines changed

3 files changed

+32
-35
lines changed

modules/browser_object_navigation.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,26 +344,24 @@ def bookmark_page_other(self) -> BasePage:
344344
return self
345345

346346
@BasePage.context_chrome
347-
def add_bookmark_advanced(
347+
def add_bookmark_via_other_bookmark_context_menu(
348348
self, bookmark_data: Bookmark, ba: BrowserActions
349349
) -> BasePage:
350350
iframe = self.get_element("bookmark-iframe")
351351
ba.switch_to_iframe_context(iframe)
352352
# fill name
353-
if bookmark_data.name is not None:
354-
self.actions.send_keys(bookmark_data.name).perform()
353+
self.actions.send_keys(bookmark_data.name).perform()
355354
self.actions.send_keys(Keys.TAB).perform()
356355
# fill url
357356
self.actions.send_keys(bookmark_data.url + Keys.TAB).perform()
358357
# fill tags
359-
if bookmark_data.tags is not None:
360-
self.actions.send_keys(bookmark_data.tags).perform()
358+
self.actions.send_keys(bookmark_data.tags).perform()
359+
self.actions.send_keys(Keys.TAB).perform()
361360
self.actions.send_keys(Keys.TAB).perform()
362361
# fill keywords
363-
if bookmark_data.keyword is not None:
364-
self.actions.send_keys(bookmark_data.keyword).perform()
365-
self.actions.send_keys(Keys.TAB, Keys.TAB, Keys.TAB, Keys.ENTER).perform()
366-
ba.switch_to_content_context()
362+
self.actions.send_keys(bookmark_data.keyword).perform()
363+
# save the bookmark
364+
self.actions.send_keys(Keys.ENTER).perform()
367365
return self
368366

369367
@BasePage.context_chrome
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import sys
2-
from os import environ
3-
41
import pytest
52
from selenium.webdriver import Firefox
63

@@ -16,25 +13,26 @@ def test_case():
1613

1714

1815
BOOKMARK_URL = "about:robots"
16+
BOOKMARK_NAME = "Robots 2"
17+
BOOKMARK_TAGS = "a"
18+
BOOKMARK_KEYBOARD = "about"
1919

2020

21-
WIN_GHA = environ.get("GITHUB_ACTIONS") == "true" and sys.platform.startswith("win")
22-
23-
24-
@pytest.mark.skipif(WIN_GHA, reason="Test unstable in Windows Github Actions")
2521
def test_add_new_other_bookmark(driver: Firefox):
2622
"""
27-
C2084518: verify user can add another bookmark from other bookmarks
23+
C2084518 - Verify another bookmark (with name, url, tag, keyboard) can be added from other bookmarks toolbar
24+
context menu
2825
"""
2926
nav = Navigation(driver)
3027
ba = BrowserActions(driver)
31-
GenericPage(driver, url=BOOKMARK_URL).open()
28+
page = GenericPage(driver, url=BOOKMARK_URL)
3229
context_menu = ContextMenu(driver)
3330

34-
# create a bookmark for other
31+
# Create the first bookmark in Other Bookmarks folder
32+
page.open()
3533
nav.bookmark_page_other()
3634

37-
# get other bookmarks
35+
# Create a new bookmark from Other Bookmark context menu
3836
with driver.context(driver.CONTEXT_CHROME):
3937
nav.get_element("other-bookmarks").click()
4038
nav.context_click("other-bookmarks-popup")
@@ -43,8 +41,11 @@ def test_add_new_other_bookmark(driver: Firefox):
4341
context_menu.hide_popup_by_child_node("context-menu-add-bookmark")
4442
nav.hide_popup("OtherBookmarksPopup")
4543

46-
nav.add_bookmark_advanced(Bookmark(url="about:robots", name="Robots 2"), ba)
44+
nav.add_bookmark_via_other_bookmark_context_menu(
45+
Bookmark(BOOKMARK_URL, BOOKMARK_NAME, BOOKMARK_TAGS, BOOKMARK_KEYBOARD), ba
46+
)
4747

48+
# Verify the presence of the second added bookmarked page
4849
with driver.context(driver.CONTEXT_CHROME):
4950
nav.get_element("other-bookmarks").click()
5051
nav.element_visible("bookmark-robots")

tests/bookmarks_and_history/test_delete_other_bookmarks.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import sys
2-
from os import environ
3-
41
import pytest
52
from selenium.webdriver import Firefox
63

@@ -11,30 +8,30 @@
118

129
BOOKMARK_URL = "about:robots"
1310
BOOKMARK_URL_2 = "about:cache"
14-
15-
16-
WIN_GHA = environ.get("GITHUB_ACTIONS") == "true" and sys.platform.startswith("win")
11+
BOOKMARK_NAME = "Cache"
12+
BOOKMARK_TAGS = "a"
13+
BOOKMARK_KEYBOARD = "about"
1714

1815

1916
@pytest.fixture()
2017
def test_case():
2118
return "2084524"
2219

2320

24-
@pytest.mark.skipif(WIN_GHA, reason="Test unstable in Windows Github Actions")
2521
def test_delete_other_bookmarks(driver: Firefox):
2622
"""
27-
C2084524: Verify that a user can Delete a bookmark from 'Other Bookmarks' folder
23+
C2084524 - Verify that a user can Delete a bookmark from 'Other Bookmarks' folder
2824
"""
2925
nav = Navigation(driver)
30-
GenericPage(driver, url=BOOKMARK_URL).open()
26+
page = GenericPage(driver, url=BOOKMARK_URL)
3127
ba = BrowserActions(driver)
3228
context_menu = ContextMenu(driver)
3329

34-
# create the first bookmark for other
30+
# Create the first bookmark in Other Bookmarks folder
31+
page.open()
3532
nav.bookmark_page_other()
3633

37-
# get other bookmarks
34+
# Create a new bookmark from Other Bookmark context menu
3835
with driver.context(driver.CONTEXT_CHROME):
3936
nav.get_element("other-bookmarks").click()
4037
nav.context_click("other-bookmarks-popup")
@@ -43,10 +40,11 @@ def test_delete_other_bookmarks(driver: Firefox):
4340
context_menu.hide_popup_by_child_node("context-menu-add-bookmark")
4441
nav.hide_popup("OtherBookmarksPopup")
4542

46-
# add second bookmark
47-
nav.add_bookmark_advanced(Bookmark(url=BOOKMARK_URL_2, name="Cache"), ba)
43+
nav.add_bookmark_via_other_bookmark_context_menu(
44+
Bookmark(BOOKMARK_URL_2, BOOKMARK_NAME, BOOKMARK_TAGS, BOOKMARK_KEYBOARD), ba
45+
)
4846

49-
# delete first bookmark and verify it's not present anymore
47+
# Delete the first bookmark and verify it's not present anymore
5048
with driver.context(driver.CONTEXT_CHROME):
5149
nav.get_element("other-bookmarks").click()
5250
nav.context_click("bookmark-about-robots")

0 commit comments

Comments
 (0)