JSPM

  • Created
  • Published
  • Downloads 339
  • Score
    100M100P100Q98824F
  • License MIT

steps to interact with playwright

Package Exports

  • @qavajs/steps-playwright
  • @qavajs/steps-playwright/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@qavajs/steps-playwright) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version

@qavajs/steps-playwright

Step library to work with playwright in qavajs framework

Installation

npm install @qavajs/steps-playwright

Configuration

const App = require('./page_object');
module.exports = {
    default: {
        require: [
            'node_modules/@qavajs/steps-playwright'
        ],
        browser: {
            timeout: {
                present: 10000,
                visible: 20000    
            },
            capabilities: {
                browserName: 'chromium'
            }
        },
        pageObject: new App()
    }
}

Connect to playwright server

In order to connect to playwright server pass wsEndpoint property in capabilities object

{
    capabilities: {
        browserName: 'chromium',
        wsEndpoint: 'ws://127.0.0.1:60291/2bd48ce272de2b543e4c8c533f664b83'    
    }
}

Connect to cdp endpoint

In order to connect to CDP endpoint pass cdpEndpoint property in capabilities object

{
    capabilities: {
        browserName: 'chromium',
        cdpEndpoint: 'http://localhost:9222/'    
    }
}

Screenshot strategy

@qavajs/steps-playwright has build-in capability to take screenshot on particular event. If you need to add screenshot to your report add screenshot property to profile config. Supported events:

  • onFail
  • beforeStep
  • afterStep
module.exports = {
    default: {
        screenshot: 'onFail'
    }
}

Playwright traces

@qavajs support capturing playwright traces. https://playwright.dev/docs/next/trace-viewer-intro

{
    browser: {
        trace: {
            event: 'onFail', // Event to save trace. Possible value onFail or AfterScenario 
            dir: 'dirToStoreTraces' // Dir to store traces. Default is traces/
            attach: true // Define if trace need to be attached to cucumber report. Default false
        }
    }
}