From eff9722f8c8ebf4cdd513d4dba3298e8a890b020 Mon Sep 17 00:00:00 2001 From: ayan <100955969+ayan1229@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:22:29 -0400 Subject: [PATCH] SFR-1743/advance-search-language-filter (#424) * SFR-1743/advance-search-language-filter * change the button mapping at feature file --- CHANGELOG.md | 1 + playwright/features/advSearch.feature | 12 +++++++++++- playwright/support/mappings.ts | 5 ++++- playwright/tests/assertions.spec.ts | 8 ++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd91442b..bebcca20 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-1743: Verify advance search filters for DRB - Add: SFR-1746: Verify "read online only" toggle button on item details page ## [0.17.3] diff --git a/playwright/features/advSearch.feature b/playwright/features/advSearch.feature index 0340ebca..0e43be54 100644 --- a/playwright/features/advSearch.feature +++ b/playwright/features/advSearch.feature @@ -23,4 +23,14 @@ Feature: Advanced Search And I click the "advanced search button" Then the "keyword heading" should be displayed And the "author heading" should be displayed - And the "search result link" should be displayed \ No newline at end of file + And the "search result link" should be displayed + + Scenario: As a user I select a language checkbox in advance search and verify the search results + Given I go to the "home" page + When I click the "advanced search link" + Then I fill in the "keyword search box" with "Jane Austen" + And I click the "Russian language checkbox" + And I click the "advanced search button" + Then the "russian language subheader" should be displayed + And the "russian language checkbox" should be checked + And the "first read online button" should be displayed \ No newline at end of file diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts index a60ebe6b..d4b4f1c6 100644 --- a/playwright/support/mappings.ts +++ b/playwright/support/mappings.ts @@ -30,7 +30,8 @@ export const elements = { "first login for options button": "text=Log in for options >> nth=0", "government documents checkbox": "span:text('Show only US government documents')", - "Latin language checkbox": "span:text('Latin')", + "Latin language checkbox": "`span:text('Latin')`", + "Russian language checkbox": "span:text('Russian')", "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", @@ -64,6 +65,7 @@ export const elements = { "advanced search clear button": "#reset-button", "keyword heading": "h1:text('IBM 1401')", "author heading": "h1:text('Laurie, Edward J.')", + "russian language subheader": "//div[contains(text(),'Russian')]", "search result link": "a:text('Computers and how they work')", "delivery location heading": "h2:text('Choose a delivery location')", "site name heading": "h1:text('Digital Research Books')", @@ -134,4 +136,5 @@ export const inputs = { "1900": "1900", 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 6810d417..16918547 100644 --- a/playwright/tests/assertions.spec.ts +++ b/playwright/tests/assertions.spec.ts @@ -12,3 +12,11 @@ Then( }); } ); + +Then( + /^the "([^"]*)" should be checked$/, + async function (this: CustomWorld, elementKey: keyof typeof elements) { + const element = elements[elementKey]; + return expect(this.page.locator(element).isChecked()).toBeTruthy(); + } +);