#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   login_page.py
@Time    :   2024/11/13 20:47:19
@Author  :   dulip3ng
@Version :   1.0
@Desc    :   None
'''

import pytest
from playwright.sync_api import Page

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

def test_click_button(page, body_page):
    body_page.click_button("新增行")

def test_click_sub_button(page, body_page):
    body_page.click_button("新增行", "插入行")

def test_get_row_count(page, body_page):
    row_count = body_page.get_row_count()
    assert row_count == "3"

def test_set_value(page, body_page):
    body_page.set_value("物料编码", "T15B-DX14000843", 1)
    body_page.set_value("客户款式号", "123123", 1)
    body_page.set_value("生产月份", "9", 1)

def test_get_value(page, body_page):
    assert body_page.get_value("物料编码", 1) == "T15B-DX14000843"
    assert body_page.get_value("客户款式号", 1) == "123123"
    assert body_page.get_value("生产月份", 1) == "9"

def test_click_line(page, body_page):
    body_page.click_line(2)

def test_set_checked(page, body_page):
    body_page.set_checked("控制发货数量", 1)

def test_change_sheet(page, body_page):
    body_page.change_sheet("物料数据")

def test_set_text_in_body_head(page, body_page):
    body_page.set_text_in_body_head("面料规格", "123123")

def test_set_select_in_body_head(page, body_page):
    body_page.set_select_in_body_head("货主类型", "供应商")

def test_set_base_in_body_head(page, body_page):
    body_page.set_base_in_body_head("面料来源", "客供免费")

def test_get_base_in_body_head(page, body_page):
    assert body_page.get_base_in_body_head("面料来源") == "客供免费"

def test_get_text_in_body_head(page, body_page):
    assert body_page.get_text_in_body_head("面料规格") == "123123"

def test_get_select_in_body_head(page, body_page):
    assert body_page.get_select_in_body_head("货主类型") == "供应商"



