diff --git a/CHANGELOG.md b/CHANGELOG.md index 471e36b9..bd91442b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Pre-release] - Add id as subsection for "Read Online" CTA analytics tracking +- Add: SFR-1746: Verify "read online only" toggle button on item details page ## [0.17.3] diff --git a/playwright/features/itemDetailPageElements.feature b/playwright/features/itemDetailPageElements.feature index e0b5501f..160bdd5d 100644 --- a/playwright/features/itemDetailPageElements.feature +++ b/playwright/features/itemDetailPageElements.feature @@ -2,6 +2,10 @@ Feature: Item Detail Page Elements Scenario: As a user I navigate to an item detail page and all item detail page elements are displayed Given I go to the "item detail" page + And the "search category dropdown" should be displayed + And the "homepage search box" should be displayed + And the "search button" should be displayed + And the "advanced search link" should be displayed Then the "item title" should be displayed And the "item author" should be displayed And the "item featured edition heading" should be displayed @@ -20,4 +24,9 @@ Feature: Item Detail Page Elements And the "item all editions heading" should be displayed And the "items currently available online toggle text" should be displayed And the "items currently available online toggle" should be displayed - And the "second item edition" should be displayed \ No newline at end of file + And the "second item edition" should be displayed + + Scenario: As a user when I click on "show only intems currently available online" button, only online available books should be displayed + Given I go to the "item detail" page + Then I double click the "items currently available online toggle" + And the "first read online button for all edition" should be displayed \ No newline at end of file diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts index 2aed459b..a60ebe6b 100644 --- a/playwright/support/mappings.ts +++ b/playwright/support/mappings.ts @@ -33,6 +33,7 @@ export const elements = { "Latin language checkbox": "span:text('Latin')", "publication year apply button": "#year-filter-button", "first read online button": "text=Read Online >> nth=0", + "first read online button for all edition": "text=Read Online >> nth=1", "first request button": "[href='https://www.nypl.org/research/collections/shared-collection-catalog/hold/request/b10715506-i13895605']", "English language checkbox": "span:text('English')", @@ -116,6 +117,7 @@ export const elements = { "e-reader full screen button": "[aria-label='Toggle full screen']", "e-reader back to DRB button": "//span[text()='Back to Digital Research Books']", + "not yet available text": "//div[text()='Not yet available']", }; export const inputs = { diff --git a/playwright/tests/click.spec.ts b/playwright/tests/click.spec.ts index c9be0633..533a0183 100644 --- a/playwright/tests/click.spec.ts +++ b/playwright/tests/click.spec.ts @@ -10,6 +10,14 @@ When( } ); +When( + /^I double click the "([^"]*)"$/, + async function (this: CustomWorld, elementKey: keyof typeof elements) { + const element = elements[elementKey]; + return await this.page.locator(element).dblclick(); + } +); + When( /^I select "([^"]*)" from the category dropdown$/, async function (this: CustomWorld, elementKey: keyof typeof elements) {