2022-06-25 21:23:15 +02:00
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
2020-09-13 21:39:44 +02:00
|
|
|
from .utils import register_valid_user
|
|
|
|
|
|
|
|
|
|
|
|
class TestLogout:
|
|
|
|
def test_user_can_log_out(self, selenium):
|
|
|
|
user = register_valid_user(selenium)
|
2022-06-25 21:23:15 +02:00
|
|
|
user_menu = selenium.find_element(By.CLASS_NAME, 'nav-items-user-menu')
|
|
|
|
logout_link = user_menu.find_elements(By.CLASS_NAME, 'nav-item')[2]
|
2020-09-13 21:39:44 +02:00
|
|
|
|
2021-10-31 21:04:47 +01:00
|
|
|
logout_link.click()
|
2020-09-13 21:39:44 +02:00
|
|
|
selenium.implicitly_wait(1)
|
|
|
|
|
2022-06-25 21:23:15 +02:00
|
|
|
nav = selenium.find_element(By.ID, 'nav').text
|
2020-09-13 21:39:44 +02:00
|
|
|
assert 'Register' in nav
|
|
|
|
assert 'Login' in nav
|
|
|
|
assert user['username'] not in nav
|
|
|
|
assert 'Logout' not in nav
|