Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions e2e_tests/e2e/osweb/test_osweb_homepage_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import pytest

from e2e_tests.e2e.ui.pages.home import HomeRex


@pytest.mark.asyncio
async def test_osweb_homepage_interested_link(chrome_page, base_url):

# GIVEN: Playwright, chromium and the rex_base_url

# WHEN: The Home page is fully loaded
await chrome_page.goto(base_url)
home = HomeRex(chrome_page)

# THEN: I'm interested page opens
await home.click_interested_link()

assert "interest" in chrome_page.url

await home.click_iam_dropdown_in_interested()

assert await home.iam_dropdown_list_item.is_visible()

await home.iam_dropdown_list_item.click()

assert await home.iam_form_page.is_visible()


@pytest.mark.asyncio
async def test_osweb_homepage_try_assignable_link(chrome_page, base_url):

# GIVEN: Playwright, chromium and the rex_base_url

# WHEN: The Home page is fully loaded
await chrome_page.goto(base_url)
home = HomeRex(chrome_page)

# THEN: Try OpenStax Assignable page opens
await home.click_try_assignable_link()

assert "assignable" in chrome_page.url

if "staging" not in chrome_page.url:
# THEN: Number of books available in assignables is 31 (as of Feb. 2026)
assert await home.available_book_list() >= 31
36 changes: 32 additions & 4 deletions e2e_tests/e2e/ui/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,38 @@ async def osweb_homepage_content_sections(self):
async def upper_menu_options(self):
return await self.page.locator("div > nav > menu.container > li").count()

@pytest.mark.asyncio
async def click_interested_link(self):
interested_locator = self.page.get_by_role("link", name="I'm interested!")
await interested_locator.scroll_into_view_if_needed()
await interested_locator.click()

@pytest.mark.asyncio
async def click_iam_dropdown_in_interested(self):
# I am a... dropdown in Interested page
iam_locator = self.page.get_by_role("combobox")
await iam_locator.scroll_into_view_if_needed()
await iam_locator.click()

@property
def iam_dropdown_list_item(self):
return self.page.get_by_role("option", name="Administrator")

@property
def iam_form_page(self):
return self.page.get_by_label("School name")

@pytest.mark.asyncio
async def click_try_assignable_link(self):
try_locator = self.page.get_by_text("Try OpenStax Assignable")
await try_locator.scroll_into_view_if_needed()
await try_locator.click()

async def available_book_list(self):
return (
await self.page.locator(".course-list").first.locator("div > div").count()
)

# Subjects homepage

@pytest.mark.asyncio
Expand Down Expand Up @@ -385,10 +417,6 @@ async def highlight_box_trash_icon_is_visible(self):
async def click_highlight_box_trash_icon(self):
await self.page.get_by_label("Deselect current highlight").click()

@pytest.mark.asyncio
async def oneclick_highlight_infobox(self):
await self.page.get_by_label("Edit highlighted note").click()

@property
def highlight_infobox(self):
return self.page.get_by_label("Edit highlighted note")
Expand Down
2 changes: 2 additions & 0 deletions e2e_tests/e2e/ui/test_book_opens.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ async def test_book_content_portal_opens(chrome_page, base_url):
assert "404 Not Found - OpenStax" not in await new_tab.title()

assert await new_tab.get_by_role("heading", name="Table of contents").is_visible()

