|
1 | 1 | import pytest |
2 | | - |
3 | 2 | from e2e_tests.e2e.ui.pages.home import HomeRex |
4 | 3 |
|
5 | 4 |
|
6 | 5 | @pytest.mark.asyncio |
7 | 6 | async def test_osweb_higher_education_page_bookstore_link(chrome_page, base_url): |
8 | 7 |
|
9 | 8 | # GIVEN: Playwright, chromium and the rex_base_url |
10 | | - |
11 | | - # WHEN: The Home page is fully loaded |
12 | 9 | await chrome_page.goto(base_url) |
13 | 10 | home = HomeRex(chrome_page) |
14 | | - |
15 | 11 | await chrome_page.keyboard.press("Escape") |
16 | 12 |
|
17 | | - # THEN: OpenStax Higher Education / Bookstore page opens |
| 13 | + # WHEN: Navigate to bookstore page (depends on envs) |
18 | 14 | if "staging" in chrome_page.url: |
19 | 15 | 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() |
20 | 20 |
|
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() |
36 | 29 |
|
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() |
39 | 33 |
|
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() |
43 | 36 |
|
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() |
46 | 39 |
|
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