[Python] How to stop loop mode login function in Python Playwright?

Discussão em 'Python' iniciado por Stack, Julho 3, 2025.

  1. Stack

    Stack Membro Participativo

    import pytest
    from playwright.sync_api import Page, expect
    from config_reader import get_config
    from test_signin import test_signin_success

    config = get_config()

    # Test vacancy portal navigation
    def test_vacancy_portal_navigation(page: Page):
    test_signin_success(page)
    expect(page).to_have_url(config["dashboard_url"])
    page.wait_for_load_state("networkidle")
    page.locator('a:has-text("Vacancies")').click()
    expect(page).to_have_url(config["vacancy_tab_url"])

    def test_create_new_interview(page: Page):
    test_vacancy_portal_navigation(page)
    page.locator('button:has-text("New")').click()

    # Test validation of empty fields in vacancy form
    def test_vacancy_create_empty_fields(page: Page):
    test_create_new_interview(page)
    page.locator('input[placeholder="Enter job role..."]').fill('')
    page.locator('input[name="expiry_date"]').fill('')
    page.locator('button:has-text("Save")').click()

    expect(page.locator("text=Job title is required.")).to_be_visible()
    expect(page.locator("text=Closing date is required.")).to_be_visible()

    # Take screenshot for record
    page.screenshot(path="screenshots/vacancy_portal/empty_fields.png")

    Continue reading...

Compartilhe esta Página