|
| 1 | +import pytest |
| 2 | +from e2e_tests.e2e.ui.pages.home import HomeRex |
| 3 | + |
| 4 | + |
| 5 | +@pytest.mark.asyncio |
| 6 | +async def test_osweb_higher_education_page(chrome_page, base_url): |
| 7 | + |
| 8 | + # GIVEN: Playwright, chromium and the rex_base_url |
| 9 | + await chrome_page.goto(base_url) |
| 10 | + home = HomeRex(chrome_page) |
| 11 | + await chrome_page.keyboard.press("Escape") |
| 12 | + |
| 13 | + # WHEN: Navigate to Higher Education (HE) page (depends on envs) |
| 14 | + if "staging" in chrome_page.url: |
| 15 | + pytest.skip("Skipping test. Staging is missing Higher Education page") |
| 16 | + else: |
| 17 | + |
| 18 | + await home.click_higher_education_link() |
| 19 | + |
| 20 | + # THEN: HE page opens |
| 21 | + assert await home.try_assignable_today_link.is_visible() |
| 22 | + |
| 23 | + assert await home.free_digital_library_subjects.count() == 8 |
| 24 | + |
| 25 | + assert await home.search_technology_partners_link.is_visible() |
| 26 | + |
| 27 | + assert ( |
| 28 | + "affordable technology for higher education" |
| 29 | + in await chrome_page.inner_text("body") |
| 30 | + ) |
| 31 | + |
| 32 | + |
| 33 | +@pytest.mark.asyncio |
| 34 | +async def test_osweb_higher_education_page_bookstore_link(chrome_page, base_url): |
| 35 | + |
| 36 | + # GIVEN: Playwright, chromium and the rex_base_url |
| 37 | + await chrome_page.goto(base_url) |
| 38 | + home = HomeRex(chrome_page) |
| 39 | + await chrome_page.keyboard.press("Escape") |
| 40 | + |
| 41 | + # WHEN: Navigate to bookstore page (depends on envs) |
| 42 | + if "staging" in chrome_page.url: |
| 43 | + await chrome_page.goto(f"{base_url}/bookstore") |
| 44 | + else: |
| 45 | + await home.click_higher_education_link() |
| 46 | + await home.click_campus_affordability_link() |
| 47 | + |
| 48 | + # THEN: Bookstore page elements are visible/enabled in both staging and prod envs |
| 49 | + assert await home.higher_education_bookstore_order_access_code.is_visible() |
| 50 | + assert await home.higher_education_bookstore_view_print_options.first.is_visible() |
| 51 | + assert await home.obtain_access_codes_via_vitalsource.is_visible() |
| 52 | + assert await home.obtain_access_codes_via_openstax.is_visible() |
| 53 | + assert await home.know_before_your_order_columns.is_visible() |
| 54 | + assert await home.higher_education_bookstore_view_print_options.last.is_visible() |
| 55 | + assert await home.access_pdf.is_visible() |
| 56 | + |
| 57 | + # THEN: Access code order form opens in new tab |
| 58 | + async with chrome_page.expect_popup() as popup_info: |
| 59 | + await home.access_code_order_form.click() |
| 60 | + |
| 61 | + new_tab = await popup_info.value |
| 62 | + await new_tab.wait_for_load_state() |
| 63 | + |
| 64 | + assert "riceuniversity.tfaforms.net/47" in new_tab.url |
| 65 | + assert "Assignable Bookstore Order Form" in await new_tab.title() |
| 66 | + |
| 67 | + await new_tab.close() |
0 commit comments