FitTrackee/e2e/test_logout.py

25 lines
790 B
Python
Raw Normal View History

2022-07-03 15:01:21 +02:00
from selenium.webdriver.common.by import By
from .utils import register_valid_user
class TestLogout:
def test_user_can_log_out(self, selenium):
user = register_valid_user(selenium)
2023-07-13 21:49:27 +02:00
logout_button = selenium.find_elements(By.CLASS_NAME, 'logout-button')[
0
]
2023-07-13 21:49:27 +02:00
logout_button.click()
modal = selenium.find_element(By.ID, 'modal')
confirm_button = modal.find_elements(By.CLASS_NAME, 'confirm')[0]
confirm_button.click()
selenium.implicitly_wait(1)
2022-07-03 15:01:21 +02:00
nav = selenium.find_element(By.ID, 'nav').text
assert 'Register' in nav
assert 'Login' in nav
assert user['username'] not in nav
2023-07-13 21:49:27 +02:00
buttons = selenium.find_elements(By.CLASS_NAME, 'logout-button')
assert buttons == []