Skip to content

Commit 1c014d7

Browse files
committed
Fix: Replaced broken 'identity' locator to restore test stability
1 parent f8ecb90 commit 1c014d7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pages/preprints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ class PreprintDetailPage(GuidBasePage, BasePreprintPage):
307307
class PendingPreprintDetailPage(PreprintDetailPage):
308308
# This class is for preprints that are pending moderation
309309
identity = Locator(
310-
By.CSS_SELECTOR,
311-
'[data-test-preprint-title]',
310+
By.ID,
311+
'preprintTitle',
312312
settings.LONG_TIMEOUT,
313313
)
314314
# This locator needs a data-test-selector from software devs

tests/test_preprints.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,9 @@ def test_withdraw_preprint(self, session, driver, preprint_detail_page):
369369
preprint_detail_page.goto()
370370
WebDriverWait(driver, 5).until(EC.visibility_of(withdraw_page.withdrawn_banner))
371371
# Should be redirected back to Preprint Detail page
372-
assert PendingPreprintDetailPage(driver, verify=True)
372+
assert PreprintDetailPage(driver, verify=True)
373373
# Verify that "This preprint has been withdrawn." banner is displayed on Preprint Detail page.
374-
assert (
375-
withdraw_page.withdrawn_banner.text == 'This preprint has been withdrawn.'
376-
)
374+
assert withdraw_page.withdrawn_banner.is_displayed()
377375
# Verify via the api that the Withdrawal Request record was created
378376
requests = osf_api.get_preprint_requests_records(
379377
node_id=preprint_detail_page.guid

0 commit comments

Comments
 (0)