@@ -2130,3 +2130,189 @@ def test_voting_the_same_article_twice_is_not_possible(page: Page, context: Brow
2130
2130
utilities .user_secrets_accounts ["TEST_ACCOUNT_MODERATOR" ]
2131
2131
))
2132
2132
sumo_pages .kb_article_deletion_flow .delete_kb_article ()
2133
+
2134
+
2135
+ # C3065908 C3065909
2136
+ @pytest .mark .kbArticleCreationAndAccess
2137
+ def test_adding_and_removing_related_documents (page : Page ):
2138
+ utilities = Utilities (page )
2139
+ sumo_pages = SumoPages (page )
2140
+ test_articles_url = []
2141
+ test_article_titles = []
2142
+
2143
+ with allure .step ("Signing in with an admin account" ):
2144
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2145
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_MODERATOR" ]
2146
+ ))
2147
+
2148
+ with allure .step ("Creating 3 test articles" ):
2149
+ counter = 1
2150
+ while counter <= 3 :
2151
+ article_info = sumo_pages .submit_kb_article_flow .kb_article_creation_via_api (
2152
+ page = page , product = "19" , topic = "507" , approve_revision = True )
2153
+ test_article_titles .append (article_info ["article_title" ])
2154
+ test_articles_url .append (article_info ["article_url" ])
2155
+ counter += 1
2156
+
2157
+ with allure .step ("Wait for ~1 minute until the kb article is available in search" ):
2158
+ utilities .wait_for_given_timeout (90000 )
2159
+
2160
+ with allure .step (f"Navigating to the f{ test_article_titles [0 ]} and adding the rest as related "
2161
+ f"documents" ):
2162
+ utilities .navigate_to_link (test_articles_url [0 ])
2163
+ sumo_pages .edit_article_metadata_flow .edit_article_metadata (
2164
+ related_documents = test_article_titles [1 :]
2165
+ )
2166
+
2167
+ with check , allure .step ("Verifying that the related documents are successfully displayed "
2168
+ "inside the 'Related Articles' section" ):
2169
+ check .equal (
2170
+ set (test_article_titles [1 :]),
2171
+ set (sumo_pages .kb_article_page .get_list_of_related_articles ())
2172
+ )
2173
+
2174
+ with check , allure .step (f"Clicking on the f{ test_article_titles [1 ]} related document and "
2175
+ f"verifying that the article is listed inside the 'Related Articles' "
2176
+ f"section" ):
2177
+ sumo_pages .kb_article_page .click_on_related_article_card (test_article_titles [1 ])
2178
+ check .is_in (
2179
+ test_article_titles [0 ],
2180
+ sumo_pages .kb_article_page .get_list_of_related_articles ()
2181
+ )
2182
+
2183
+ with allure .step (f"Navigating back to the f{ test_article_titles [0 ]} , clicking on the "
2184
+ f"'Edit Article Metadata' and removing one of the related documents" ):
2185
+ sumo_pages .kb_article_page .click_on_related_article_card (test_article_titles [0 ])
2186
+ sumo_pages .kb_article_page .click_on_edit_article_metadata ()
2187
+ sumo_pages .kb_article_edit_article_metadata_page .remove_related_document (
2188
+ test_article_titles [1 ])
2189
+ sumo_pages .kb_article_edit_article_metadata_page .click_on_save_changes_button ()
2190
+
2191
+ with allure .step (f"Verifying that the f{ test_article_titles [1 ]} is no longer listed inside "
2192
+ "'Related Articles' section" ):
2193
+ check .is_not_in (
2194
+ test_article_titles [1 ],
2195
+ sumo_pages .kb_article_page .get_list_of_related_articles ()
2196
+ )
2197
+
2198
+ with check , allure .step (f"Navigating to the f{ test_article_titles [1 ]} page and verifying that "
2199
+ f"the f{ test_article_titles [0 ]} is not listed inside the "
2200
+ f"'Related documents' section" ):
2201
+ utilities .navigate_to_link (test_articles_url [1 ])
2202
+ check .is_false (
2203
+ sumo_pages .kb_article_page .is_related_articles_section_displayed ()
2204
+ )
2205
+
2206
+ with allure .step ("Deleting all test articles" ):
2207
+ for article in test_articles_url :
2208
+ utilities .navigate_to_link (article )
2209
+ sumo_pages .kb_article_deletion_flow .delete_kb_article ()
2210
+
2211
+
2212
+ # C3059081
2213
+ @pytest .mark .kbArticleCreationAndAccess
2214
+ def test_same_article_cannot_be_added_as_related_article (page : Page ):
2215
+ utilities = Utilities (page )
2216
+ sumo_pages = SumoPages (page )
2217
+
2218
+ with allure .step ("Signing in with an admin account" ):
2219
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2220
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_MODERATOR" ]
2221
+ ))
2222
+
2223
+ with allure .step ("Creating a new KB article" ):
2224
+ article_info = sumo_pages .submit_kb_article_flow .kb_article_creation_via_api (
2225
+ page = page , product = "19" , topic = "507" , approve_revision = True )
2226
+
2227
+ with allure .step ("Wait for ~1 minute until the kb article is available in search" ):
2228
+ utilities .wait_for_given_timeout (90000 )
2229
+
2230
+ with check , allure .step ("Clicking on the 'Edit Article Metadata' option and verifying that "
2231
+ "the same article cannot be added inside the 'Related documents' "
2232
+ "field" ):
2233
+ sumo_pages .kb_article_page .click_on_edit_article_metadata ()
2234
+ sumo_pages .kb_article_edit_article_metadata_page .add_related_documents (
2235
+ article_info ["article_title" ], submit = False )
2236
+ utilities .wait_for_given_timeout (2000 )
2237
+ check .is_true (
2238
+ sumo_pages .kb_article_edit_article_metadata_page .is_no_related_documents_displayed ()
2239
+ )
2240
+
2241
+ with allure .step ("Deleting the KB article" ):
2242
+ utilities .navigate_to_link (article_info ["article_url" ])
2243
+ sumo_pages .kb_article_deletion_flow .delete_kb_article ()
2244
+
2245
+
2246
+ # C3065910
2247
+ @pytest .mark .kbArticleCreationAndAccess
2248
+ def test_restricted_visibility_related_document_in_article_page (page : Page ):
2249
+ utilities = Utilities (page )
2250
+ sumo_pages = SumoPages (page )
2251
+ test_articles_url = []
2252
+ test_article_titles = []
2253
+
2254
+ with allure .step ("Signing in with an admin account" ):
2255
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2256
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_MODERATOR" ]
2257
+ ))
2258
+
2259
+ with allure .step ("Creating 3 new articles" ):
2260
+ counter = 1
2261
+ while counter <= 3 :
2262
+ article_info = sumo_pages .submit_kb_article_flow .kb_article_creation_via_api (
2263
+ page = page , product = "19" , topic = "507" , approve_revision = True )
2264
+ test_article_titles .append (article_info ["article_title" ])
2265
+ test_articles_url .append (article_info ["article_url" ])
2266
+ counter += 1
2267
+
2268
+ with allure .step ("Wait for ~1 minute until the kb article is available in search" ):
2269
+ utilities .wait_for_given_timeout (90000 )
2270
+
2271
+ with allure .step (f"Navigating to the article: f{ test_article_titles [1 ]} and "
2272
+ f"restricting the visibility of the article to 'Mobile' group" ):
2273
+ utilities .navigate_to_link (test_articles_url [1 ])
2274
+ sumo_pages .edit_article_metadata_flow .edit_article_metadata (single_group = "Mobile" )
2275
+
2276
+ with allure .step (f"Navigating to the: f{ test_article_titles [0 ]} article and adding the rest "
2277
+ f"of test articles as related documents" ):
2278
+ utilities .navigate_to_link (test_articles_url [0 ])
2279
+ sumo_pages .kb_article_page .click_on_edit_article_metadata ()
2280
+ sumo_pages .edit_article_metadata_flow .edit_article_metadata (
2281
+ related_documents = test_article_titles [1 :]
2282
+ )
2283
+
2284
+ with allure .step ("Signing in with a users that doesn't belong to the 'Mobile' group" ):
2285
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2286
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_12" ]
2287
+ ))
2288
+
2289
+ with check , allure .step ("Verifying that the article is not displayed inside the 'Related "
2290
+ "Documents' section" ):
2291
+ utilities .navigate_to_link (test_articles_url [0 ])
2292
+ check .is_not_in (
2293
+ test_article_titles [1 ],
2294
+ sumo_pages .kb_article_page .get_list_of_related_articles ()
2295
+ )
2296
+
2297
+ with check , allure .step (f"Signing in with the account that is part of the 'Mobile' group"
2298
+ f"group, navigating to the f{ test_article_titles [0 ]} article and "
2299
+ f"verifying that the restricted visibility article is now visible in "
2300
+ f"the 'Related Documents' section" ):
2301
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2302
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_13" ]
2303
+ ))
2304
+ utilities .navigate_to_link (test_articles_url [0 ])
2305
+ check .is_in (
2306
+ test_article_titles [1 ],
2307
+ sumo_pages .kb_article_page .get_list_of_related_articles ()
2308
+ )
2309
+
2310
+ with allure .step ("Deleting all test articles" ):
2311
+ with allure .step ("Signing in with an admin account" ):
2312
+ utilities .start_existing_session (utilities .username_extraction_from_email (
2313
+ utilities .user_secrets_accounts ["TEST_ACCOUNT_MODERATOR" ]
2314
+ ))
2315
+
2316
+ for article in test_articles_url :
2317
+ utilities .navigate_to_link (article )
2318
+ sumo_pages .kb_article_deletion_flow .delete_kb_article ()
0 commit comments