Skip to content

Commit 6abdc12

Browse files
committed
Merge main
2 parents 6e2681c + 017a640 commit 6abdc12

File tree

9 files changed

+7244
-70
lines changed

9 files changed

+7244
-70
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"url": "http://127.0.0.1:8080/etsy_ad.html",
3+
"field_mapping": {
4+
"email": "bb8ddd35-e001-4c77-9329-6e607fbbf6d7",
5+
"name": "ecab61c0-d4d3-42ba-be29-886357246718",
6+
"street_address": "799835d1-33e8-4cbd-b371-f2bb713c9a68",
7+
"address_level_2": "61e0bcf4-066a-4fb8-929a-bf68662ae565",
8+
"address_level_1": "105a1f32-58f1-45f0-9d66-36518ad0d497",
9+
"postal_code": "fa89157a-6e9b-4496-81b1-c9ba5dac6f07",
10+
"country": "6a565409-0f31-4b55-ba48-488832e27c79"
11+
12+
},
13+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
14+
"fields": [
15+
"bb8ddd35-e001-4c77-9329-6e607fbbf6d7",
16+
"ecab61c0-d4d3-42ba-be29-886357246718",
17+
"799835d1-33e8-4cbd-b371-f2bb713c9a68",
18+
"61e0bcf4-066a-4fb8-929a-bf68662ae565",
19+
"105a1f32-58f1-45f0-9d66-36518ad0d497",
20+
"fa89157a-6e9b-4496-81b1-c9ba5dac6f07",
21+
"6a565409-0f31-4b55-ba48-488832e27c79"
22+
23+
]
24+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"url": "http://127.0.0.1:8080/etsy_cc.html",
3+
"field_mapping": {
4+
"name": "399fdc51-6f1f-4c03-9a3d-9bad578189b1",
5+
"card_number": "4c7d55ac-0291-4f67-960f-5a6c62876fb7",
6+
"expiration_month": "6fb7be76-2f51-4ac5-8011-7eb1c3549f7d",
7+
"expiration_year": "dbc812c6-039e-4b03-85f7-888a5483f87a",
8+
"cvv": "5eae1ea8-978b-44cf-bf61-2dd029fe11b6"
9+
},
10+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
11+
"fields": [
12+
"399fdc51-6f1f-4c03-9a3d-9bad578189b1",
13+
"4c7d55ac-0291-4f67-960f-5a6c62876fb7",
14+
"6fb7be76-2f51-4ac5-8011-7eb1c3549f7d",
15+
"dbc812c6-039e-4b03-85f7-888a5483f87a",
16+
"5eae1ea8-978b-44cf-bf61-2dd029fe11b6"
17+
]
18+
}

l10n_CM/sites/etsy/US/etsy_ad.html

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

l10n_CM/sites/etsy/US/etsy_cc.html

Lines changed: 7115 additions & 0 deletions
Large diffs are not rendered by default.

modules/browser_object_navigation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,16 @@ def refresh_page(self) -> BasePage:
300300
self.wait_for_page_to_load()
301301
return self
302302

303-
def handle_geolocation_prompt(self, button_type="primary"):
303+
def handle_geolocation_prompt(
304+
self, button_type="primary", remember_this_decision=False
305+
):
304306
"""
305307
Handles geolocation prompt by clicking either the 'Allow' or 'Block' button based on the button_type provided
306308
"""
307309
button_selector = f"popup-notification-{button_type}-button"
308310
self.element_clickable(button_selector)
311+
if remember_this_decision:
312+
self.click_on("checkbox-remember-this-decision")
309313
self.click_on(button_selector)
310314

311315
def open_searchmode_switcher_settings(self):

modules/data/generic_page.components.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,4 @@
7777
"strategy": "xpath",
7878
"groups": []
7979
}
80-
8180
}

tests/audio_video/test_allow_audio_video_functionality.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
from os import environ
3+
from time import sleep
34

45
import pytest
56
from selenium.webdriver import Firefox
@@ -51,5 +52,13 @@ def test_allow_audio_video_functionality(driver: Firefox):
5152

5253
# Open test website and check the site is loaded and the featured video starts playing with sound
5354
GenericPage(driver, url=TEST_URL).open()
54-
with driver.context(driver.CONTEXT_CHROME):
55-
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
55+
max_retries = 3
56+
for attempt in range(max_retries):
57+
try:
58+
with driver.context(driver.CONTEXT_CHROME):
59+
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
60+
break # Success!
61+
except AssertionError:
62+
sleep(2)
63+
else:
64+
pytest.fail(f"Tab sound status did not reach PLAYING after {max_retries} retries.")

tests/geolocation/test_geolocation_shared_via_w3c_api.py

