Source code
Revision control
Copy as Markdown
Other Tools
import pytest
USERNAME_CSS = "#email"
PASSWORD_CSS = "#password"
LOGIN_BUTTON_CSS = "button[type=submit]"
IFRAME_CSS = "#chatbot-iframe"
SUCCESS_CSS = "#toggle-chatbot"
FAIL_MSG = "detectIncognito cannot determine the browser"
async def get_to_ai_helper(client, credentials):
await client.make_preload_script("delete navigator.__proto__.webdriver")
await client.navigate(URL)
client.await_css(USERNAME_CSS, is_displayed=True).send_keys(credentials["username"])
client.await_css(PASSWORD_CSS, is_displayed=True).send_keys(credentials["password"])
client.await_css(LOGIN_BUTTON_CSS).click()
@pytest.mark.asyncio
@pytest.mark.with_interventions
async def test_enabled(client, credentials):
await get_to_ai_helper(client, credentials)
client.switch_to_frame(client.await_css(IFRAME_CSS, timeout=30))
client.await_css(SUCCESS_CSS, is_displayed=True, timeout=30)
@pytest.mark.asyncio
@pytest.mark.without_interventions
async def test_disabled(client, credentials):
await get_to_ai_helper(client, credentials)
await (await client.promise_console_message_listener(FAIL_MSG))