-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added playwright test for livestream url
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Test livestream urls.""" | ||
|
||
import pytest | ||
from playwright.sync_api import Page, expect | ||
|
||
VETINARI_EMAIL = '[email protected]' | ||
VETINARI_PASSWORD = 've@pwd3289' # nosec | ||
|
||
|
||
def wait_until_recaptcha_loaded(page: Page) -> None: | ||
page.wait_for_selector( | ||
'#form-passwordlogin > div.g-recaptcha > div > div.grecaptcha-logo > iframe', | ||
timeout=10000, | ||
) | ||
|
||
|
||
@pytest.mark.enable_socket() | ||
def test_login_add_livestream( | ||
db_session, live_server, user_vetinari, project_expo2010, page: Page | ||
): | ||
user_vetinari.add_email(VETINARI_EMAIL) | ||
user_vetinari.password = VETINARI_PASSWORD | ||
db_session.commit() | ||
page.goto(live_server.url) | ||
page.get_by_role("link", name="Login").click() | ||
wait_until_recaptcha_loaded(page) | ||
page.wait_for_selector('input[name=username]').fill(VETINARI_EMAIL) | ||
page.click('#use-password-login') | ||
page.wait_for_selector('input[name=password]').fill(VETINARI_PASSWORD) | ||
page.click('#login-btn') | ||
assert ( | ||
page.wait_for_selector('.alert__text').inner_text() == "You are now logged in" | ||
) | ||
page.goto(project_expo2010.absolute_url) | ||
page.get_by_label("Update livestream URLs").click() | ||
page.get_by_label("Livestream URLs. One per line").click() | ||
page.get_by_label("Livestream URLs. One per line").fill( | ||
"https://youtube.com/live/JdHDG6Zudi4?feature=share\nhttps://vimeo.com/828748049?share=copy" | ||
) | ||
page.get_by_role("button", name="Save changes").click() | ||
expect( | ||
page.frame_locator( | ||
"internal:role=tabpanel[name=\"Livestream\"i] >> iframe" | ||
).get_by_role("link", name="Faster, Better, Cheaper -") | ||
).to_be_visible() | ||
Check failure on line 45 in tests/e2e/basic/video_test.py GitHub Actions / test (ubuntu-latest, 3.11)
Check failure on line 45 in tests/e2e/basic/video_test.py GitHub Actions / test (ubuntu-latest, 3.12)
|
||
page.get_by_role("tab", name="Livestream 2").click() | ||
expect( | ||
page.frame_locator( | ||
"internal:role=tabpanel[name=\"Livestream\"i] >> iframe" | ||
).get_by_role("banner") | ||
).to_contain_text("How to do AI right - Workshop Promo") |