Skip to content

Commit 8c6c388

Browse files
authored
Merge pull request #122 from mozilla/as/history-exclude-private-sessions
As/empty history state in normal session for PB sites
2 parents a6feeb7 + 828a924 commit 8c6c388

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

modules/browser_object_panel_ui.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,12 @@ def open_private_window(self) -> BasePage:
141141
with self.driver.context(self.driver.CONTEXT_CHROME):
142142
self.get_element("panel-ui-new-private-window").click()
143143
return self
144+
145+
def open_history_menu(self) -> BasePage:
146+
"""
147+
Opens the History menu
148+
"""
149+
self.open_panel_menu()
150+
with self.driver.context(self.driver.CONTEXT_CHROME):
151+
self.get_element("panel-ui-history").click()
152+
return self

modules/data/panel_ui.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@
125125
"selectorData": "appMenu-new-private-window-button2",
126126
"strategy": "id",
127127
"groups": []
128+
},
129+
130+
"recent-history-content": {
131+
"selectorData": "#appMenu_historyMenu .toolbarbutton-text",
132+
"strategy": "css",
133+
"groups": []
128134
}
129135

130136
}
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_panel_ui import PanelUi
5+
6+
YOUTUBE_URL = "https://www.youtube.com/"
7+
FACEBOOK_URL = "https://www.facebook.com/"
8+
AMAZON_URL = "https://www.amazon.com/"
9+
10+
11+
@pytest.fixture()
12+
def add_prefs():
13+
return []
14+
15+
16+
def test_websites_visited_in_private_browser_not_displayed_in_history(driver: Firefox):
17+
"""
18+
C101663 - Verify the visited websites from the Private Browsing session are not displayed inside the normal session
19+
History menu
20+
"""
21+
22+
initial_window_handle = driver.current_window_handle
23+
24+
panel_ui = PanelUi(driver).open()
25+
panel_ui.open_private_window()
26+
panel_ui.switch_to_new_window()
27+
28+
driver.get(YOUTUBE_URL)
29+
driver.get(FACEBOOK_URL)
30+
driver.get(AMAZON_URL)
31+
32+
driver.switch_to.window(initial_window_handle)
33+
34+
panel_ui.open_history_menu()
35+
with panel_ui.driver.context(panel_ui.driver.CONTEXT_CHROME):
36+
empty_label = panel_ui.get_element("recent-history-content").get_attribute(
37+
"value"
38+
)
39+
assert (
40+
empty_label == "(Empty)"
41+
), f"Expected history to be empty, but found '{empty_label}'"

0 commit comments

Comments
 (0)