await chrome_page.close()
7 changes: 3 additions & 4 deletions e2e_tests/e2e/ui/test_highlight_box_delete_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ async def test_small_highlight_box_delete_note(
await home.click_continue_login()

# THEN: Book page opens, highlight box appears, note is saved, then deleted and box disappears

await chrome_page.keyboard.press("Escape")

await home.double_click_text()

# NOTE!!! For now infobox needs to be clicked twice to have the edit highlight box open
await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert home.highlight_box_is_visible
assert await home.highlight_box_is_visible()

await home.fill_highlight_box_note_field("autotest highlight")

Expand Down
19 changes: 8 additions & 11 deletions e2e_tests/e2e/ui/test_highlight_box_save_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ async def test_highlight_box_save_note(
await home.click_continue_login()

# THEN: Book page opens, highlight box appears, note is saved

await chrome_page.keyboard.press("Escape")

await home.select_text()
await home.double_click_text()

# NOTE!!! For now infobox needs to be clicked twice to have the edit highlight box open
await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

Expand Down Expand Up @@ -76,8 +75,8 @@ async def test_overlapping_highlights(

await home.click_continue_login()

# THEN: Book page opens, a highlight exists and adding another highlight brings up an overlapping warning message

# THEN: Book page opens, a highlight exists and adding another highlight brings up
# an overlapping warning message
await chrome_page.keyboard.press("Escape")

await home.select_text()
Expand All @@ -91,7 +90,6 @@ async def test_overlapping_highlights(
)

# THEN: Delete the created highlight

await home.click_highlights_option()
await home.click_highlights_option_page_menu()

Expand Down Expand Up @@ -125,15 +123,15 @@ async def test_highlight_box_note_colours(

await home.click_continue_login()

# THEN: Book page opens, highlight box appears with colours and highlighted text can get different colour

# THEN: Book page opens, highlight box appears with colours and highlighted text
# can get different colour
await chrome_page.keyboard.press("Escape")

await home.select_text()
await home.double_click_text()

# NOTE!!! For now infobox needs to be clicked twice to have the edit highlight box open
await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

Expand Down Expand Up @@ -165,7 +163,6 @@ async def test_highlight_box_note_colours(
assert "green" in await home.highlights_option_text_colour_check_green

# THEN: Delete the created highlight

await chrome_page.keyboard.press("Escape")

await home.click_highlights_option_page_menu()
Expand Down
12 changes: 4 additions & 8 deletions e2e_tests/e2e/ui/test_highlight_editbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ async def test_highlight_editbox_opens_on_one_click(
await home.click_continue_login()

# THEN: Book page opens, highlight infobox and edit box appears

await chrome_page.keyboard.press("Escape")

await home.double_click_text()

assert await home.highlight_infobox.is_visible()

# NOTE!!! For now infobox needs to be clicked twice to have the edit highlight box open
await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

Expand Down Expand Up @@ -72,20 +71,18 @@ async def test_highlight_editbox_remains_open_when_clicked_inside(
await home.click_continue_login()

# THEN: Book page opens, highlight infobox and edit box appears

await chrome_page.keyboard.press("Escape")

await home.double_click_text()

assert await home.highlight_infobox.is_visible()

# NOTE!!! For now infobox needs to be clicked twice to have the edit highlight box open
await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

# THEN: Highlight edit box remains open when note field is clicked

await home.click_highlight_box_note_field()

assert await home.highlight_box_is_visible()
Expand All @@ -100,7 +97,6 @@ async def test_highlight_editbox_remains_open_when_clicked_inside(
)

# THEN: Delete the created highlight

await home.click_highlights_option_page_menu()

await home.click_highlights_option_page_menu_delete()
Expand Down
33 changes: 12 additions & 21 deletions e2e_tests/e2e/ui/test_highlight_in_show_hide_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,8 @@ async def test_highlight_not_saved_in_show_hide_solution(
# THEN: Double click text in solution dropdown
await chrome_page.locator("#fs-id1165134108431").dblclick()

assert await home.highlight_infobox.is_visible()

await home.oneclick_highlight_infobox()

assert await home.highlight_box_is_visible()

# THEN: Solution dialog closes
await home.click_show_hide_solution_link()

assert not await home.highlight_box_is_visible()

# THEN: Solution dialog opens
await home.click_show_hide_solution_link()

assert not await home.highlight_box_is_visible()

# THEN: Double click text in solution dropdown
await chrome_page.locator("#fs-id1165134108431").dblclick()

await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

Expand All @@ -72,6 +54,14 @@ async def test_highlight_not_saved_in_show_hide_solution(

assert await home.highlight_infobox.is_visible()

# THEN: Tabbing down to the highlighted text
await chrome_page.keyboard.press("Tab")
await chrome_page.keyboard.press("Tab")

await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

# THEN: Delete existing highlight
await home.click_highlights_option()

Expand Down Expand Up @@ -117,7 +107,8 @@ async def test_highlight_saved_in_show_hide_solution(

assert await home.highlight_infobox.is_visible()

await home.oneclick_highlight_infobox()
# THEN: Highlight infobox can be open by pressing Enter key only (as of Feb. 23, 2026)
await chrome_page.keyboard.press("Enter")

assert await home.highlight_box_is_visible()

Expand Down
Loading