Skip to content

Commit

Permalink
Merge pull request #425 from NYPL/SFR-1746/item_details_page_toggle_b…
Browse files Browse the repository at this point in the history
…utton

Sfr 1746/item details page toggle button
  • Loading branch information
ayan1229 authored Aug 3, 2023
2 parents 78edac4 + f553f6b commit 26dd8bf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
11 changes: 10 additions & 1 deletion playwright/features/itemDetailPageElements.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
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
2 changes: 2 additions & 0 deletions playwright/support/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')",
Expand Down Expand Up @@ -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 = {
Expand Down
8 changes: 8 additions & 0 deletions playwright/tests/click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

1 comment on commit 26dd8bf

@vercel
Copy link

@vercel vercel bot commented on 26dd8bf Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.