-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
47 lines (38 loc) · 1.3 KB
/
conftest.py
File metadata and controls
47 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import pytest,os
from getpass import getpass
from playwright.sync_api import Page, expect
from dotenv import load_dotenv
from pages.login_page import LoginPage
from pages.dashboard_page import DashboardPage
from pages.general_information_tab import GeneralInformationTab
from pages.tasks_tab import TasksTab
from pages.decisions_tab import DecisionsTab
load_dotenv()
USERNAME = os.getenv("NAMASTOX_USER")
PASSWORD = os.getenv("NAMASTOX_PASSWORD")
if USERNAME is None or PASSWORD is None:
print("Not found environment variables in your directory")
print("Recommendation: configure .env with your credentials")
USERNAME = input("Introduce your username: ")
PASSWORD = getpass(prompt="Introduce your password: ")
@pytest.fixture()
def login_page(page: Page):
return LoginPage(page)
@pytest.fixture()
def auth_page(page:Page,login_page: LoginPage):
login_page.navigate()
login_page.login(USERNAME,PASSWORD)
assert login_page.is_logged(), "Incorrect credentials"
return page
@pytest.fixture()
def dashboard_page(auth_page):
return DashboardPage(auth_page)
@pytest.fixture()
def general_information_tab(page):
return GeneralInformationTab(page)
@pytest.fixture()
def tasks_tab(page):
return TasksTab(page)
@pytest.fixture()
def decisions_tab(page):
return DecisionsTab(page)