@@ -328,7 +328,6 @@ def test_edit_preprint(self, session, driver, preprint_detail_page):
328
328
assert tag_found
329
329
330
330
@markers .dont_run_on_prod
331
- @pytest .mark .xfail (reason = 'https://openscience.atlassian.net/browse/ENG-6065' )
332
331
def test_withdraw_preprint (self , session , driver , preprint_detail_page ):
333
332
"""Test the Withdraw Preprint functionality. Using the preprint_detail_page
334
333
fixture we start on the Preprint Detail page for an api created preprint. Then
@@ -340,9 +339,11 @@ def test_withdraw_preprint(self, session, driver, preprint_detail_page):
340
339
user in the OSF admin app. The best we can do here is to verify through the api
341
340
that the withdrawal request record is created.
342
341
"""
343
- assert PreprintDetailPage (driver , verify = True )
344
- preprint_detail_page .edit_preprint_button .click ()
345
342
edit_page = PreprintEditPage (driver )
343
+ assert PreprintDetailPage (driver , verify = True )
344
+ preprint_node = preprint_detail_page .url [len (settings .OSF_HOME ) + 1 :]
345
+ osf_api .accept_moderated_preprint (session = None , preprint_node = preprint_node )
346
+ preprint_detail_page .goto ()
346
347
WebDriverWait (driver , 5 ).until (
347
348
EC .element_to_be_clickable (
348
349
(By .CSS_SELECTOR , '[data-test-withdrawal-button]' )
@@ -363,8 +364,14 @@ def test_withdraw_preprint(self, session, driver, preprint_detail_page):
363
364
)
364
365
assert withdraw_page .request_withdrawal_button .is_enabled ()
365
366
withdraw_page .request_withdrawal_button .click ()
367
+ preprint_id = osf_api .get_preprint_id (session = None , preprint_node = preprint_node )
368
+ osf_api .accept_withdraw_preprint (session = None , preprint_id = preprint_id )
369
+ preprint_detail_page .goto ()
370
+ WebDriverWait (driver , 5 ).until (EC .visibility_of (withdraw_page .withdrawn_banner ))
366
371
# Should be redirected back to Preprint Detail page
367
- assert PendingPreprintDetailPage (driver , verify = True )
372
+ assert PreprintDetailPage (driver , verify = True )
373
+ # Verify that "This preprint has been withdrawn." banner is displayed on Preprint Detail page.
374
+ assert withdraw_page .withdrawn_banner .is_displayed ()
368
375
# Verify via the api that the Withdrawal Request record was created
369
376
requests = osf_api .get_preprint_requests_records (
370
377
node_id = preprint_detail_page .guid
@@ -374,7 +381,7 @@ def test_withdraw_preprint(self, session, driver, preprint_detail_page):
374
381
record_found = False
375
382
for request in requests :
376
383
if request ['attributes' ]['request_type' ] == 'withdrawal' :
377
- assert request ['attributes' ]['machine_state' ] == 'pending '
384
+ assert request ['attributes' ]['machine_state' ] == 'accepted '
378
385
record_found = True
379
386
break
380
387
if not record_found :
0 commit comments