Lines changed: 53 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -27,75 +27,64 @@ def add_to_prefs_list():
2727
TEST_URL = "https://www.w3schools.com/html/html5_geolocation.asp"
2828

2929

30-
def handle_cookie_banner(driver, web_page):
31-
"""
32-
Address the cookie banner manually if appears, as the cookie banner dismissal preference is not effective in this
33-
context
34-
"""
35-
try:
36-
driver.switch_to.window(driver.window_handles[-1])
37-
web_page.find_element(By.ID, "accept-choices").click()
38-
except NoSuchElementException:
39-
# If the cookie banner is not found, continue with the test
40-
pass
41-
42-
43-
def click_geolocation_button_trigger(web_page):
44-
"""
45-
Clicks the 'Try It' button inside the webpage to trigger the geolocation prompt
46-
"""
47-
geolocation_button_selector = (
48-
"button.w3-btn.w3-blue.w3-round[onclick='getLocation()']"
49-
)
50-
web_page.find_element(By.CSS_SELECTOR, geolocation_button_selector).click()
51-
52-
53-
def is_location_marker_displayed(web_page):
54-
"""
55-
Checks if the location marker ('You are here!') is displayed on the web page inside the map.
56-
"""
57-
location_marker = web_page.find_elements(
58-
By.CSS_SELECTOR, "div[aria-label='You are here!'][role='img']"
59-
)
60-
61-
if location_marker: # Check if the marker exists
62-
return location_marker[0].is_displayed()
63-
else:
64-
return False
65-
66-
67-
def test_allow_permission_on_geolocation_via_w3c_api(driver: Firefox):
30+
@pytest.fixture()
31+
def temp_selectors():
32+
return {
33+
"accept-choices": {
34+
"selectorData": "accept-choices",
35+
"strategy": "id",
36+
"groups": [],
37+
},
38+
"geolocation-button-selector": {
39+
"selectorData": "button.w3-btn",
40+
"strategy": "css",
41+
"groups": ["doNotCache"],
42+
},
43+
"location-marker": {
44+
"selectorData": "mapholder",
45+
"strategy": "id",
46+
"groups": ["doNotCache"],
47+
},
48+
}
49+
50+
51+
def test_allow_permission_on_geolocation_via_w3c_api(driver: Firefox, temp_selectors):
6852
"""
6953
C15186 - Verify that geolocation is successfully shared when the user allows permission via the W3C Geolocation API
7054
"""
7155

7256
# Instantiate Objects
7357
nav = Navigation(driver)
7458
web_page = GenericPage(driver, url=TEST_URL).open()
59+
web_page.elements |= temp_selectors
7560
tabs = TabBar(driver)
7661

7762
# Wait for the page to fully load and manually address the cookie banner if appears
7863
nav.wait_for_page_to_load()
79-
handle_cookie_banner(driver, web_page)
64+
cookie_element = web_page.get_elements("accept-choices")
65+
if cookie_element:
66+
cookie_element[0].click()
8067

8168
# Click the 'Try It' button and Allow the location sharing
82-
click_geolocation_button_trigger(web_page)
69+
web_page.click_on("geolocation-button-selector")
8370
nav.handle_geolocation_prompt(button_type="primary")
8471

85-
# Assert that the location marker is displayed
86-
assert is_location_marker_displayed(web_page)
72+
# Check that the location marker is displayed
73+
# if map is displayed, style attribute will be available
74+
web_page.element_visible("location-marker")
75+
assert web_page.get_element("location-marker").get_attribute("style")
8776

8877
# Open a new tab, because refresh will keep the allow state of the location for one hour or until the tab is closed
8978
tabs.open_web_page_in_new_tab(web_page, num_tabs=2)
9079

9180
# Click the 'Try It' button and Allow the location sharing while choose the option Remember this decision
92-
click_geolocation_button_trigger(web_page)
93-
nav.element_clickable("checkbox-remember-this-decision")
94-
nav.click_on("checkbox-remember-this-decision")
95-
nav.handle_geolocation_prompt(button_type="primary")
81+
web_page.click_on("geolocation-button-selector")
82+
nav.handle_geolocation_prompt(button_type="primary", remember_this_decision=True)
9683

97-
# Assert that the location marker is displayed again
98-
assert is_location_marker_displayed(web_page)
84+
# Check that the location marker is displayed
85+
# if map is displayed, style attribute will be available
86+
web_page.element_visible("location-marker")
87+
assert web_page.get_element("location-marker").get_attribute("style")
9988

10089
# Assert that the permission icon is displayed in address bar when in a new tab
10190
tabs.open_web_page_in_new_tab(web_page, num_tabs=3)
@@ -104,39 +93,42 @@ def test_allow_permission_on_geolocation_via_w3c_api(driver: Firefox):
10493
assert permission_icon.is_displayed()
10594

