Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/express-4.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
staxly[bot] authored Aug 16, 2024
2 parents 25cc6eb + 8ae0316 commit ffcce13
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion playwright/tests/rex-test/rex.behaviorspec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
9 changes: 5 additions & 4 deletions pytest-selenium/pages/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions pytest-selenium/regions/my_highlights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion pytest-selenium/regions/search_sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions pytest-selenium/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 17 additions & 5 deletions pytest-selenium/utils/books.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand All @@ -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
}
}

0 comments on commit ffcce13

Please sign in to comment.