Code Monkey home page Code Monkey logo

playwright-pro's Introduction

playwright-pro

基于 playwright 和 pytest 单元测试框架的自动化项目

特点

  • 测试用例运行失败/错误自动截图+重跑。
  • 测试数据参数化。

安装

$ pip install -r requirements.txt

依赖库

playwright==1.25.2
pytest==7.1.2
pytest-playwright==0.3.0
pytest-html==3.1.1
pytest-rerunfailures==9.1.1
seldom==2.10.7

注:安装requirements.txt指定依赖库的版本,这是经过测试的,有时候新的版本可会有错。

配置

config.py 文件配置

class RunConfig:
    """
    运行测试配置
    """
    # 运行测试用例的目录或文件
    cases_path = "./test_dir/test_parametrize.py"

    # 配置浏览器驱动类型(chromium, firefox, webkit)。
    browser = "chromium"

    # 运行模式(True/False)
    headless = True

    # 配置运行的 URL
    url = "https://www.baidu.com"

    # 失败重跑次数
    rerun = "0"

    # 当达到最大失败数,停止执行
    max_fail = "5"

运行

运行测试

$ python run.py

playwright-pro's People

Contributors

defnngj avatar klookapptest avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.