Skip to content

Commit 3c875a2

Browse files
committed
- Playwright update flows & extend coverage to kb article locale switcher
1 parent 107ead7 commit 3c875a2

File tree

10 files changed

+325
-334
lines changed

10 files changed

+325
-334
lines changed

playwright_tests/flows/ask_a_question_flows/aaq_flows/aaq_flow.py

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,17 @@ def submit_an_aaq_question(self, **kwargs):
1818

1919
# Submitting an aaq question for a product flow.
2020
# Mozilla VPN has an extra optional dropdown menu for choosing an operating system.
21-
def _submit_an_aaq_question(self,
22-
subject: str,
23-
body: str,
24-
topic_name='',
25-
attach_image=False,
26-
is_premium=False,
27-
email="",
28-
is_loginless=False,
21+
def _submit_an_aaq_question(self, subject: str, body: str, topic_name='', attach_image=False,
22+
is_premium=False, email="", is_loginless=False,
2923
expected_locator=None):
3024
question_subject = ''
3125
if is_premium:
3226
self.add_valid_data_to_all_premium_products_aaq_fields(subject, body, is_loginless,
3327
email)
3428
else:
3529
question_subject = self.add__valid_data_to_all_aaq_fields_without_submitting(
36-
subject,
37-
topic_name,
38-
body,
39-
attach_image
40-
)
30+
subject, topic_name, body, attach_image)
31+
4132
# Submitting the question.
4233
self.aaq_form_page.click_aaq_form_submit_button(expected_locator=expected_locator)
4334

@@ -88,7 +79,9 @@ def add_valid_data_to_all_premium_products_aaq_fields(self, subject: str, body:
8879
is_loginless: bool, email: str):
8980
if is_loginless:
9081
self.aaq_form_page.fill_contact_email_field(email)
82+
9183
self.aaq_form_page.select_random_topic_by_value()
84+
9285
if self.aaq_form_page.is_os_dropdown_menu_visible():
9386
self.aaq_form_page.select_random_os_by_value()
9487
self.aaq_form_page.add_text_to_premium_aaq_form_subject_field(subject)
@@ -138,10 +131,8 @@ def _editing_reply_flow(self, reply_body: str, submit_reply=True):
138131
self.aaq_form_page.clear_the_question_body_textarea_field()
139132
self.aaq_form_page.add_text_to_aaq_textarea_field(reply_body)
140133

141-
if submit_reply:
142-
self.aaq_form_page.click_on_update_answer_button()
143-
else:
144-
self.aaq_form_page.click_aaq_form_cancel_button()
134+
self.aaq_form_page.click_on_update_answer_button() if submit_reply else (
135+
self.aaq_form_page.click_aaq_form_cancel_button())
145136

146137
def delete_question_reply(self, **kwargs):
147138
return self.utilities.re_call_function_on_error(
@@ -152,22 +143,17 @@ def _delete_question_reply(self, answer_id: str, delete_reply: bool):
152143
self.question_page.click_on_reply_more_options_button(answer_id)
153144
self.question_page.click_on_delete_this_post_for_a_certain_reply(answer_id)
154145

155-
if delete_reply:
156-
self.question_page.click_delete_this_question_button()
157-
else:
158-
self.question_page.click_on_cancel_delete_button()
146+
self.question_page.click_delete_this_question_button() if delete_reply else (
147+
self.question_page.click_on_cancel_delete_button())
159148

160149
def post_question_reply_flow(self, **kwargs):
161150
return self.utilities.re_call_function_on_error(
162151
lambda: self._post_question_reply_flow(**kwargs)
163152
)
164153

165-
def _post_question_reply_flow(self,
166-
repliant_username: str,
167-
reply='',
168-
submit_reply=True,
169-
quoted_reply=False,
170-
reply_for_id='') -> str:
154+
def _post_question_reply_flow(self, repliant_username: str, reply='', submit_reply=True,
155+
quoted_reply=False, reply_for_id='') -> str:
156+
171157
if quoted_reply:
172158
self.question_page.click_on_reply_more_options_button(reply_for_id)
173159
self.question_page.click_on_quote_for_a_certain_reply(reply_for_id)

playwright_tests/flows/contributor_threads_flows/contributor_threads_flows.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ def post_a_new_thread(self, thread_title: str, thread_body: str, cancel=False) -
3737
"""
3838
if "/new" not in self.utilities.get_page_url():
3939
self.forum_discussions_page.click_on_new_thread_button()
40+
4041
self.new_thread_page.fill_title_input_field(thread_title)
4142
self.new_thread_page.fill_content_textarea_field(thread_body)
42-
if cancel:
43-
self.new_thread_page.click_on_cancel_button()
44-
else:
45-
self.new_thread_page.click_on_post_thread_button()
43+
44+
action = self.new_thread_page.click_on_cancel_button if cancel else (
45+
self.new_thread_page.click_on_post_thread_button)
46+
action()
47+
48+
if not cancel:
4649
return re.search(r'last=(\d+)', self.utilities.get_page_url()).group(1)
4750

4851
def move_thread_to_a_different_forum(self, target_forum: str):

0 commit comments

Comments
 (0)