Skip to content

Commit 8dc70dd

Browse files
committed
adds new test for he/bookstore page3
1 parent 3bf266a commit 8dc70dd

1 file changed

Lines changed: 21 additions & 30 deletions

File tree

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,40 @@
11
import pytest
2-
32
from e2e_tests.e2e.ui.pages.home import HomeRex
43

54

65
@pytest.mark.asyncio
76
async def test_osweb_higher_education_page_bookstore_link(chrome_page, base_url):
87

98
# GIVEN: Playwright, chromium and the rex_base_url
10-
11-
# WHEN: The Home page is fully loaded
129
await chrome_page.goto(base_url)
1310
home = HomeRex(chrome_page)
14-
1511
await chrome_page.keyboard.press("Escape")
1612

17-
# THEN: OpenStax Higher Education / Bookstore page opens
13+
# WHEN: Navigate to bookstore page (depends on envs)
1814
if "staging" in chrome_page.url:
1915
await chrome_page.goto(f"{base_url}/bookstore")
16+
else:
17+
pytest.skip("Waiting for the bookstore page to be implemented in production")
18+
await home.click_higher_education_link()
19+
await home.click_bookstore_link()
2020

21-
assert await home.higher_education_bookstore_order_access_code.is_enabled()
22-
assert (
23-
await home.higher_education_bookstore_view_print_options.first.is_enabled()
24-
)
25-
26-
assert await home.test_obtain_access_codes_via_vitalsource.is_visible()
27-
assert await home.test_obtain_access_codes_via_openstax.is_visible()
28-
29-
assert await home.test_know_before_your_order_columns.is_visible()
30-
31-
assert (
32-
await home.higher_education_bookstore_view_print_options.last.is_enabled()
33-
)
34-
35-
assert await home.test_access_pdf.is_enabled()
21+
# THEN: Bookstore page elements are visible/enabled in both staging and prod envs
22+
assert await home.higher_education_bookstore_order_access_code.is_enabled()
23+
assert await home.higher_education_bookstore_view_print_options.first.is_enabled()
24+
assert await home.test_obtain_access_codes_via_vitalsource.is_visible()
25+
assert await home.test_obtain_access_codes_via_openstax.is_visible()
26+
assert await home.test_know_before_your_order_columns.is_visible()
27+
assert await home.higher_education_bookstore_view_print_options.last.is_enabled()
28+
assert await home.test_access_pdf.is_enabled()
3629

37-
async with chrome_page.expect_popup() as popup_info:
38-
await home.test_access_code_order_form.click()
30+
# THEN: Access code order form opens in new tab
31+
async with chrome_page.expect_popup() as popup_info:
32+
await home.test_access_code_order_form.click()
3933

40-
# THEN: Access code order form opens
41-
new_tab = await popup_info.value
42-
await new_tab.wait_for_load_state()
34+
new_tab = await popup_info.value
35+
await new_tab.wait_for_load_state()
4336

44-
assert "riceuniversity.tfaforms.net/47" in new_tab.url
45-
assert "Assignable Bookstore Order Form" in await new_tab.title()
37+
assert "riceuniversity.tfaforms.net/47" in new_tab.url
38+
assert "Assignable Bookstore Order Form" in await new_tab.title()
4639

47-
else:
48-
# Waiting for Bookstore link to be implemented in prod under HE option
49-
await home.click_higher_education_link()
40+
await new_tab.close()

0 commit comments

Comments
 (0)