|
4 | 4 | from modules.browser_object import ContextMenu, TabBar |
5 | 5 |
|
6 | 6 |
|
| 7 | +TABS_TO_OPEN = 4 |
| 8 | +FIRST_URL = "about:about" |
| 9 | +SECOND_URL = "about:robots" |
| 10 | + |
7 | 11 | @pytest.fixture() |
8 | 12 | def test_case(): |
9 | 13 | return "134648" |
10 | 14 |
|
11 | 15 |
|
12 | 16 | def test_reopen_tab_through_context_menu(driver: Firefox): |
13 | 17 | """C134648: Reopen tab through context menu""" |
| 18 | + |
| 19 | + # Instantiate objects |
14 | 20 | tabs = TabBar(driver) |
15 | 21 | tab_context_menu = ContextMenu(driver) |
16 | 22 |
|
17 | | - tabs_to_open = 4 |
18 | | - |
19 | | - driver.get("about:about") |
20 | | - for _ in range(1, tabs_to_open): |
| 23 | + # Open several different tabs and close them |
| 24 | + driver.get(FIRST_URL) |
| 25 | + for _ in range(1, TABS_TO_OPEN): |
21 | 26 | tabs.new_tab_by_button() |
22 | 27 | driver.switch_to.window(driver.window_handles[-1]) |
23 | | - driver.get("about:robots") |
| 28 | + driver.get(SECOND_URL) |
24 | 29 | remaining_tab = tabs.get_tab(1) |
25 | | - closing_tab = tabs.get_tab(tabs_to_open) |
| 30 | + closing_tab = tabs.get_tab(TABS_TO_OPEN) |
26 | 31 |
|
27 | | - with driver.context(driver.CONTEXT_CHROME): |
28 | | - assert tabs.get_tab_title(closing_tab).startswith("Gort") |
| 32 | + assert tabs.get_tab_title(closing_tab).startswith("Gort") |
29 | 33 |
|
30 | 34 | driver.close() |
31 | 35 | driver.switch_to.window(driver.window_handles[0]) |
32 | 36 |
|
| 37 | + # Right click on the remaining tab and reopen previously closed tab |
33 | 38 | tabs.context_click(remaining_tab) |
34 | 39 | tab_context_menu.click_and_hide_menu("context-menu-reopen-closed-tab") |
35 | 40 |
|
36 | | - reopened_tab = tabs.get_tab(tabs_to_open + 1) |
| 41 | + reopened_tab = tabs.get_tab(TABS_TO_OPEN + 1) |
37 | 42 | assert tabs.get_tab_title(reopened_tab).startswith("Gort") |
0 commit comments