10695

107-
def test_block_permission_on_geolocation_via_w3c_api(driver: Firefox):
96+
def test_block_permission_on_geolocation_via_w3c_api(driver: Firefox, temp_selectors):
10897
"""
10998
C15186 - Verify that geolocation is not shared when the user blocks permission via the W3C Geolocation API
11099
"""
111100

112101
# Instantiate Objects
113102
nav = Navigation(driver)
114103
web_page = GenericPage(driver, url=TEST_URL).open()
104+
web_page.elements |= temp_selectors
115105
tabs = TabBar(driver)
116106

117107
# Wait for the page to fully load and manually address the cookie banner if appears
118108
nav.wait_for_page_to_load()
119-
handle_cookie_banner(driver, web_page)
109+
cookie_element = web_page.get_elements("accept-choices")
110+
if cookie_element:
111+
cookie_element[0].click()
120112

121113
# Click the 'Try It' button and Block the location sharing
122-
click_geolocation_button_trigger(web_page)
114+
web_page.click_on("geolocation-button-selector")
123115
nav.handle_geolocation_prompt(button_type="secondary")
124116

125-
# Assert that the location marker is not displayed
126-
assert not is_location_marker_displayed(web_page)
117+
# Check that the location marker is displayed
118+
# if map is not displayed, style attribute will not be available
119+
assert not web_page.get_element("location-marker").get_attribute("style")
127120

128121
# Click the 'Try It' button and Block the location sharing while choose the option Remember this decision
129-
nav.refresh_page()
130-
click_geolocation_button_trigger(web_page)
131-
nav.element_clickable("checkbox-remember-this-decision")
132-
nav.click_on("checkbox-remember-this-decision")
133-
nav.handle_geolocation_prompt(button_type="secondary")
122+
tabs.open_web_page_in_new_tab(web_page, num_tabs=2)
123+
web_page.click_on("geolocation-button-selector")
124+
nav.handle_geolocation_prompt(button_type="secondary", remember_this_decision=True)
134125

135-
# Assert that the location marker is not displayed
136-
assert not is_location_marker_displayed(web_page)
126+
# Check that the location marker is displayed
127+
# if map is not displayed, style attribute will not be available
128+
assert not web_page.get_element("location-marker").get_attribute("style")
137129

138130
# Assert that the permission icon is displayed in address bar when in a new tab
139-
tabs.open_web_page_in_new_tab(web_page, num_tabs=2)
131+
tabs.open_web_page_in_new_tab(web_page, num_tabs=3)
140132
with driver.context(driver.CONTEXT_CHROME):
141133
permission_icon = nav.get_element("permissions-location-icon")
142134
assert permission_icon.is_displayed()

tests/security_and_privacy/test_blocking_fingerprinters.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import time
2+
13
import pytest
24
from selenium.webdriver import Firefox
35

46
from modules.browser_object_navigation import Navigation
7+
from modules.browser_object_tabbar import TabBar
58
from modules.browser_object_tracker_panel import TrackerPanel
69
from modules.page_object_generics import GenericPage
710
from modules.page_object_prefs import AboutPrefs
@@ -23,21 +26,30 @@ def test_blocking_fingerprinter(
2326
"""
2427
C446404: Blocking Fingerprinters
2528
"""
26-
# instantiate objects
29+
# Instantiate objects
2730
about_prefs_privacy.open()
2831
tracker_panel = TrackerPanel(driver)
2932
tracking_page = GenericPage(driver, url=FINGERPRINTERS_URL)
33+
tabs = TabBar(driver)
3034

3135
# Select custom option and keep just known fingerprinters checked
3236
about_prefs_privacy.select_trackers_to_block("known-fingerprints-checkbox")
3337

34-
# Access url and click on the shield icon and verify that known fingerprinters are blocked
38+
# Switch to and new tab and access url snd verify the shield icon
39+
tabs.new_tab_by_button()
40+
tabs.wait_for_num_tabs(2)
41+
tabs.switch_to_new_tab()
42+
3543
tracking_page.open()
3644
tracker_panel.wait_for_blocked_tracking_icon(nav, tracking_page)
3745

46+
# Open the tracker panel and verify fingerprinters are visible
3847
nav.open_tracker_panel()
39-
nav.element_visible("known-fingerprints")
4048

41-
# Click on fingerprinters and check if subpanel is correctly displayed
42-
nav.click_on("known-fingerprints")
49+
time.sleep(3) # no wait condition do the trick, bug 1974080
50+
51+
# Click on fingerprinters
52+
tracker_panel.click_on("tracking-finger-prints")
53+
54+
# Check if the subpanel is displayed with the expected title
4355
nav.element_visible("fingerprints-blocked-subpanel")

0 commit comments

Comments
 (0)