#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   login_page_loctor_check.py
@Time    :   2024/11/06 16:15:39
@Author  :   dulip3ng 
@Version :   1.0
@Desc    :   None
'''

import pytest
from playwright.sync_api import expect, Page
from pages.locator.login_page_locator import LoginPageLocator

@pytest.fixture(scope="module", autouse=True)
def open_page(page: Page):
    page.goto("http://10.201.3.146/k3cloud/html5/")

def test_USERNAME_LOC(page: Page):
    print(id(page))
    expect(page.locator(LoginPageLocator.USERNAME_LOC)).to_be_attached()

def test_DB_LOC(page: Page):
    print(id(page))
    expect(page.locator(LoginPageLocator.DB_LOC)).to_be_attached()

def test_LOGIN_BUTTON_LOC(page: Page):
    expect(page.locator(LoginPageLocator.LOGIN_BUTTON_LOC)).to_be_attached()

def test_PASSWORD_LOC(page: Page):
    expect(page.locator(LoginPageLocator.PASSWORD_LOC)).to_be_attached()

def test_ACTIVE_TAB_LOC(page: Page):
    expect(page.locator(LoginPageLocator.ACTIVE_TAB_LOC)).to_be_attached()

def test_DATA_CENTER_ARROW_DOWN_LOC(page: Page):
    expect(page.locator(LoginPageLocator.DATA_CENTER_ARROW_DOWN_LOC)).to_be_attached()

def test_DB_SELECT_ITEM_ARGS_LOC(page: Page):
    page.locator(LoginPageLocator.DATA_CENTER_ARROW_DOWN_LOC).click()
    expect(page.locator(LoginPageLocator.DB_SELECT_ITEM_ARGS_LOC % 'LTTC1222')).to_be_attached()
