Git Product home page Git Product logo

cucumber-puppeteer's Introduction

circleci codecov

Cucumber Puppeteer

A Node.js behavioural test framework made using Cucumber.js and Puppeteer. The test steps are generic so you can quickly create your test suite:

Scenario: Open the search page and find products
  When  I open the url "https://someurl.com/search"
  And   I set the element "input[name='search']" value to "plumbus"
  And   I click the button ".search-button"
  Then  I expect the element "#results > .result-count" contains text "3 products found"

Test steps

Look at the *.feature files in the project to see the available test steps. You can run them all with:

npm start        # after running `npm run test-server`

Configuration and hooks are loaded from /features/support/config.js. You can override behaviour with the following environment variables:

ENV              # Appended to screenshot names (default: '')
REPORT_PATH      # Path where Axe accessibility reports will be saved (default: './test/reports')
ROOT_URL         # Prepended to URLs that don't start with 'http' (default: '')
SCREENSHOT_PATH  # Path to save screenshots (default: './test/screenshots'

In addition to the above, environment variables are available to the deleteCookie, openUrl and setElementValue actions. Environment variables are not output to the test results and use the following syntax:

When I open the url "$TEST_URL"
And  I set the element "[type='password']" value to "$TEST_PASSWORD"

Puppeteer launch options

You can customize Puppeteer's launch options by adding a puppeteerOptions object to your package.json:

// package.json
"puppeteerOptions" : {
    "headless": false,
    "sloMo": 250,
    "defaultViewport": {
        "width": 1000,
        "height": 1000
    }
}

Or by using the Cucumber.js --world-parameters command line arg:

// package.json
"scripts": {
    "test:headful": "npx cucumber-js --world-parameters \"{\\\"headless\\\": false}\""
}

⚠️ Note that --world-parameters will take precedence.

Use in your project

To use this in your own project as a dependency, check out the test-cuke example.

Unit tests

npm test         # after running `npm run test-server`

License and credits

This code is licensed under the MIT license.

cucumber-puppeteer's People

Contributors

bricas avatar dependabot[bot] avatar fossabot avatar greenkeeper[bot] avatar patheard avatar paulbjensen avatar snyk-bot avatar valentinmagot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cucumber-puppeteer's Issues

An in-range update of puppeteer is breaking the build 🚨

The dependency puppeteer was updated from 2.0.0 to 2.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

puppeteer is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: unit_test: CircleCI is running your tests (Details).
  • βœ… ci/circleci: security_test: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: behaviour_test: Your tests failed on CircleCI (Details).

Commits

