diff --git a/CHANGELOG.md b/CHANGELOG.md index fb67bc34..f23454c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Replace Template components with TemplateAppContainer and DrbBreakout to reduce repeat components - Upgrade to NYPL Design System 1.7.3 - Replace fireEvent with userEvent +- Feedback button test PW ## [0.17.4] diff --git a/playwright/features/advSearch.feature b/playwright/features/advSearch.feature index f4aa9266..b7ab9a08 100644 --- a/playwright/features/advSearch.feature +++ b/playwright/features/advSearch.feature @@ -49,4 +49,4 @@ Feature: Advanced Search And the "governance footer link" should be displayed And the "rules and regulations footer link" should be displayed And the "about footer link" should be displayed - And the "language footer link" should be displayed \ No newline at end of file + And the "language footer link" should be displayed diff --git a/playwright/features/homePageElements.feature b/playwright/features/homePageElements.feature index 4ef37866..a71bd839 100644 --- a/playwright/features/homePageElements.feature +++ b/playwright/features/homePageElements.feature @@ -15,4 +15,8 @@ Feature: Home Page Elements And the "collections heading" should be displayed And the "first collection card link" should be displayed And the "footer" should be displayed - And the "feedback button" should be displayed \ No newline at end of file + And the "feedback button" should be displayed + + Scenario: As a user I verify feedback button is displayed on homepage + Given I go to the "home" page + Then the "feedback and help button" should be displayed \ No newline at end of file diff --git a/playwright/features/pub_yearFilter.feature b/playwright/features/pub_yearFilter.feature index f0e1d4fc..d6f897ab 100644 --- a/playwright/features/pub_yearFilter.feature +++ b/playwright/features/pub_yearFilter.feature @@ -7,4 +7,13 @@ Feature: Publication Year Filter And I fill in the "publication year from filter" with "1900" And I fill in the "publication year to filter" with "1900" And I click the "publication year apply button" - Then the "first search result edition" should be displayed \ No newline at end of file + Then the "first search result edition" should be displayed + + Scenario: As a user I filter by publication years and verify the search results + Given I go to the "home" page + When I fill in the "homepage search box" with "Jane Austen" + And I click the "search button" + And I fill in the "publication year from filter" with "1800" + And I fill in the "publication year to filter" with "1835" + And I click the "publication year apply button" + Then only published between year "1800" and "1835" should be displayed \ No newline at end of file diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts index 62d2457a..ba8ca52a 100644 --- a/playwright/support/mappings.ts +++ b/playwright/support/mappings.ts @@ -25,6 +25,7 @@ export const elements = { "advanced search link": "[href='/advanced-search']", "advanced search button": "#submit-button", "search button": "#searchbar-button-search-bar", + "feedback and help button": "//button[@id='open']", "requestable checkbox": "text=Requestable", "login button": "[value='Submit']", "first login for options button": "text=Log in for options >> nth=0", @@ -210,6 +211,8 @@ export const inputs = { swimming: "swimming", "New York": "New York", "1900": "1900", + "1800": "1800", + "1835": "1835", petroleum: "petroleum", "Robot Soccer": "Robot Soccer", "Jane Austen": "Jane Austen", diff --git a/playwright/tests/assertions.spec.ts b/playwright/tests/assertions.spec.ts index 16918547..8da71945 100644 --- a/playwright/tests/assertions.spec.ts +++ b/playwright/tests/assertions.spec.ts @@ -20,3 +20,13 @@ Then( return expect(this.page.locator(element).isChecked()).toBeTruthy(); } ); + +Then( + /^Then only editions published between year "([^"]*)" and ""([^"]*)" should be displayed$/, + async function (this: CustomWorld, elementKey: keyof typeof elements) { + const element = elements[elementKey]; + return expect(this.page.locator(element)).toBeVisible({ + timeout: 50000, + }); + } +);