#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   login_page.py
@Time    :   2024/11/22 17:34:19
@Author  :   dulip3ng
@Version :   1.0
@Desc    :   None
'''
import time

import pytest
from playwright.sync_api import Page
from common.condition_row import ConditionRow

@pytest.fixture(scope="module", autouse=True)
def open_bill(page: Page, login_page, home_page, list_page):
    page.goto("http://10.200.0.222/k3cloud/html5/")
    login_page.login('正式数据库', '杜立朋', 'lt_k31233')
    home_page.search_bill("销售订单列表")

def test_set_condition_value(page: Page, filter_page, list_page):
    list_page.click_button("过滤")
    cond1 = ConditionRow(1, "基本信息-衬衣订单号", "123456")
    cond2 = ConditionRow(2, "基本信息-销售类别", "内销")
    cond3 = ConditionRow(3, "基本信息-单据状态", "创建")
    cond4 = ConditionRow(4, "基本信息-备注", "123456")
    cond5 = ConditionRow(5, "基本信息-创建日期", "2024-11-01")
    filter_page.filter(cond1, cond2, cond3, cond4, cond5)

def test_check_entity(page: Page, filter_page, list_page):
    time.sleep(2)
    list_page.click_button("过滤")
    filter_page.check_entity("订单条款", "交货明细")

def test_check_org(page: Page, filter_page):
    filter_page.uncheck_all_org()
    filter_page.check_org("100.1", "100.2")

def test_set_operator_logic(page: Page, filter_page):
    cond1 = ConditionRow(1, "基本信息-衬衣订单号", "123456", operator="包含", logic="或者")
    filter_page.filter(cond1)

