Skip to content

Commit dbd358c

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Merge branch 'main' into Hani/address_doorhanger_captures_email_telephone
2 parents f918d45 + 13ead4f commit dbd358c

14 files changed

+103
-71
lines changed

.github/workflows/check-beta.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ permissions:
1111
jobs:
1212
Check-Beta-Version:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
reportable: ${{ steps.reportable.outputs.test }}
1416
steps:
1517
- name: Checkout repository
1618
uses: actions/checkout@v4
1719
- name: Check if the run is reportable
20+
id: reportable
1821
env:
1922
TESTRAIL_REPORT: true
2023
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
@@ -23,8 +26,9 @@ jobs:
2326
run: |
2427
pip3 install 'pipenv==2023.11.15';
2528
pipenv install
26-
pipenv run python -c 'from modules import testrail_integration as tri; import sys; sys.exit(0) if tri.reportable() else sys.exit(100)'
29+
echo test=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable())') >> "$GITHUB_OUTPUT"
2730
Run-Smoke-Tests:
2831
needs: Check-Beta-Version
32+
if: ${{ needs.Check-Beta-Version.outputs.reportable == 'True' }}
2933
uses: ./.github/workflows/smoke.yml
3034
secrets: inherit

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,13 @@ Location: Search mode of awesomebar
28492849
Path to .json: modules/data/navigation.components.json
28502850
```
28512851
```
2852+
Selector Name: contextual_search_button_awesome_bar
2853+
Selector Data: "span.urlbarView-dynamic-actions-button-0.urlbarView-action-btn[data-action='matched-contextual-search']"
2854+
Description: Contextual search button
2855+
Location: Address bar
2856+
Path to .json: modules/data/navigation.components.json
2857+
```
2858+
```
28522859
Selector Name: refresh-button-awesome-bar
28532860
Selector Data: .urlbarView-action-btn[data-action=refresh]
28542861
Description: Refresh button in the awesome bar

modules/browser_object_navigation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,8 @@ def open_searchmode_switcher_settings(self):
330330
self.click_on("searchmode-switcher")
331331
self.click_on("searchmode-switcher-settings")
332332
return self
333+
334+
def select_element_in_nav(self, element: str) -> BasePage:
335+
with self.driver.context(self.driver.CONTEXT_CHROME):
336+
self.get_element(element).click()
337+
return self

modules/data/navigation.components.json

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@
150150
},
151151

152152
"addon-suggestion": {
153-
"selectorData": "div.urlbarView-row[type='rust_amo'] span.urlbarView-title.urlbarView-overflowable",
154-
"strategy": "css",
153+
"selectorData": "urlbarView-row-body",
154+
"strategy": "class",
155155
"groups": []
156156
},
157157

@@ -408,13 +408,13 @@
408408
"groups": []
409409
},
410410

