Skip to content

Commit

Permalink
Added playwright test for livestream url
Browse files Browse the repository at this point in the history
  • Loading branch information
djamg committed Dec 13, 2023
1 parent f368fcf commit 240c4cc
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions tests/e2e/basic/video_test.py
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

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.11)

test_login_add_livestream[chromium] AssertionError: Locator expected to be visible Actual value: None Call log: LocatorAssertions.to_be_visible with timeout 5000ms - waiting for get_by_role("tabpanel", name="Livestream").frame_locator("iframe").get_by_role("link", name="Faster, Better, Cheaper -")

Check failure on line 45 in tests/e2e/basic/video_test.py

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.12)

test_login_add_livestream[chromium] AssertionError: Locator expected to be visible Actual value: None Call log: LocatorAssertions.to_be_visible with timeout 5000ms - waiting for get_by_role("tabpanel", name="Livestream").frame_locator("iframe").get_by_role("link", name="Faster, Better, Cheaper -")
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")

0 comments on commit 240c4cc

Please sign in to comment.