The new version differs by 21 commits.

  • a30cf05 chore: mark version v2.1.0 (#5347)
  • 013a86c feat(chromium): roll Chromium to r722269 (#5289)
  • 14b2369 chore: mark puppeteer-firefox version v0.5.1 (#5294)
  • 3a49cfc chore: move to GitHub hosting for Juggler binaries (#5293)
  • c7af7de docs(readme): update link for ndb (#5272)
  • 5e63254 chore: fix typo in test name (#5217)
  • 80b5c44 chore: upgrade https-proxy-agent (#5243)
  • 6091a34 fix: prepare jsHandle.uploadFile for CDP Page.handleFileChooser removal (#5196)
  • 8b49dc6 fix: don’t disable BlinkGenPropertyTrees anymore (#5159)
  • f0bf645 test: reduce flakiness for accessibility tests with autofocus (#5116)
  • 6cc98a7 docs(troubleshooting): recommend using args for heroku (#5197)
  • 35d5ba5 feat(launcher): Set default Firefox prefs (#5149) (#5195)
  • eddb23b chore: update URLs (#5185)
  • c5a72e9 feat(launcher): add option to run Puppeteer with different browsers (#5137)
  • d17708b fix(types): publish protocol types to npm (#5174)

There are 21 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Hide elements by CSS selector list

Action that allows user to pass a comma separated list of CSS selectors which can be hidden/unhidden using visibility style. Useful for screen comparing pages with variable metadata.

An in-range update of codecov is breaking the build 🚨

The devDependency codecov was updated from 3.6.3 to 3.6.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

codecov is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: behaviour_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: unit_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: security_test: Your tests failed on CircleCI (Details).

Release Notes for v3.6.4

Fix for Cirrus CI

Commits

The new version differs by 6 commits.

  • bac0787 v3.6.4
  • 203ff3a Merge pull request #161 from codecov/drazisil-patch-1
  • 696562d Merge pull request #147 from iansu/patch-1
  • 1430de5 Update test
  • a30b1f5 Change cirrus-ci to match backend
  • 6a62759 Add AWS CodeBuild to the list of supported CI providers

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Testing wont work with v1.0.16 but works with v1.0.15

I have recently started working with cucumber and puppeteer. Came across the library. I just wanted to give it a try.

First I tried the example project at https://github.com/patheard/test-cuke. It works as-is out of the box.

I then tried to create my own individual project. I tried installing cucumber-puppeteer with npm install cucumber-puppeteer and in package.json it installed ^1.0.16 which is the latest release. However npm test fails with an error.

The example project https://github.com/patheard/test-cuke will not work as well with 'v1.0.16'.

I tried to check more details for the same and I found out that the https://github.com/patheard/test-cuke is still using v1.0.15 (package.lock file has it) which happens to work properly. When a version is switched to v1.0.16 there seem to be some issues with the test, which I thought was weird.

Following is the print screen when I tried to run npm test :
Screenshot from 2020-05-04 18-06-08

I could not exactly locate the issue with this. If the example project https://github.com/patheard/test-cuke itself could be updated to use with the latest release of cucumber-puppeteer that would also help.

Any help on this is appreciated. I would also like to take a moment here to thank the contributors for the development efforts on this library. Cheers.

Can't use `this.attach`

In my testing setup I like to output detailed results in the command line. For that I normally use attachments to make sure the results appear on the right spot in the command line.

With your setup I can't use this.attach anymore because you don't expose that in your world constructor. Is it an idea to expose this.attach as well.

Something like:

constructor(args){
    this.browser = null;
    this.config = null;
    this.page = null;
    this.worldParameters = args && args.parameters ? args.parameters : {};
    this.attach = args && args.attach ? args.attach : null;
}

page.click vs page.evaluate

It seems that clickElement does not work on all cases. I have a regular Ext.js app and I tried on other simple ones,

let selector = 'input[name="username"]';

// does NOT work
await page.click(selector); 

// does work
await page.evaluate((selector) => document.querySelector(selector).click(), selector); 

Googling around, I am not the first person to solve it using the does work method but should the library here adhere to more verbose standards?

An in-range update of axe-puppeteer is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency axe-puppeteer was updated from 1.0.0 to 1.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

axe-puppeteer is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Commits

The new version differs by 36 commits.

  • 600c644 Merge pull request #66 from dequelabs/release-03-04-2020-again
  • 1524426 Merge branch 'master' into release-03-04-2020-again
  • 036846b chore(release): 1.1.0
  • 7985e2b style: Run Prettier (#62)
  • 28c4059 chore: release 1.0 (#64)
  • 948b14e chore: Update dependency packages (#59)
  • ec5d137 chore: update package-lock.json with public npm registry (#54)
  • 45d133d Allow puppeteer@2 in peer dependencies (#53)
  • b3f129a chore(deps): [security] bump https-proxy-agent from 2.2.2 to 2.2.4 (#50)
  • 1fe3ee6 Merge branch 'develop' into dependabot/npm_and_yarn/https-proxy-agent-2.2.4
  • cf13359 chore: change puppeteer types (#52)
  • a3dd7ac chore: change puppeteer types
  • c6f626b chore(deps): [security] bump https-proxy-agent from 2.2.2 to 2.2.4
  • 35f49a1 chore(deps-dev): bump express from 4.16.4 to 4.17.1 (#34)
  • a5ee2f4 chore(deps-dev): bump @types/puppeteer from 1.10.0 to 1.19.1 (#35)

There are 36 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Check if element has focus

Create code and tests to determine if a DOM element has focus. The API docs for Puppeteer will help show what's possible.

  1. Look for examples in the code the use page.$eval to interact with the page's DOM.
  2. Try writing the unit tests first, before adding the check logic.
  3. The webdriverio/cucumber-boilerplate has good examples for the given and then step definition regular expressions.

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.246.0 to 1.247.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v1.247.0

1.247.0 (2019-11-13)

Features

Commits

The new version differs by 4 commits.

  • e69ef82 Merge pull request #861 from snyk/feat/introduce-jar-files
  • e699598 feat: add *.war support
  • 0189a39 chore: split up test and monitor tests
  • e845d19 feat: detect *.jar files as maven

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

support for puppeteer.connect?

Currently puppeteer.launch is used to start the browser, however, to connect to a remote instance, you need to use puppeteer.connect.

Perhaps the existence of browserWSEndpoint in the config options can be checked, and if present, use .connect over .launch?

Custom Variable (e.g. URL)

I was curious, is there a way to have a custom variable injected. In the example/read-me, you set the url however, what if I wanted to pass an variable which changes its url depending on the environment?

Visual regression test

  • If reference screenshot, expect matches
  • If no reference, take ref and fail test with warning
  • Ability to resize browser during screenshot test

Feature Scope's init will override puppeteer's options

hi @patheard

first you set BrowserScope in here, everything good.

setWorldConstructor(BrowserScope)

but when goto this line

await featureScope.init(currentFeature);

and the first feature in, the featureScope's params are null,

in init method,

let worldParameters = {};
if(this.browserScope){
await this.browserScope.close();
worldParameters = this.browserScope.worldParameters;
this.browserScope = null;
}
this.browserScope = new BrowserScope({parameters: worldParameters});
await this.browserScope.init();

see the this.browserScope it is null,
and the worldParameters also empty,
but you use it in new BrowserScope({ parameters: worldParameters }),

so i think that is a bug.

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.252.0 to 1.253.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v1.253.0

1.253.0 (2019-12-01)

Features

  • add support for setup.py (dec4f5a)
Commits

The new version differs by 2 commits.

  • 8609cdf Merge pull request #878 from snyk/feat/support-setup-py
  • dec4f5a feat: add support for setup.py

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of snyk is breaking the build 🚨

The devDependency snyk was updated from 1.230.5 to 1.230.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: unit_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: behaviour_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: security_test: Your tests failed on CircleCI (Details).

Release Notes for v1.230.6

1.230.6 (2019-10-04)

Bug Fixes

  • add packed dependency to prevent download from git (c918814)
Commits

The new version differs by 4 commits.

  • e6568ec Merge pull request #797 from snyk/test/remove-bad-test
  • f365660 test: skip test that uses previous bad version
  • 0c6026e Merge pull request #795 from snyk/fix/https-agent-vuln
  • c918814 fix: add packed dependency to prevent download from git

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.192.2 to 1.192.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: unit_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: behaviour_test: CircleCI is running your tests (Details).
  • ❌ ci/circleci: security_test: Your tests failed on CircleCI (Details).

Release Notes for v1.192.3

1.192.3 (2019-07-05)

Bug Fixes

  • isDocker is a boolean flag in analytics (8dfee30)
Commits

The new version differs by 4 commits.

  • 3b91eca Merge pull request #640 from snyk/fix/docker-analytics
  • 8dfee30 fix: isDocker is a boolean flag in analytics
  • a638c7b Merge pull request #638 from snyk/fix/reinstate-windows-cli-tests
  • 23fb199 test: re-enable windows tests

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.