Skip to content

Commit 48f5c8d

Browse files
authored
Ben/win lin csv (#556)
* different flow for win and lin location selector * typo * fix input path * attempt linux key path fix * attempt linux key path fix * fix linux * fix chooser again
1 parent 78b33c3 commit 48f5c8d

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed

choose_ci_set.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def dedupe(run_list: list, slash: str) -> list:
9393
for j, entry_b in enumerate(run_list):
9494
if i == j:
9595
continue
96-
if entry_a in entry_b:
97-
removes.append(j)
96+
candidate = max((i, j))
97+
if entry_a in entry_b and candidate not in removes:
98+
removes.append(candidate)
9899

99100
removes.sort(reverse=True)
100101
for remove in removes:
@@ -112,7 +113,7 @@ def dedupe(run_list: list, slash: str) -> list:
112113
if os.environ.get("TESTRAIL_REPORT"):
113114
# Run all tests if this is a scheduled beta
114115
with open(OUTPUT_FILE, "w") as fh:
115-
print("tests")
116+
fh.write("tests")
116117
sys.exit(0)
117118

118119
slash = "/" if "/" in SCRIPT_DIR else "\\"

modules/page_object_generics.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,41 @@ class GenericPage(BasePage):
1515

1616
URL_TEMPLATE = "{url}"
1717

18-
def navigate_dialog_to_location(self, location: str) -> BasePage:
18+
def navigate_dialog_to_location(
19+
self, location: str, filename="test.txt"
20+
) -> BasePage:
1921
sleep(1.5)
2022
from pynput.keyboard import Controller, Key
2123

2224
keyboard = Controller()
23-
if self.sys_platform() == "Darwin" or self.sys_platform() == "Linux":
25+
if self.sys_platform() == "Darwin":
2426
keyboard.type("/")
2527
sleep(1.5)
2628
keyboard.type(location.lstrip("/"))
27-
else:
29+
sleep(1)
30+
keyboard.press(Key.enter)
31+
sleep(1)
32+
keyboard.press(Key.enter)
33+
elif self.sys_platform().startswith("Win"):
34+
keyboard.press(Key.ctrl)
35+
keyboard.tap("l")
36+
keyboard.release(Key.ctrl)
2837
sleep(1.5)
2938
keyboard.type(location)
30-
sleep(1)
31-
keyboard.press(Key.enter)
32-
sleep(1)
33-
keyboard.press(Key.enter)
39+
sleep(1)
40+
keyboard.tap(Key.enter)
41+
sleep(1)
42+
keyboard.press(Key.alt)
43+
keyboard.tap("s")
44+
keyboard.release(Key.alt)
45+
else:
46+
keyboard.press(Key.ctrl)
47+
keyboard.tap("a")
48+
keyboard.release(Key.ctrl)
49+
sleep(1.5)
50+
keyboard.type(f"{location}/{filename}")
51+
sleep(1)
52+
keyboard.tap(Key.enter)
3453

3554

3655
class GenericPdf(BasePage):

tests/password_manager/test_password_csv_correctness.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
from modules.page_object import AboutLogins, GenericPage
99

10+
PASSWORDS_FILE = "passwords.csv"
11+
1012

1113
@pytest.fixture()
1214
def test_case():
@@ -36,10 +38,10 @@ def test_password_csv_correctness(
3638

3739
# Export the password file
3840
time.sleep(3)
39-
page.navigate_dialog_to_location(downloads_folder)
41+
page.navigate_dialog_to_location(downloads_folder, PASSWORDS_FILE)
4042

4143
# Verify the exported csv file is present in the target folder
42-
csv_file = os.path.join(downloads_folder, "passwords.csv")
44+
csv_file = os.path.join(downloads_folder, PASSWORDS_FILE)
4345
about_logins.wait.until(lambda _: os.path.exists(csv_file))
4446

4547
# Verify the contents of the exported csv file

tests/password_manager/test_password_csv_export.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from modules.page_object import AboutLogins, GenericPage
88

9+
PASSWORDS_FILE = "passwords.csv"
10+
911

1012
@pytest.fixture()
1113
def test_case():
@@ -36,7 +38,7 @@ def test_password_csv_export(
3638

3739
# Export the password file
3840
time.sleep(3)
39-
page.navigate_dialog_to_location(downloads_folder)
41+
page.navigate_dialog_to_location(downloads_folder, PASSWORDS_FILE)
4042

4143
keyboard.tap(Key.enter)
4244

0 commit comments

Comments
 (0)