diff --git a/CHANGELOG.md b/CHANGELOG.md index f23454c4..b66f43ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Upgrade to NYPL Design System 1.7.3 - Replace fireEvent with userEvent - Feedback button test PW +- SFR-1797: Remove Playwright tests with clicks on header and footer links ## [0.17.4] diff --git a/playwright/features/ReadOnlineTargets.feature b/playwright/features/ReadOnlineTargets.feature index 5048d00c..67491038 100644 --- a/playwright/features/ReadOnlineTargets.feature +++ b/playwright/features/ReadOnlineTargets.feature @@ -1,10 +1,9 @@ Feature: Read Online Link Targets Scenario: As a user I click the Read Online button on the search results page and in the item detail page and their link targets navigate to the same website - Given I go to the "search result" page + Given I go to the "search results" page When I click the "first read online button" Then the "Hathi Trust website" should be displayed - Given I go to the "work details" page + Given I go to the "item details" page When I click the "first read online button" Then the "Hathi Trust website" should be displayed - diff --git a/playwright/features/advSearch.feature b/playwright/features/advSearch.feature index b7ab9a08..5286fe70 100644 --- a/playwright/features/advSearch.feature +++ b/playwright/features/advSearch.feature @@ -1,6 +1,6 @@ Feature: Advanced Search - Scenario: As a user I search for a keyword and author and the search results contain both the keyword and author + Scenario: As a user I navigate to the advanced search page and all page elements are displayed Given I go to the "home" page When I click the "advanced search link" Then the "advanced search heading" should be displayed @@ -18,7 +18,11 @@ Feature: Advanced Search And the "date filter to field" should be displayed And the "advanced search button" should be displayed And the "advanced search clear button" should be displayed - When I fill in the "keyword search box" with "IBM 1401" + + Scenario: As a user I search for a keyword and author and the search results contain both the keyword and author + Given I go to the "home" page + When I click the "advanced search link" + And I fill in the "keyword search box" with "IBM 1401" And I fill in the "author search box" with "Laurie, Edward J." And I click the "advanced search button" Then the "keyword heading" should be displayed @@ -34,19 +38,3 @@ Feature: Advanced Search 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 - - Scenario: As as user I verify the headers and footers of Advanced Search Page - Given I go to the "home" page - When I click the "advanced search link" - And the "advanced search breadcrumb" should be displayed - And the "accessibility footer link" should be displayed - And the "press footer link" should be displayed - And the "careers footer link" should be displayed - And the "space rental footer link" should be displayed - And the "privacy footer link" should be displayed - And the "other policies footer link" should be displayed - And the "terms and conditions footer link" should be displayed - 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 diff --git a/playwright/features/drbFooters.feature b/playwright/features/drbFooters.feature index 9dc56d68..545c71cf 100644 --- a/playwright/features/drbFooters.feature +++ b/playwright/features/drbFooters.feature @@ -1,37 +1,27 @@ -Feature: As a user I want to verify all the footer links are displayed and working as expected +Feature: Footer Links - Scenario: As as user I verify the headers and footers of Advanced Search Page - Given I go to the "home" page - When I click the "advanced search link" - And the "advanced search breadcrumb" should be displayed - And the "accessibility footer link" should be displayed + Scenario: As a user I navigate to each Digital Research Books page and verify the footer links are displayed + Given I go to the <DRB> page + Then the "accessibility footer link" should be displayed And the "press footer link" should be displayed And the "careers footer link" should be displayed And the "space rental footer link" should be displayed - And the "privacy footer link" should be displayed + And the "privacy policy footer link" should be displayed And the "other policies footer link" should be displayed And the "terms and conditions footer link" should be displayed 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 "about NYPL footer link" should be displayed And the "language footer link" should be displayed - - Scenario Outline: As a user when I click on footer links I should be navigated to respective landing page - Given I go to the "home" page - Then I click the <footer link> - And the <page heading> should be displayed - Examples: - | footer link | page heading | - | "accessibility footer link" | "accessibility page heading" | - | "press footer link" | "press page heading" | - | "careers footer link" | "careers page heading" | - | "space rental footer link" | "space rental page heading" | - | "privacy footer link" | "privacy page heading" | - | "other policies footer link" | "other policies page heading" | - | "terms and conditions footer link" | "terms and conditions page heading" | - | "governance footer link" | "governance page heading" | - | "rules and regulations footer link" | "rules and regulations page heading" | - | "about footer link" | "about page heading" | - | "language footer link" | "language page heading" | \ No newline at end of file + | DRB | + | "home" | + | "advanced search" | + | "search results" | + | "item details" | + | "edition details" | + | "collection" | + | "read online" | + | "license" | + | "about" | diff --git a/playwright/features/headerLinks.feature b/playwright/features/headerLinks.feature index db3a179a..a9101ccc 100644 --- a/playwright/features/headerLinks.feature +++ b/playwright/features/headerLinks.feature @@ -1,37 +1,49 @@ Feature: Header Links - Scenario: As a user I navigate to the Digital Research Books home page and header links navigate to the correct pages (one click) - Given I go to the "home" page - When I click the <header link> - Then the <page heading> should be displayed + Scenario: As a user I navigate to each Digital Research Books page and verify the header links are displayed + Given I go to the <DRB> page + Then the "header logo" should be displayed + And the "my account header link" should be displayed + And the "locations header link" should be displayed + And the "library card header link" should be displayed + And the "email updates header link" should be displayed + And the "donate header link" should be displayed + And the "shop header link" should be displayed + And the "books music movies header link" should be displayed + And the "research header link" should be displayed + And the "education header link" should be displayed + And the "events header link" should be displayed + And the "connect header link" should be displayed + And the "give header link" should be displayed + And the "get help header link" should be displayed + And the "search header link" should be displayed - Examples: - | header link | page heading | - | "header logo" | "spotlight heading" | - | "locations header link" | "find your library page heading" | - | "library card header link" | "library card page heading" | - | "email updates header link" | "email updates page heading" | - | "donate header link" | "donate page heading" | - | "shop header link" | "shop page heading" | - | "books music movies header link" | "books music movies page heading" | - | "research header link" | "research page heading" | - | "education header link" | "education page heading" | - | "events header link" | "events page heading" | - | "connect header link" | "connect page heading" | - | "give header link" | "give page heading" | - | "get help header link" | "get help page heading" | - | "search header link" | "search header label" | - + Examples: + | DRB | + | "home" | + | "advanced search" | + | "search results" | + | "item details" | + | "edition details" | + | "collection" | + | "read online" | + | "license" | + | "about" | - Scenario: As a user I navigate to the Digital Research Books home page and header links navigate to the correct pages (two clicks) + Scenario: As a user I navigate to the Digital Research Books home page and verify the account and search header sub-links and elements are displayed Given I go to the "home" page When I click the <first header link> - And I click the <second header link> - Then the <page heading> should be displayed + Then the <second header link> should be displayed Examples: - | first header link | second header link | page heading | - | "my account header link" | "catalog header link" | "my account login form" | - | "my account header link" | "research catalog header link" | "my account login form" | - | "my account header link" | "close my account header link" | "my account header link" | - | "search header link" | "close search header link" | "search header link" | + | first header link | second header link | + | "my account header link" | "catalog header link" | + | "my account header link" | "research catalog header link" | + | "my account header link" | "close my account header link" | + | "search header link" | "search header label" | + | "search header link" | "search header text field" | + | "search header link" | "search books music movies radio button" | + | "search header link" | "search research catalog radio button" | + | "search header link" | "search library website radio button" | + | "search header link" | "search header button" | + | "search header link" | "close search header link" | diff --git a/playwright/features/homePageElements.feature b/playwright/features/homePageElements.feature index a71bd839..8b627f67 100644 --- a/playwright/features/homePageElements.feature +++ b/playwright/features/homePageElements.feature @@ -15,8 +15,7 @@ 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 - Scenario: As a user I verify feedback button is displayed on homepage + Scenario: As a user I verify the help and feedback button is displayed on the Digital Research Books home page Given I go to the "home" page - Then the "feedback and help button" should be displayed \ No newline at end of file + Then the "help and feedback button" should be displayed \ No newline at end of file diff --git a/playwright/features/itemDetailPageElements.feature b/playwright/features/itemDetailPageElements.feature index 8704a296..4ee7df77 100644 --- a/playwright/features/itemDetailPageElements.feature +++ b/playwright/features/itemDetailPageElements.feature @@ -1,7 +1,7 @@ -Feature: Item Detail Page Elements +Feature: Item Details 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 + Scenario: As a user I navigate to an item details page and all item details page elements are displayed + Given I go to the "item details" page And the "search category dropdown" should be displayed And the "homepage search box" should be displayed And the "search button" should be displayed @@ -27,7 +27,7 @@ Feature: Item Detail Page Elements And the "second item edition" should be displayed Scenario: As a user when I click on "show only items currently available online" button, only online available books should be displayed - Given I go to the "item detail" page + Given I go to the "item details" page Then I double click the "items currently available online toggle" And the "first read online button for all editions" should be displayed diff --git a/playwright/features/pub_yearFilter.feature b/playwright/features/pub_yearFilter.feature index d6f897ab..b28f0a65 100644 --- a/playwright/features/pub_yearFilter.feature +++ b/playwright/features/pub_yearFilter.feature @@ -16,4 +16,4 @@ Feature: Publication Year Filter 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 + Then only editions published between year "1800" and "1835" should be displayed \ No newline at end of file diff --git a/playwright/support/constants.ts b/playwright/support/constants.ts index 54ac5545..3d3147a8 100644 --- a/playwright/support/constants.ts +++ b/playwright/support/constants.ts @@ -1,4 +1,2 @@ -export const URL = "playwright"; // create const for the URL -export const itemDetailURL = - "work/01a28167-8c8d-4141-a32f-718539d5c8a4?featured=949699"; +export const URL = "playwright"; diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts index ba8ca52a..2aa7d3b8 100644 --- a/playwright/support/mappings.ts +++ b/playwright/support/mappings.ts @@ -1,4 +1,3 @@ -import { itemDetailURL } from "./constants"; import dotenv from "dotenv"; dotenv.config({ path: ".env.local" }); @@ -10,78 +9,100 @@ export const pages: { [name: string]: Pages } = { home: { route: "/", }, - "item detail": { - route: itemDetailURL, - }, - "search result": { + "search results": { route: "/search?query=subject%3ASub-saharan+Africa", }, - "work details": { + "item details": { route: "/work/01a28167-8c8d-4141-a32f-718539d5c8a4?featured=949699", }, + collection: { + route: "/collection/297da3a0-bcdb-4eb3-a520-a330fd8fa370", + }, + "advanced search": { + route: "/advanced-search", + }, + "edition details": { + route: "/edition/949698", + }, + about: { + route: "/about", + }, + license: { + route: "/license", + }, + "read online": { + route: "/read/4440666", + }, }; 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", - "government documents checkbox": - "span:text('Show only US government documents')", - "Latin language checkbox": "span:text('Latin')", - "Russian language checkbox": "span:text('Russian')", - "publication year apply button": "#year-filter-button", - "first read online button": "a:text('Read Online') >> nth=0", - "first read online button for all editions": "a: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')", - "first search result link": "h2 a >> nth=0", + /** home page locators */ + "site name heading": "h1:text('Digital Research Books')", + "Home breadcrumb link": "a[href='https://www.nypl.org'] > .breadcrumb-label", + "Research breadcrumb link": + "a[href='https://www.nypl.org/research'] > .breadcrumb-label", + "Digital Research Books Beta breadcrumb link": + "span.breadcrumb-label:text('Digital Research Books Beta')", + "intro text": + "span:text('Find millions of digital books for research from multiple sources')", + "collections heading": "h2:text('Recently Added Collections')", + footer: "#nypl-footer", + "help and feedback button": "button:text('Help and Feedback')", + "first collection card link": "a[href^='/collection/'] >> nth=0", + + /** home page search locators */ + "search heading": "h1:text('Search the World')", + "homepage search box": "[aria-label='Item Search']", "search category dropdown": "[aria-label='Select a search category']", keyword: "[value='keyword']", author: "[value='author']", title: "[value='title']", subject: "[value='subject']", - "keyword search box": "#search-Keyword", - "author search box": "#search-Author", - "subject search box": "#search-Subject", - "title search box": "#search-Title", - "homepage search box": "[aria-label='Item Search']", - "username field": "#code", - "password field": "#pin", - "publication year from filter": "#date-filter-from", - "publication year to filter": "#date-filter-to", + "search button": "#searchbar-button-search-bar", + "advanced search link": "[href='/advanced-search']", + + /** advanced search page locators */ "advanced search heading": "h1:text('Advanced Search')", "advanced search breadcrumb": "//a[@href='/advanced-search']", "keyword search label": "#search-Keyword-label", "author search label": "#search-Author-label", "subject search label": "#search-Subject-label", "title search label": "#search-Title-label", + "keyword search box": "#search-Keyword", + "author search box": "#search-Author", + "subject search box": "#search-Subject", + "title search box": "#search-Title", "date filter from label": "#date-filter-from-label", "date filter from field": "#date-filter-from", "date filter to label": "#date-filter-to-label", "date filter to field": "#date-filter-to", + "Russian language checkbox": "span:text('Russian')", + "advanced search button": "#submit-button", "advanced search clear button": "#reset-button", + + /** search results page locators */ "keyword heading": "h1:text('IBM 1401')", "author heading": "h1:text('Laurie, Edward J.')", - "Russian language subheader": "span: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')", - "Home breadcrumb link": "a[href='https://www.nypl.org'] > .breadcrumb-label", - "Research breadcrumb link": - "a[href='https://www.nypl.org/research'] > .breadcrumb-label", - "Digital Research Books Beta breadcrumb link": - "span.breadcrumb-label:text('Digital Research Books Beta')", - "intro text": - "span:text('Find millions of digital books for research from multiple sources')", - "search heading": "h1:text('Search the World')", - "collections heading": "h2:text('Recently Added Collections')", - footer: "#nypl-footer", - "feedback button": "button:text('Feedback')", + "first search result link": "h2 a >> nth=0", + "requestable checkbox": "text=Requestable", + "Russian language subheader": "span:text('Russian')", + "first search result subject": "a:text('Petroleum')", + "first search result title": "a:text('IBM 1401') >> nth=0", + "first search result author": + "span:text('By') > a:text('Corelli, Marie') >> nth=0", + "first search result keyword": "a:text('IBM 1401') >> nth=0", + "government documents checkbox": + "span:text('Show only US government documents')", + "first government document author": "a:text('United States') >> nth=0", + "Latin language checkbox": "span:text('Latin')", + "first search result language": "div:text('Latin') >> nth=0", + "publication year from filter": "#date-filter-from", + "publication year to filter": "#date-filter-to", + "publication year apply button": "#year-filter-button", + "first search result edition": "a:text('1900 Edition') >> nth=0", + + /** item details page locators */ "item title": "#work-title", "item author": "div:text('By') > a:text('Library of Congress')", "item featured edition heading": "#featured-edition", @@ -102,101 +123,88 @@ export const elements = { "span + span:text('Show only items currently available online')", "items currently available online toggle": "span:text('Show only items currently available online')", + "first read online button for all editions": "a:text('Read Online') >> nth=1", "second item edition": "a:text('Edition') >> nth=1", + "The Novels of Jane Austen link": + "//a[text()='The novels of Jane Austen'] >> nth=0", + "The Novels of Jane Austen heading": + "//h1[text()='The novels of Jane Austen']", + "back to search results button": "a:text('Back to search results')", + + /** log in page locators */ + "first login for options button": "text=Log in for options >> nth=0", + "username field": "#code", + "password field": "#pin", + "login button": "[value='Submit']", + + /** read online page locators */ + "first read online button": "a:text('Read Online') >> nth=0", "Hathi Trust website": "iframe[src='https://babel.hathitrust.org/cgi/pt?id=mdp.39015034622749']", - "first search result subject": "a:text('Petroleum')", - "first search result title": "a:text('IBM 1401') >> nth=0", - "first search result author": - "span:text('By') > a:text('Corelli, Marie') >> nth=0", - "first search result keyword": "a:text('IBM 1401') >> nth=0", - "first government document author": "a:text('United States') >> nth=0", - "first search result language": "div:text('Latin') >> nth=0", - "first search result edition": "a:text('1900 Edition') >> nth=0", - "first collection card link": "a[href^='/collection/'] >> nth=0", - "number of results": "#page-counter", + + /** request page locators */ + "first request button": + "[href='https://www.nypl.org/research/collections/shared-collection-catalog/hold/request/b10715506-i13895605']", + "delivery location heading": "h2:text('Choose a delivery location')", + + /** ereader locators */ "Robot Soccer title": "//a[text()='Robot soccer'] >> nth=0", "e-reader table of contents button": "[aria-label='Table of Contents']", "e-reader settings button": "[aria-label='Settings']", "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']", - "accessibility footer link": "//a[@href='http://www.nypl.org/accessibility']", - "press footer link": - "//a[@href='http://www.nypl.org/help/about-nypl/media-center']", - "careers footer link": "//a[@href='http://www.nypl.org/careers']", - "space rental footer link": "//a[@href='http://www.nypl.org/spacerental']", - "privacy footer link": - "//a[@href='http://www.nypl.org/help/about-nypl/legal-notices/privacy-policy']", - "other policies footer link": "//a[@href='http://www.nypl.org/policies']", - "terms and conditions footer link": - "//a[@href='http://www.nypl.org/terms-conditions']", - "governance footer link": - "//a[@href='http://www.nypl.org/help/about-nypl/leadership/board-trustees']", - "rules and regulations footer link": - "//a[@href='http://www.nypl.org/help/about-nypl/legal-notices/rules-and-regulations']", - "about footer link": "//a[@href='http://www.nypl.org/help/about-nypl']", - "language footer link": "//a[@href='http://www.nypl.org/language']", - "accessibility page heading": "//h1[text()='Accessibility at NYPL']", - "press page heading": "//h1[text()='Press Releases']", - "careers page heading": "//h2[text()='Careers at NYPL']", - "space rental page heading": "//h1//span[text()='Space Rental']", - "privacy page heading": - "//h1[text()='The New York Public Library Privacy Policy']", - "other policies page heading": "//h1[text()='Policies']", - "terms and conditions page heading": "//h1[text()='Terms & Conditions']", - "governance page heading": - "//h1[text()='The New York Public Library Board of Trustees']", - "rules and regulations page heading": - "//h1[text()='General Policies and Rules']", - "about page heading": "//h1[text()='About The New York Public Library']", - "language page heading": "//h1[text()='Language']", - "The Novels of Jane Austen link": - "//a[text()='The novels of Jane Austen'] >> nth=0", - "The Novels of Jane Austen heading": - "//h1[text()='The novels of Jane Austen']", - "back to search results button": "a:text('Back to search results')", + /** header locators */ "header logo": "a[aria-label='The New York Public Library']", - "spotlight heading": "a:text('Spotlight')", "my account header link": "[aria-label='My Account']", "catalog header link": "span:text('Go To The Catalog')", "research catalog header link": "span:text('Go To The Research Catalog')", "close my account header link": "[aria-label='Close']", - "my account login form": "#login", "locations header link": "[href='https://www.nypl.org/locations']", - "find your library page heading": "#location-finder__title", "library card header link": "[href='https://www.nypl.org/library-card/new']", - "library card page heading": "h1:text('Apply for a Library Card Online')", "email updates header link": "[href='https://pub.email.nypl.org/subscriptioncenter']", - "email updates page heading": "h1:text('Get the Best of NYPL in Your Inbox')", - "donate header link": - "[href='https://secure.nypl.org/site/Donation2?7825.donation=form1&df_id=7825&mfc_pref=T&s_src=FRQ18ZZ_TNN']", - "donate page heading": - "h1:text('Make Your Tax-Deductible Gift Today') >> nth=0", + "donate header link": "[href='https://www.nypl.org/donate-button']", "shop header link": "[href='https://shop.nypl.org/?utm_campaign=NYPLHeaderButton&utm_source=nypl.org&utm_medium=referral']", - "shop page heading": "[title='The New York Public Library Shop'] >> nth=0", "books music movies header link": "[href='https://www.nypl.org/books-music-movies']", - "books music movies page heading": "h1:text('Books/Music/Movies')", "research header link": "[href='https://www.nypl.org/research'] >> nth=0", - "research page heading": "h1:text('Research')", "education header link": "[href='https://www.nypl.org/education']", - "education page heading": "h1:text('Education')", "events header link": "[href='https://www.nypl.org/events']", - "events page heading": "h1:text('Events')", "connect header link": "[href='https://www.nypl.org/connect']", - "connect page heading": "h1:text('Connect')", "give header link": "[href='https://www.nypl.org/give']", - "give page heading": "h1:text('Give')", "get help header link": "[href='https://www.nypl.org/get-help']", - "get help page heading": "h1:text('Get Help')", "search header link": "#searchButton", "search header label": "#searchInput-label", + "search header text field": "#searchInput", + "search books music movies radio button": + "span:text('Search books, music, and movies')", + "search research catalog radio button": + "span:text('Search the Research Catalog')", + "search library website radio button": + "span:text('Search the library website')", + "search header button": "#search-btn", "close search header link": "[aria-label='Close Search']", + + /** footer locators */ + "accessibility footer link": "//a[@href='http://www.nypl.org/accessibility']", + "press footer link": + "//a[@href='http://www.nypl.org/help/about-nypl/media-center']", + "careers footer link": "//a[@href='http://www.nypl.org/careers']", + "space rental footer link": "//a[@href='http://www.nypl.org/spacerental']", + "privacy policy footer link": + "//a[@href='http://www.nypl.org/help/about-nypl/legal-notices/privacy-policy']", + "other policies footer link": "//a[@href='http://www.nypl.org/policies']", + "terms and conditions footer link": + "//a[@href='http://www.nypl.org/terms-conditions']", + "governance footer link": + "//a[@href='http://www.nypl.org/help/about-nypl/leadership/board-trustees']", + "rules and regulations footer link": + "//a[@href='http://www.nypl.org/help/about-nypl/legal-notices/rules-and-regulations']", + "about NYPL footer link": "//a[@href='http://www.nypl.org/help/about-nypl']", + "language footer link": "//a[@href='http://www.nypl.org/language']", }; export const inputs = { diff --git a/playwright/tests/assertions.spec.ts b/playwright/tests/assertions.spec.ts index 8da71945..b1d9fb96 100644 --- a/playwright/tests/assertions.spec.ts +++ b/playwright/tests/assertions.spec.ts @@ -22,7 +22,7 @@ Then( ); Then( - /^Then only editions published between year "([^"]*)" and ""([^"]*)" should be displayed$/, + /^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({