Skip to content

Commit c2c5e99

Browse files
Merge branch 'main' into philimon/suite_refactor
2 parents 792612e + e4c7226 commit c2c5e99

31 files changed

+336
-95
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,20 @@ Description: Save address doorhanger
13531353
Location: Address bar
13541354
Path to .json: modules/data/autofill_popup.components.json
13551355
```
1356+
```
1357+
Selector Name: address-doorhanger-name
1358+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span"
1359+
Description: Save address doorhanger name section
1360+
Location: Address bar
1361+
Path to .json: modules/data/autofill_popup.components.json
1362+
```
1363+
```
1364+
Selector Name: address-doorhanger-org
1365+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(2) span"
1366+
Description: Save address doorhanger organization section
1367+
Location: Address bar
1368+
Path to .json: modules/data/autofill_popup.components.json
1369+
```
13561370
#### context_menu
13571371
```
13581372
Selector Name: context-menu-search-selected-text
@@ -2835,6 +2849,13 @@ Location: Search mode of awesomebar
28352849
Path to .json: modules/data/navigation.components.json
28362850
```
28372851
```
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+
```
28382859
Selector Name: refresh-button-awesome-bar
28392860
Selector Data: .urlbarView-action-btn[data-action=refresh]
28402861
Description: Refresh button in the awesome bar
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.page_object_about_pages import AboutConfig
6+
from modules.page_object_autofill import AddressFill
7+
from modules.page_object_prefs import AboutPrefs
8+
from modules.util import BrowserActions, Utilities
9+
10+
11+
@pytest.fixture()
12+
def test_case():
13+
return "2888701"
14+
15+
16+
def test_demo_ad_name_org_captured_in_doorhanger_and_stored(
17+
driver: Firefox, region: str
18+
):
19+
"""
20+
C2888701 - Verify name/org fields are captured in the Capture Doorhanger and stored in about:preferences
21+
"""
22+
# instantiate objects
23+
address_autofill = AddressFill(driver)
24+
address_autofill_popup = AutofillPopup(driver)
25+
util = Utilities()
26+
about_config = AboutConfig(driver)
27+
browser_action_obj = BrowserActions(driver)
28+
29+
# Change pref value of region
30+
about_config.change_config_value("browser.search.region", region)
31+
32+
# create fake data and fill it in
33+
address_autofill.open()
34+
address_autofill_data = util.fake_autofill_data(region)
35+
address_autofill.save_information_basic(address_autofill_data)
36+
37+
# The "Save address?" doorhanger is displayed
38+
address_autofill_popup.element_visible("address-save-doorhanger")
39+
40+
# containing name field
41+
expected_name = address_autofill_data.name
42+
address_autofill_popup.element_has_text("address-doorhanger-name", expected_name)
43+
44+
# containing org field
45+
expected_org = address_autofill_data.organization
46+
address_autofill_popup.element_has_text("address-doorhanger-org", expected_org)
47+
48+
# Click the "Save" button
49+
address_autofill_popup.click_doorhanger_button("save")
50+
51+
# Navigate to about:preferences#privacy => "Autofill" section
52+
about_prefs = AboutPrefs(driver, category="privacy").open()
53+
iframe = about_prefs.get_save_addresses_popup_iframe()
54+
browser_action_obj.switch_to_iframe_context(iframe)
55+
56+
# The address saved in step 2 is listed in the "Saved addresses" modal: name and organization
57+
elements = about_prefs.get_elements("saved-addresses-values")
58+
expected_values = [expected_name, expected_org]
59+
found_name_org = any(
60+
all(value in element.text for value in expected_values) for element in elements
61+
)
62+
assert (
63+
found_name_org
64+
), "Name or organization were not found in any of the address entries!"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.page_object import AboutPrefs, CreditCardFill
6+
from modules.util import BrowserActions, Utilities
7+
8+
9+
@pytest.fixture()
10+
def test_case():
11+
return "2886598"
12+
13+
14+
def test_dropdown_presence_credit_card(driver: Firefox):
15+
"""
16+
C2886598 - Verify autofill dropdown is displayed only for the eligible fields after a credit card is saved
17+
"""
18+
19+
# Initialize objects
20+
util = Utilities()
21+
about_prefs = AboutPrefs(driver, category="privacy")
22+
about_prefs_cc_popup = AboutPrefs(driver)
23+
browser_action_obj = BrowserActions(driver)
24+
credit_card_fill_obj = CreditCardFill(driver)
25+
autofill_popup_obj = AutofillPopup(driver)
26+
27+
# Save a credit card in about:preferences
28+
about_prefs.open()
29+
iframe = about_prefs.get_saved_payments_popup_iframe()
30+
browser_action_obj.switch_to_iframe_context(iframe)
31+
credit_card_sample_data = util.fake_credit_card_data()
32+
about_prefs_cc_popup.click_on(
33+
"panel-popup-button", labels=["autofill-manage-add-button"]
34+
)
35+
about_prefs.fill_cc_panel_information(credit_card_sample_data)
36+
37+
# Open credit card form page
38+
credit_card_fill_obj.open()
39+
40+
# Verify autofill dropdown is displayed only for the eligible fields
41+
credit_card_fill_obj.verify_autofill_dropdown_all_fields(autofill_popup_obj)

l10n_CM/region/CA.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py"
79
]
810
}

l10n_CM/region/DE.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py"
79
]
810
}

l10n_CM/region/FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py"
79
]
810
}

l10n_CM/region/US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py"
79
]
810
}

modules/browser_object_autofill_popup.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ def verify_element_displayed(self, reference: Union[str, tuple, WebElement]):
2323
"""Confirms that an element exists in popup"""
2424
self.element_clickable(reference)
2525

26-
def verify_no_popup_panel(self):
27-
"""Verifies that the autofill popup does NOT appear"""
28-
with self.driver.context(self.driver.CONTEXT_CHROME):
29-
element = self.get_element("autofill-panel")
30-
self.expect_not(EC.element_to_be_clickable(element))
26+
def ensure_autofill_dropdown_not_visible(self):
27+
"""Verifies that the autofill dropdown does NOT appear"""
28+
self.element_not_visible("select-form-option")
29+
return self
3130

32-
def verify_popup(self):
33-
"""Verifies that the autofill popup is clickable"""
34-
with self.driver.context(self.driver.CONTEXT_CHROME):
35-
self.expect(
36-
EC.element_to_be_clickable(self.get_element("select-form-option"))
37-
)
31+
def ensure_autofill_dropdown_visible(self):
32+
"""Verifies that the autofill dropdown appears"""
33+
self.element_visible("select-form-option")
34+
return self
3835

3936
# Interaction with popup elements
4037
def click_doorhanger_button(self, button_type: str) -> BasePage:

modules/browser_object_navigation.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ class Navigation(BasePage):
2323
"History": "^",
2424
"Actions": ">",
2525
}
26+
VALID_SEARCH_MODES = {
27+
"Google",
28+
"eBay",
29+
"Amazon.com",
30+
"Bing",
31+
"DuckDuckGo",
32+
"Wikipedia (en)",
33+
}
2634

2735
def __init__(self, driver: Firefox, **kwargs):
2836
super().__init__(driver, **kwargs)
@@ -181,6 +189,35 @@ def click_in_awesome_bar(self) -> BasePage:
181189
return self
182190

183191
@BasePage.context_chrome
192+
def click_search_mode_switcher(self) -> BasePage:
193+
"""
194+
click search mode switcher
195+
"""
196+
self.search_mode_switcher = self.get_element("searchmode-switcher")
197+
self.search_mode_switcher.click()
198+
return self
199+
200+
@BasePage.context_chrome
201+
def set_search_mode(self, search_mode: str) -> BasePage:
202+
"""
203+
set new search location if search_mode in VALID_SEARCH_MODES
204+
205+
Parameter:
206+
search_mode (str): search mode to be selected
207+
208+
Raises:
209+
StopIteration: if a valid search mode is not found in the list of valid elements.
210+
"""
211+
# check if search_mode is valid, otherwise raise error.
212+
if search_mode not in self.VALID_SEARCH_MODES:
213+
raise ValueError("search location is not valid.")
214+
# switch to chrome context
215+
# get list of all valid search modes and filter by label
216+
self.get_element(
217+
"search-mode-switcher-option", labels=[search_mode]
218+
).click()
219+
return self
220+
184221
def context_click_in_awesome_bar(self) -> BasePage:
185222
self.set_awesome_bar()
186223
actions = ActionChains(self.driver)
@@ -346,3 +383,8 @@ def open_searchmode_switcher_settings(self):
346383
self.click_on("searchmode-switcher")
347384
self.click_on("searchmode-switcher-settings")
348385
return self
386+
387+
@BasePage.context_chrome
388+
def select_element_in_nav(self, element: str) -> BasePage:
389+
self.get_element(element).click()
390+
return self

0 commit comments

Comments
 (0)