home_page_loctor_check.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. '''
  4. @File : login_page_loctor_check.py
  5. @Time : 2024/11/06 16:15:39
  6. @Author : dulip3ng
  7. @Version : 1.0
  8. @Desc : None
  9. '''
  10. import pytest
  11. from playwright.sync_api import expect, Page
  12. from pages.login_page import LoginPage
  13. from pages.home_page import HomePage
  14. from pages.locator.home_page_locator import HomePageLocator
  15. @pytest.fixture(scope="module")
  16. def page_object(page: Page):
  17. login_page = LoginPage(page)
  18. home_page = HomePage(page)
  19. return {"login_page": login_page, "home_page":home_page}
  20. @pytest.fixture(scope="module", autouse=True)
  21. def login(page: Page, page_object):
  22. login_page = page_object["login_page"]
  23. page.goto("http://10.201.3.146/k3cloud/html5/")
  24. login_page.login('LTTC1222', '杜立朋', 'TallGiraffe_1')
  25. def test_SEARCH_LOC(page: Page):
  26. expect(page.locator(HomePageLocator.SEARCH_LOC)).to_be_attached(timeout=10_000)
  27. def test_ORGANIZATION_LOC(page: Page):
  28. expect(page.locator(HomePageLocator.ORGANIZATION_LOC)).to_be_attached()
  29. def test_ORG_ITEM_ARGS_LOC(page: Page):
  30. page.locator(HomePageLocator.ORGANIZATION_LOC).click()
  31. expect(page.locator(HomePageLocator.ORG_ITEM_ARGS_LOC % '100.1')).to_be_attached()
  32. def test_BILL_TAB_ARGS_LOC(page: Page):
  33. expect(page.locator(HomePageLocator.BILL_TAB_ARGS_LOC % '待办任务列表')).to_be_attached()
  34. def test_BILL_CLOSE_ARGS_LOC(page: Page):
  35. expect(page.locator(HomePageLocator.BILL_CLOSE_ARGS_LOC % '待办任务列表')).to_be_attached()
  36. def test_ALL_OPEN_FORM_BTN_LOC(page: Page):
  37. expect(page.locator(HomePageLocator.ALL_OPEN_FORM_BTN_LOC)).to_be_attached()
  38. def test_CLOSE_ALL_BILLS_ITEM_LOC(page: Page):
  39. page.locator(HomePageLocator.ALL_OPEN_FORM_BTN_LOC).click()
  40. expect(page.locator(HomePageLocator.CLOSE_ALL_BILLS_ITEM_LOC)).to_be_attached()
  41. def test_BILL_LIST_ARGS_LOC(page: Page, page_object):
  42. home_page = page_object.get("home_page")
  43. home_page.search_bill("销售订单")
  44. expect(page.locator(HomePageLocator.BILL_LIST_ARGS_LOC % ("销售订单", 1))).to_be_attached()
  45. def test_IS_BILL_OPENING_ARGS_LOC(page: Page):
  46. expect(page.locator(HomePageLocator.IS_BILL_OPENING_ARGS_LOC % '待办任务列表')).to_be_attached()
  47. @pytest.mark.skip
  48. def test_WARNING_MSG_BTN_ARGS_LOC(page: Page):
  49. expect(page.locator(HomePageLocator.WARNING_MSG_BTN_ARGS_LOC)).to_be_attached()