Skip to content

Commit 86607da

Browse files
committed
Merge branch 'main' of github.com:mozilla/fx-desktop-qa-automation
2 parents 7d43c88 + 3415733 commit 86607da

9 files changed

+111
-109
lines changed

.github/workflows/check-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check new beta version
22

33
on:
44
schedule:
5-
- cron: "33 */1 * * *"
5+
- cron: "53 */1 * * *"
66
env:
77
LATEST: ""
88
permissions:

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

modules/page_object_prefs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def import_bookmarks(self, browser_name: str, platform) -> BasePage:
567567
# There are two messages that indicate a successful migration
568568
self.wait.until(
569569
lambda _: self.get_element("migration-progress-header").text
570-
in ["Data Imported Successfully", "Data Import Complete"]
570+
in ["Data imported successfully", "Data import complete"]
571571
)
572572
self.actions.send_keys(" ").perform()
573573
return self

modules/testrail.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,12 @@ def create_test_run_on_plan_entry(
200200
logging.info(f"run on plan entry configs {config_ids}")
201201
payload = {
202202
"config_ids": config_ids,
203-
"description": description,
204203
"include_all": not bool(case_ids),
205204
}
206205
if case_ids:
207206
payload["case_ids"] = case_ids
207+
if description:
208+
payload["description"] = description
208209
logging.info(f"create run on entry payload:\n{payload}")
209210
return self.client.send_post(
210211
f"add_run_to_plan_entry/{plan_id}/{entry_id}", payload

modules/testrail_scripts/testrail_script_set_untriaged_suitable_to_null_coverage.py renamed to modules/testrail_scripts/set_coverage_none_for_untriaged_suitable_unsuitable_disabled_automation.py

Lines changed: 60 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,48 @@
77
from modules.testrail_integration import testrail_init
88

99
# Set up logging
10-
logging.basicConfig(
11-
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
12-
)
10+
logging.basicConfig(level=logging.INFO, format="%(message)s")
1311

1412
# Load env file from project root
1513
script_dir = os.path.dirname(__file__)
16-
project_root = os.path.abspath(os.path.join(script_dir, ".."))
14+
project_root = os.path.abspath(os.path.join(script_dir, "..", ".."))
1715
env_file_path = os.path.join(project_root, "testrail_credentials.env")
1816
load_dotenv(dotenv_path=env_file_path)
1917

2018
# TestRail project ID (Fx Desktop)
2119
PROJECT_ID = 17
2220

23-
# Specific suites to process
24-
SUITES = [
25-
("18215", "Address Bar and Search"),
26-
("1731", "Audio/Video"),
27-
("2525", "Bookmarks and History"),
28-
("29219", "Downloads"),
29-
("5259", "Drag and Drop"),
30-
("2085", "Find Toolbar"),
31-
("2054", "Form Autofill"),
32-
("498", "Geolocation"),
33-
("22801", "Language Packs"),
34-
("85", "Menus"),
35-
("6066", "Networking"),
36-
("1907", "Notifications"),
37-
("65", "PDF Viewer"),
38-
("43517", "Password Manager"),
39-
("5403", "Pocket"),
40-
("2241", "Preferences"),
41-
("2119", "Profile"),
42-
("73", "Printing UI"),
43-
("2126", "Reader View"),
44-
("102", "Scrolling"),
45-
("5833", "Security and Privacy"),
46-
("2130", "Sync & Firefox Account"),
47-
("2103", "Tabs"),
48-
("1997", "Theme and Toolbar"),
49-
]
50-
5121
# Automation status values
52-
AUTOMATION_STATUS = {"UNTRIAGED": 1, "SUITABLE": 2, "NOT_SUITABLE": 3, "COMPLETED": 4}
22+
AUTOMATION_STATUS = {
23+
"UNTRIAGED": 1,
24+
"SUITABLE": 2,
25+
"NOT_SUITABLE": 3,
26+
"COMPLETED": 4,
27+
"DISABLED": 5,
28+
}
5329

5430
# Automation coverage values
5531
AUTOMATION_COVERAGE = {"NONE": 1, "PARTIAL": 2, "FULL": 3}
5632

5733
# Coverage value to name mapping for better logging
5834
COVERAGE_NAMES = {1: "None", 2: "Partial", 3: "Full"}
5935

36+
# Status value to name mapping for better logging
37+
STATUS_NAMES = {
38+
1: "Untriaged",
39+
2: "Suitable",
40+
3: "Unsuitable",
41+
4: "Completed",
42+
5: "Disabled",
43+
}
44+
45+
46+
def get_all_suites(tr, project_id):
47+
"""Get all suites from the project"""
48+
suites = tr.client.send_get(f"get_suites/{project_id}")
49+
logging.info(f"Found {len(suites)} suites in project {project_id}")
50+
return suites
51+
6052

6153
def get_all_test_cases(tr, project_id, suite_id):
6254
"""Fetch all test cases from a suite by handling pagination."""
@@ -83,11 +75,10 @@ def get_all_test_cases(tr, project_id, suite_id):
8375
return all_cases
8476

8577

86-
def set_untriaged_suitable_to_null_coverage(
87-
tr, project_id, dry_run=True, batch_size=25
88-
):
78+
def update_coverage_to_none(tr, project_id, dry_run=True, batch_size=25):
8979
"""
90-
Set automation coverage to None for test cases that have automation status of Untriaged or Suitable
80+
Set automation coverage to None for all test cases that have automation status of
81+
Untriaged, Suitable, or Not Suitable, regardless of their current coverage value
9182
"""
9283
start_time = time.time()
9384
try:
@@ -97,10 +88,14 @@ def set_untriaged_suitable_to_null_coverage(
9788
updated_count = 0
9889
changed_case_ids = [] # Track all case IDs that will be changed
9990

100-
# Process each specified suite
101-
total_suites = len(SUITES)
102-
for index, (suite_id, suite_name) in enumerate(SUITES, 1):
103-
# Show progress
91+
# Get all suites in the project
92+
suites = get_all_suites(tr, project_id)
93+
total_suites = len(suites)
94+
95+
# Process each suite
96+
for index, suite in enumerate(suites, 1):
97+
suite_id = suite["id"]
98+
suite_name = suite["name"]
10499
logging.info(f"Processing suite {index}/{total_suites}: {suite_name}")
105100

106101
try:
@@ -112,18 +107,17 @@ def set_untriaged_suitable_to_null_coverage(
112107
status = case.get("custom_automation_status")
113108
coverage = case.get("custom_automation_coverage")
114109

115-
# Check if status is Untriaged or Suitable
110+
# Check if status is one that should have None coverage
116111
if status in [
117112
AUTOMATION_STATUS["UNTRIAGED"],
118113
AUTOMATION_STATUS["SUITABLE"],
114+
AUTOMATION_STATUS["NOT_SUITABLE"],
115+
AUTOMATION_STATUS["DISABLED"],
119116
]:
120-
# Check coverage value
121-
if coverage in [
122-
AUTOMATION_COVERAGE["FULL"],
123-
AUTOMATION_COVERAGE["PARTIAL"],
124-
]:
117+
# If coverage is not None, add to update targets
118+
if coverage != AUTOMATION_COVERAGE["NONE"]:
125119
update_targets.append(case)
126-
elif coverage == AUTOMATION_COVERAGE["NONE"]:
120+
else:
127121
skipped_cases += 1
128122

129123
suite_update_count = len(update_targets)
@@ -143,14 +137,12 @@ def set_untriaged_suitable_to_null_coverage(
143137
batch_ids = []
144138
for case in batch:
145139
case_id = case["id"]
146-
coverage = case.get("custom_automation_coverage")
147-
coverage_name = COVERAGE_NAMES.get(coverage)
148-
149-
if coverage_name is None:
150-
logging.warning(
151-
f"Case {case_id} has unexpected coverage value: {coverage}"
152-
)
153-
coverage_name = "Unknown"
140+
current_coverage = case.get(
141+
"custom_automation_coverage"
142+
)
143+
coverage_name = COVERAGE_NAMES.get(
144+
current_coverage, "Empty"
145+
)
154146

155147
try:
156148
tr.update_case_field(
@@ -175,17 +167,18 @@ def set_untriaged_suitable_to_null_coverage(
175167
)
176168
for case in batch:
177169
case_id = case["id"]
178-
coverage = case.get("custom_automation_coverage")
179-
coverage_name = COVERAGE_NAMES.get(coverage)
180-
181-
if coverage_name is None:
182-
logging.warning(
183-
f"Case {case_id} has unexpected coverage value: {coverage}"
184-
)
185-
coverage_name = "Unknown"
186-
170+
current_status = case.get("custom_automation_status")
171+
current_coverage = case.get(
172+
"custom_automation_coverage"
173+
)
174+
status_name = STATUS_NAMES.get(
175+
current_status, "Unknown"
176+
)
177+
coverage_name = COVERAGE_NAMES.get(
178+
current_coverage, "Empty"
179+
)
187180
logging.info(
188-
f" Case {case_id} - {coverage_name} → None"
181+
f" Case {case_id} - Status: {status_name}, Coverage: {coverage_name} → None"
189182
)
190183
changed_case_ids.append((case_id, suite_name))
191184

@@ -242,7 +235,7 @@ def main():
242235

243236
# Process all cases in the project
244237
logging.info(f"Processing project ID: {PROJECT_ID}...")
245-
set_untriaged_suitable_to_null_coverage(tr, PROJECT_ID, dry_run)
238+
update_coverage_to_none(tr, PROJECT_ID, dry_run)
246239

247240

248241
if __name__ == "__main__":
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)