diff --git a/playwright/tests/rex-test/rex.behaviorspec.ts b/playwright/tests/rex-test/rex.behaviorspec.ts index 29b73b1a7b..54d9e5b5b2 100644 --- a/playwright/tests/rex-test/rex.behaviorspec.ts +++ b/playwright/tests/rex-test/rex.behaviorspec.ts @@ -673,4 +673,4 @@ test('C543225 canonicals for old editions point to the latest edition', async ({ await Toc.pageClick(241) // THEN: Canonical page points to latest edition of the original content expect(await bookPage.canonical()).toBe('https://openstax.org/books/principles-economics-3e/pages/d-the-expenditure-output-model') -}) +}) \ No newline at end of file diff --git a/pytest-selenium/pages/base.py b/pytest-selenium/pages/base.py index 27b9e719cd..262618d046 100644 --- a/pytest-selenium/pages/base.py +++ b/pytest-selenium/pages/base.py @@ -27,11 +27,9 @@ BOUNDING_RECTANGLE = "return arguments[0].getBoundingClientRect();" -XPATH_SEARCH = "//span[contains(text(),'{term}') and contains(@class,'search-highlight first text last focus')]" +XPATH_SEARCH = "//mark[contains(text(), '{term}') and (@aria-current='true') and (@class='search-highlight first text last')]" # If search term is inside a block of search highlight use this XPATH -XPATH_SEARCH_BLOCK = ( - "//span[contains(@class,'search-highlight text last focus') and contains(text(),'{term}')]" -) +XPATH_SEARCH_BLOCK = "//mark[contains(text(), '{term}') and (@aria-current='true') and (@class='search-highlight text last')]" class Page(pypom.Page): @@ -62,6 +60,9 @@ def open(self): self.driver.add_cookie({"name": "nudge_study_guides_counter", "value": "1"}) self.driver.add_cookie({"name": "nudge_study_guides_page_counter", "value": "1"}) self.driver.add_cookie({"name": "nudge_study_guides_date", "value": current_date}) + self.driver.add_cookie({"name": "content-warning-545", "value": "true"}) + self.driver.add_cookie({"name": "content-warning-548", "value": "true"}) + self.driver.add_cookie({"name": "content-warning-549", "value": "true"}) self.driver.add_cookie({"name": "ANALYTICS_OPT_OUT", "value": "1"}) return self diff --git a/pytest-selenium/regions/my_highlights.py b/pytest-selenium/regions/my_highlights.py index 4b53da5b89..ddceb3379d 100644 --- a/pytest-selenium/regions/my_highlights.py +++ b/pytest-selenium/regions/my_highlights.py @@ -582,8 +582,8 @@ def remove_tag(self) -> MyHighlights: class Highlights(Region): """The modal body containing the filtered list of highlights.""" - _chapter_locator = (By.XPATH, "//div[@data-testid='chapter-title']") - _section_locator = (By.XPATH, "//div[@data-testid='section-title']") + _chapter_locator = (By.XPATH, "//h2[@data-testid='chapter-title']") + _section_locator = (By.XPATH, "//h3[@data-testid='section-title']") _no_results_message_locator = (By.CSS_SELECTOR, "[class*=GeneralTextWrapper]") _highlight_locator = (By.CSS_SELECTOR, "[class*=HighlightOuterWrapper]") _empty_state_nudge_locator = (By.CSS_SELECTOR, "[class*=MyHighlightsWrapper]") @@ -1041,11 +1041,11 @@ class Section(ChapterData): """A chapter section with highlights.""" _number_locator = ( - By.CSS_SELECTOR, "div:first-child .os-number") + By.CSS_SELECTOR, "h3:first-child .os-number") _highlight_locator = ( By.XPATH, "./following-sibling::div//div[@data-highlight-id]") _title_locator = ( - By.CSS_SELECTOR, "div:first-child .os-text") + By.CSS_SELECTOR, "h3:first-child .os-text") @property def highlights(self) -> List[Highlight]: diff --git a/pytest-selenium/regions/search_sidebar.py b/pytest-selenium/regions/search_sidebar.py index a59cec46bb..39943926ed 100644 --- a/pytest-selenium/regions/search_sidebar.py +++ b/pytest-selenium/regions/search_sidebar.py @@ -23,7 +23,7 @@ class SearchSidebar(Region): _search_result_locator = (By.CSS_SELECTOR, "[data-testid$=result]") _search_results_sidebar_locator = ( By.XPATH, - "//div[@data-testid = 'search-results-sidebar']/div[2]", + "//div[@data-testid = 'search-results-sidebar']/nav", ) # fmt: off diff --git a/pytest-selenium/tests/test_search.py b/pytest-selenium/tests/test_search.py index 2bc30e8f31..3123dfc279 100644 --- a/pytest-selenium/tests/test_search.py +++ b/pytest-selenium/tests/test_search.py @@ -525,9 +525,7 @@ def test_highlight_entire_search_element(selenium, base_url, book_slug, page_slu book.assert_search_term_is_highlighted_in_content_page(search_term) # THEN: Entire search element is highlighted in content page - xpath_search_block = ( - "//span[contains(@class,'search-highlight text last focus')][contains(text(),'{term}')]" - ) + xpath_search_block = "//mark[contains(text(), '{term}') and (@aria-current='true') and (@class='search-highlight text last')]" focussed_search_term = book.find_elements(By.XPATH, xpath_search_block.format(term=search_term)) try: diff --git a/pytest-selenium/utils/books.json b/pytest-selenium/utils/books.json index 8813683f98..e4cdaccd6e 100644 --- a/pytest-selenium/utils/books.json +++ b/pytest-selenium/utils/books.json @@ -50,7 +50,7 @@ "biology-2e": { "default_page": "1-introduction", "search_term": "evolution theory", - "chapter_search_results_total": 341, + "chapter_search_results_total": 344, "rkt_search_results_total": 0 }, "biology-ap-courses": { @@ -140,7 +140,7 @@ "calculus-volume-3": { "default_page": "1-introduction", "search_term": "zero vector", - "chapter_search_results_total": 9, + "chapter_search_results_total": 10, "rkt_search_results_total": 1 }, "college-success": { @@ -416,7 +416,7 @@ "introductory-statistics-2e": { "default_page": "1-introduction", "search_term": "Student's t-Distribution", - "chapter_search_results_total": 43, + "chapter_search_results_total": 45, "rkt_search_results_total": 2 }, "introductory-business-statistics-2e": { @@ -459,7 +459,7 @@ "default_page": "1-introduction", "search_term": "population health", "chapter_search_results_total": 3689, - "rkt_search_results_total": 11 + "rkt_search_results_total": 12 }, "nutrition": { "default_page": "1-introduction", @@ -471,7 +471,19 @@ "default_page": "1-introduction", "search_term": "mental health", "chapter_search_results_total": 2674, - "rkt_search_results_total": 4 + "rkt_search_results_total": 5 + }, + "maternal-newborn-nursing": { + "default_page": "1-introduction", + "search_term": "newborn babies", + "chapter_search_results_total": 446, + "rkt_search_results_total": 0 + }, + "clinical-nursing-skills": { + "default_page": "1-introduction", + "search_term": "clinical nursing skills", + "chapter_search_results_total": 118, + "rkt_search_results_total": 1 } }