411-
"bookmark-in-bar": {
411+
"bookmark-in-bar": {
412412
"selectorData": "toolbarbutton.bookmark-item",
413413
"strategy": "css",
414414
"groups": []
415415
},
416416

417-
"popup-notification": {
417+
"popup-notification": {
418418
"selectorData": "popupnotification",
419419
"strategy": "tag",
420420
"groups": []
@@ -456,13 +456,13 @@
456456
"groups": []
457457
},
458458

459-
"toolbar-history-clear-recent-history": {
459+
"toolbar-history-clear-recent-history": {
460460
"selectorData": "appMenuClearRecentHistory",
461461
"strategy": "id",
462462
"groups": []
463463
},
464464

465-
"toolbar-history-recent_history": {
465+
"toolbar-history-recent_history": {
466466
"selectorData": "panelMenu_recentHistory",
467467
"strategy": "id",
468468
"groups": []
@@ -478,7 +478,7 @@
478478
"selectorData": "menuitem[label='Gort! Klaatu barada nikto!']",
479479
"strategy": "css",
480480
"groups": []
481-
},
481+
},
482482

483483
"password-notification-key": {
484484
"selectorData": "box#notification-popup-box image#password-notification-icon.notification-anchor-icon",
@@ -510,7 +510,6 @@
510510
"groups": []
511511
},
512512

513-
514513
"permissions-location-icon": {
515514
"selectorData": "permissions-granted-icon",
516515
"strategy": "id",
@@ -536,9 +535,9 @@
536535
},
537536

538537
"permission-popup-audio-video-allowed": {
539-
"selectorData": "#permission-popup-menulist[label='Allow Audio and Video']",
540-
"strategy": "css",
541-
"groups": []
538+
"selectorData": "#permission-popup-menulist[label='Allow Audio and Video']",
539+
"strategy": "css",
540+
"groups": []
542541
},
543542

544543
"block-audio-video-menuitem": {
@@ -548,40 +547,47 @@
548547
},
549548

550549
"autoplay-icon-blocked": {
551-
"selectorData": "blocked-permissions-container",
552-
"strategy": "id",
553-
"groups": []
550+
"selectorData": "blocked-permissions-container",
551+
"strategy": "id",
552+
"groups": []
554553
},
555554

556555
"toolbar-zoom-level": {
557556
"selectorData": "urlbar-zoom-button",
558557
"strategy": "id",
559-
"groups": [
558+
"groups": [
560559
"doNotCache"
561560
]
562561
},
563562

564563
"search-settings": {
565564
"selectorData": "urlbar-anon-search-settings",
566565
"strategy": "id",
567-
"groups": []
566+
"groups": []
568567
},
569568

570569
"searchmode-switcher-settings": {
571570
"selectorData": "searchmode-switcher-popup-search-settings-button",
572571
"strategy": "id",
573-
"groups": []
572+
573+
"groups": []
574+
},
575+
576+
"contextual_search_button_awesome_bar": {
577+
"selectorData": "span.urlbarView-dynamic-actions-button-0.urlbarView-action-btn[data-action='matched-contextual-search']",
578+
"strategy": "css",
579+
"groups": []
574580
},
575581

576582
"refresh-button-awesome-bar": {
577583
"selectorData": ".urlbarView-action-btn[data-action=refresh]",
578584
"strategy": "css",
579-
"groups": []
585+
"groups": []
580586
},
581587

582588
"refresh-firefox-dialog": {
583589
"selectorData": "window-modal-dialog",
584590
"strategy": "id",
585-
"groups": []
591+
"groups": []
586592
}
587593
}

taskcluster/kinds/new-beta-qa/kind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tasks:
3939
pipenv install;
4040
./collect_executables.sh;
4141
export FX_EXECUTABLE=./firefox/firefox;
42-
pipenv run python -c 'from modules import testrail_integration as tri; tri.tc_reportable()' || exit 100;
42+
pipenv run python -c 'from modules import testrail_integration as tri; tri.tc_reportable()' || exit 0;
4343
$FX_EXECUTABLE --version;
4444
. ./keyring-unlock.sh
4545
pipenv run pytest --fx-executable $FX_EXECUTABLE -n 4 tests;

tests/address_bar_and_search/test_addon_suggestion.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,14 @@ def test_addon_suggestion_based_on_search_input(driver: Firefox):
3535

3636
nav = Navigation(driver)
3737
nav.set_awesome_bar()
38-
sleep(20)
38+
sleep(2)
3939

40-
with driver.context(driver.CONTEXT_CHROME):
41-
nav.awesome_bar.click()
40+
for input_text, addon_name in input_to_addon_name.items():
41+
nav.type_in_awesome_bar(input_text)
42+
nav.element_visible("addon-suggestion")
43+
nav.select_element_in_nav("addon-suggestion")
4244

43-
for input_text, addon_name in input_to_addon_name.items():
44-
nav.awesome_bar.send_keys(input_text)
45-
nav.element_visible("addon-suggestion")
46-
nav.get_element("addon-suggestion").click()
47-
48-
# Construct the expected URL
49-
expected_url = (
50-
f"https://addons.mozilla.org/en-US/firefox/addon/{addon_name}/"
51-
)
52-
nav.expect_in_content(EC.url_contains(expected_url))
53-
54-
nav.awesome_bar.clear()
45+
# Construct the expected URL
46+
expected_url = f"https://addons.mozilla.org/en-US/firefox/addon/{addon_name}/"
47+
nav.expect_in_content(EC.url_contains(expected_url))
48+
nav.clear_awesome_bar()

tests/address_bar_and_search/test_default_search_provider_change_awesome_bar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def test_case():
1212

1313

1414
@pytest.mark.ci
15-
@pytest.mark.skip("Scotch Bonnet")
1615
def test_default_search_provider_change_awesome_bar(driver: Firefox):
1716
"""
1817
C2860208 - This test makes sure that the default search provider can be changed and settings are applied

tests/address_bar_and_search/test_preferences_all_toggles_enabled.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ def test_preferences_all_toggles_enabled(driver: Firefox):
4949
for el in nav.get_elements("sponsored-suggestion")
5050
]
5151
)
52-
logging.info(
53-
"Label text:"
54-
+ nav.get_element("sponsored-suggestion").get_attribute("innerText")
55-
)
5652
sleep(3)
5753
retries += 1
5854

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from selenium.webdriver import Firefox
3+
from selenium.webdriver.common.keys import Keys
34
from selenium.webdriver.support import expected_conditions as EC
45

56
from modules.browser_object import Navigation
@@ -10,14 +11,29 @@ def test_case():
1011
return "2234690"
1112

1213

13-
sites = ["Google", "Amazon", "Bing", "DuckDuckGo", "eBay"]
14+
# Dictionary mapping search engines to their expected input prefix
15+
search_modes = {
16+
# "Google": "Go", No longer testing Google if this is the default search engine, due to Scotch Bonnet changes
17+
"Amazon": "Am",
18+
"Bing": "Bi",
19+
"DuckDuckGo": "Du",
20+
"eBay": "Eb",
21+
}
1422

1523

16-
@pytest.mark.skip("Scotch Bonnet")
17-
@pytest.mark.parametrize("site", sites)
18-
def test_search_modes_for_sites(driver: Firefox, site: str):
19-
"""C2234690: Test that search modes can be activated. May also cover C1365213 eventually"""
24+
@pytest.mark.parametrize("site, prefix", search_modes.items())
25+
def test_search_modes_for_sites(driver: Firefox, site: str, prefix: str):
26+
"""C2234690: Test that search modes can be activated by typing the first two letters."""
2027
nav = Navigation(driver)
21-
nav.search("soccer", mode=site)
28+
29+
# Type the first two letters into the Awesome Bar
30+
nav.type_in_awesome_bar(prefix)
31+
32+
nav.click_on("contextual_search_button_awesome_bar")
33+
34+
# Perform the search
35+
nav.type_in_awesome_bar("soccer" + Keys.ENTER)
36+
37+
# Validate that the correct search engine is used
2238
nav.expect_in_content(EC.url_contains(site.lower()))
2339
nav.clear_awesome_bar()

tests/address_bar_and_search/test_server_not_found_error.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def test_case():
1313
return "1901393"
1414

1515

16-
CHECK_SITE = "http://cnn"
16+
CHECK_SITE = "http://example"
1717
SHORT_SITE = CHECK_SITE.split("/")[-1]
1818

1919
ERROR_TITLES = ["Hmm. We’re having trouble finding that site."]
2020

2121

22-
def test_server_not_found_error(driver: Firefox):
22+
def test_server_not_found_error(driver: Firefox, version: str):
2323
"""
2424
C1901393: - This tests that when a user navigates to a non-existent site, a "Server Not Found" error is
2525
displayed. The error page contains the correct elements, and the suggested link redirects to the appropriate page.
@@ -30,6 +30,9 @@ def test_server_not_found_error(driver: Firefox):
3030
tabs = TabBar(driver)
3131
error_page = ErrorPage(driver)
3232

33+
# Auto-detect if this is a Nightly build by checking the version string
34+
is_nightly = any(identifier in version.lower() for identifier in ["a1", "nightly"])
35+
3336
nav.search(CHECK_SITE)
3437

3538
# Verify the tab title
@@ -38,35 +41,37 @@ def test_server_not_found_error(driver: Firefox):
3841
)
3942

4043
# Verify elements on the error page
41-
error_title = error_page.get_error_title()
42-
assert (
43-
error_title in ERROR_TITLES
44-
), f"Expected error title text not found. Actual: {error_title}"
45-
46-
error_short_description = error_page.get_error_short_description()
44+
assert error_page.get_error_title() in ERROR_TITLES
4745
assert (
48-
f"We can’t connect to the server at {SHORT_SITE}" in error_short_description
49-
), (
50-
f"Expected error short description text not found."
51-
f"Actual: {error_short_description}"
46+
f"We can’t connect to the server at {SHORT_SITE}"
47+
in error_page.get_error_short_description()
5248
)
5349

54-
error_long_description_items = error_page.get_error_long_description_items()
50+
# Set the permission text based on what version is actually running
51+
if is_nightly:
52+
permission_message = (
53+
"Check that Nightly has permission to access the web (you might be connected but behind "
54+
"a firewall)"
55+
)
56+
else:
57+
permission_message = (
58+
"Check that Firefox has permission to access the web (you might be connected but behind "
59+
"a firewall)"
60+
)
61+
5562
expected_texts = [
5663
"Try again later",
5764
"Check your network connection",
58-
"Check that Firefox has permission to access the web (you might be connected but behind a firewall)",
65+
permission_message,
5966
]
6067

61-
for i, item in enumerate(error_long_description_items):
62-
assert (
63-
item.text == expected_texts[i]
64-
), f"Expected error long description item text not found. Actual: {item.text}"
68+
for i, item in enumerate(error_page.get_error_long_description_items()):
69+
assert item.text == expected_texts[i]
6570

6671
WebDriverWait(driver, 30).until(
6772
lambda d: error_page.get_try_again_button().is_displayed()
6873
)
6974

7075
# Verify that the suggested link redirects to the correct page
7176
error_page.get_error_suggestion_link().click()
72-
nav.expect_in_content(EC.url_contains("https://www.cnn.com/"))
77+
nav.expect_in_content(EC.url_contains("https://www.example.com/"))

0 commit comments

Comments
 (0)