Skip to content

Commit 3127e77

Browse files
committed
merge changes in
2 parents c5a49c3 + bacfeff commit 3127e77

13 files changed

+71
-22
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"main-logo": {
3+
"selectorData": "about-private-browsing-logo",
4+
"strategy": "id",
5+
"groups": [
6+
"requiredForPage"
7+
]
8+
}
9+
10+
}

modules/data/panel_ui.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
]
4242
},
4343

44+
"new-private-window-option": {
45+
"selectorData": "appMenu-new-private-window-button2",
46+
"strategy": "id",
47+
"groups": []
48+
},
49+
4450
"more-tools": {
4551
"selectorData": "appMenu-more-button2",
4652
"strategy": "id",

modules/page_base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,19 @@ def wait_for_num_tabs(self, num_tabs: int) -> Page:
537537
logging.warn("Timeout waiting for the number of windows to be:", num_tabs)
538538
return self
539539

540-
def switch_to_new_tab(self):
540+
def switch_to_new_tab(self) -> Page:
541541
"""Get list of all window handles, switch to the newly opened tab"""
542542
handles = self.driver.window_handles
543543
self.driver.switch_to.window(handles[-1])
544+
return self
545+
546+
def wait_for_num_windows(self, num: int) -> Page:
547+
"""Wait for the number of open tabs + windows to equal given int"""
548+
return self.wait_for_num_tabs(num)
549+
550+
def switch_to_new_window(self) -> Page:
551+
"""Switch to newest window"""
552+
return self.switch_to_new_tab()
544553

545554
def hide_popup(self, context_menu: str, chrome=False) -> Page:
546555
"""

modules/page_object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from modules.page_object_about_logins import *
55
from modules.page_object_about_newtab import *
66
from modules.page_object_about_prefs import *
7+
from modules.page_object_about_privatebrowsing import *
78
from modules.page_object_about_profiles import *
89
from modules.page_object_about_telemetry import *
910
from modules.page_object_addons_mozilla_org import *
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from modules.page_base import BasePage
2+
3+
4+
class AboutPrivatebrowsing(BasePage):
5+
URL_TEMPLATE = "about:privatebrowsing"

modules/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def shadow_from_script():
565565
def css_selector_matches_element(
566566
self, element: Union[WebElement, ShadowRoot], selector: list
567567
) -> bool:
568-
if type(element) == ShadowRoot:
568+
if isinstance(element, ShadowRoot):
569569
return False
570570
sel = f'"{selector[1]}"'
571571
return self.driver.execute_script(

new_model.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import re
77
import sys
88

9-
SNAKE_RE = re.compile(r"^[a-z](_[a-z])*[a-z]$")
9+
SNAKE_RE = re.compile(r"^[a-z]+([_a-z][a-z])*$")
1010
PASCAL_RE = re.compile(r"^[A-Z][a-zA-Z]*[a-z]$")
1111

1212

@@ -61,20 +61,38 @@ def pascalify(snake: str) -> str:
6161

6262

6363
if __name__ == "__main__":
64+
first = True
65+
second = False
6466
while not model_type:
67+
if second:
68+
print("Please enter POM or BOM.")
6569
resp = input("What type of model is this? ")
6670
resp = resp.strip().lower()
6771
if resp not in ["pom", "bom"]:
6872
resp = None
6973
model_type = resp
74+
if second:
75+
second = False
76+
if first:
77+
first = False
78+
second = True
7079

80+
first = True
81+
second = False
7182
while not model_name:
83+
if second:
84+
print("Please enter the name in either snake_case or PascalCase.")
7285
resp = input("What is the name of the model? ")
7386
resp = resp.strip()
7487
if SNAKE_RE.match(resp):
7588
model_name = resp
7689
elif PASCAL_RE.match(resp):
7790
model_name = snakify(resp)
91+
if second:
92+
second = False
93+
if first:
94+
first = False
95+
second = True
7896

7997
model_type_name = "page" if model_type == "pom" else "browser"
8098

tests/security_and_privacy/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ def suite_id():
66
return ("5833", "Security and Privacy")
77

88

9+
@pytest.fixture()
10+
def add_prefs():
11+
return []
12+
13+
914
@pytest.fixture()
1015
def set_prefs(add_prefs: dict):
1116
"""Set prefs"""

tests/security_and_privacy/test_blocking_cryptominers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from time import sleep
22

3-
import pytest
43
from selenium.webdriver import Firefox
54

65
from modules.browser_object_navigation import Navigation
@@ -9,11 +8,6 @@
98
CRYPTOMINERS_URL = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
109

1110

12-
@pytest.fixture()
13-
def add_prefs():
14-
return []
15-
16-
1711
def test_blocking_cryptominers(driver: Firefox):
1812
# instantiate objects
1913
nav = Navigation(driver).open()

tests/security_and_privacy/test_cryptominers_blocked_and_shown_in_info_panel.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
from time import sleep
22

3-
import pytest
43
from selenium.webdriver import Firefox
54

65
from modules.browser_object_navigation import Navigation
76

87
CRYPTOMINERS_URL = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
98

109

11-
@pytest.fixture()
12-
def add_prefs():
13-
return []
14-
15-
1610
def test_cryptominers_blocked_and_shown_in_info_panel(driver: Firefox):
1711
"""
1812
C450232: Cryptominers are blocked and shown in Standard mode in the Information pannel

0 commit comments

Comments
 (0)