Skip to content

Commit 459893f

Browse files
fixed tests in functional/test_submit_and_retrieve_file.py
1 parent 64e6ac9 commit 459893f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

securedrop/tests/functional/source_navigation_steps.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _source_hits_cancel_at_login_page(self):
9191
assert self._is_on_source_homepage()
9292

9393
def _source_proceeds_to_login(self):
94-
self.safe_send_keys_by_id("codename", self.source_name)
94+
self.safe_send_keys_by_id("passphrase", self.source_name)
9595
self.safe_click_by_css_selector(".form-controls button")
9696

9797
# Check that we've logged in
@@ -109,8 +109,8 @@ def _source_hits_cancel_at_submit_page(self):
109109
self.safe_click_by_css_selector(".form-controls a")
110110

111111
if not self.accept_languages:
112-
heading = self.driver.find_element_by_id("submit-heading")
113-
assert "Submit Files or Messages" == heading.text
112+
heading = self.driver.find_element_by_id("welcome-heading")
113+
assert "Welcome!" == heading.text
114114

115115
def _source_continues_to_submit_page(self, files_allowed=True):
116116
def submit_page_loaded():
@@ -127,7 +127,7 @@ def uploader_is_visible():
127127
else:
128128
assert not uploader_is_visible()
129129

130-
def _source_submits_a_file(self):
130+
def _source_submits_a_file(self, first_submission=False):
131131
with tempfile.NamedTemporaryFile() as file:
132132
file.write(self.secret_message.encode("utf-8"))
133133
file.seek(0)
@@ -138,14 +138,21 @@ def _source_submits_a_file(self):
138138

139139
self.safe_click_by_css_selector(".form-controls button")
140140

141-
def file_submitted():
141+
def file_submitted(first_submission=False):
142142
if not self.accept_languages:
143143
notification = self.driver.find_element_by_class_name("success")
144-
expected_notification = "Success!\nThanks! We received your document."
144+
if first_submission:
145+
expected_notification = "Please check back later for replies."
146+
else:
147+
expected_notification = "Success!\nThanks! We received your document."
145148
assert expected_notification in notification.text
146149

147150
# Allow extra time for file uploads
148-
self.wait_for(file_submitted, timeout=(self.timeout * 3))
151+
self.wait_for(lambda: file_submitted(first_submission), timeout=(self.timeout * 3))
152+
153+
if first_submission:
154+
codename = self.driver.find_element_by_css_selector("#codename span")
155+
self.source_name = codename.text
149156

150157
def _source_submits_a_message(
151158
self, verify_notification=False, first_submission=False, first_login=False
@@ -161,18 +168,15 @@ def message_submitted():
161168
if first_submission:
162169
codename = self.driver.find_element_by_css_selector("#codename span")
163170
self.source_name = codename.text
164-
print("First sub, source is: {}".format(self.source_name))
165171

166172
if verify_notification:
167173
first_submission_text = (
168174
"Please check back later for replies." in notification.text
169175
)
170176

171177
if first_submission:
172-
print("First sub, source is: {}".format(self.source_name))
173178
assert first_submission_text
174179
else:
175-
print("Not first sub, source is whaaat")
176180
assert not first_submission_text
177181

178182
self.wait_for(message_submitted)

securedrop/tests/functional/test_submit_and_retrieve_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_submit_and_retrieve_happy_path(self):
1212
self._source_visits_source_homepage()
1313
self._source_chooses_to_submit_documents()
1414
self._source_continues_to_submit_page()
15-
self._source_submits_a_file()
15+
self._source_submits_a_file(first_submission=True)
1616
self._source_logs_out()
1717
try:
1818
self.switch_to_firefox_driver()

0 commit comments

Comments
 (0)