webdriverio-boneyard / wdio-cucumber-framework Goto Github PK
View Code? Open in Web Editor NEWA WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
License: MIT License
A WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
License: MIT License
Hello
I'm unable to ask cucumber to run features that have @tag1 OR @tag2 when providing the tags through CLI.
It seems that the tags I give are always split using the coma, which translates into AND for cucumber.
So the following
$ wdio wdio.conf.js --cucumberOpts.tags="@ios,@android"
Is strictly equivalent to
$ wdio wdio.conf.js --cucumberOpts.tags="@ios","@android"
When I print the config.cucumberOpts.tags object, in both cases I get
['@iOS', '@android']
According to the doc, it should not be equivalent and first example should apply a logical OR, which translates in the following value:
config.cucumberOpts.tags = ['@ios,@android']
I hope that's clear enough. If not, please let me know.
I've been trying to upgrade my webdriver testrunner setup to cucumber 0.9.2 but am hitting a lot of issues.
I notice your package is now using the latest version of cucumber though. I was previously using webdriver 3.2.4 with cucumber 0.5.3. Upgrading webdriver to 3.4.0 worked fine so I tried upgrading cucumber.
It works with my current setup back to cucumber 0.7.0. v0.8.1 seems to hang on step definitions and upgrading to 0.9.2 fails when trying to run cucumber cli. I get the following:
ERROR: Cannot read property 'length' of undefined
Type at Function.Configuration [project_dir]/node_modules/cucumber/lib/cucumber/cli/configuration.js:8:11)
I've even tried stripping my config right back to a very basic setup but it still fails...any idea on how to solve this?
With the updated module (v0.2.4), if I ran command like he following it gives me weird output thats makes no sense.. I am assuming the module is broken for wait
related commands. My be because of updated cucumber dependency?
var myElem = browser.element('#myElem');
myElem.waitForVisible();
Output:
2) Get title of website should the title of the page be "GitHub · Where software is built":
undefined
running phantomjs
undefined
Hi,
I will post this on cucumberjs as well. Just want to make sure, the config I have is ok (below):)
I have been trying to use es6 functions in my step definitions. Looks something like:
module.exports = () => {
this.Given(/^I go on the website "([^"]*)"$/, (url) => {
browser.url(url);
});
this.Then(/^should the element "([^"]*)" be (\d+)px wide and (\d+)px high$/, (selector, width, height) => {
const elemSize = browser.getElementSize(selector);
assert.equal(elemSize.width, width, 'width of element is ' + elemSize.width + ' but should be ' + width);
assert.equal(elemSize.height, height, 'height of element is ' + elemSize.height + ' but should be ' + height);
});
this.Then(/^should the title of the page be "([^"]*)"$/, (expectedTitle) => {
const title = browser.getTitle();
assert.equal(title, expectedTitle, ' title is "' + title + '" but should be "' + expectedTitle);
});
};
And my wdio.conf looks something like this:
...
cucumberOpts: {
timeout: 10000,
compiler: ['js:babel-core/register'],
require: [`${process.cwd()}/src/step_definitions`]
}
...
If I use es5, things work fine. But when I try to use the above step-definition, it fails.
ERROR: Cannot read property 'Given' of undefined
chrome
I have tried with babel-core/register and babel-register with es2015 preset. Both fail.
Is there anything I am doing wrong?
Any help will be highly appreciated.
Thank you!
README says it's 10000 https://github.com/webdriverio/wdio-cucumber-framework#timeout
Code says it's 30000 https://github.com/webdriverio/wdio-cucumber-framework/blob/master/lib/adapter.js#L12
I'm happy to make a PR - which of the values is the correct one?
Hello,
I have updated my version of cucumber to 2.0.0 as it was released 4 days ago and it does not seem to be compatible with my framework as i am getting the following error:
I don't know if this is a direct cucumber issue or if it is just no longer compatible with this wdio module.
I have the workaround of going back to the old version but can you advise if i have raised this in the right place? I havent seen any similar bugs here or in the cucumber-js repository.
Thank you!
Thanks for the v1.0.0 update.
Unfortunately my required files are no longer being processed by Babel
i.e. ERROR: Unexpected token import
These options work in v0.3.1 but not in v1.0.0.
cucumberOpts: {
compiler: [
'js:babel-core/register'
],
require: [
'./path/to/steps/example.js'
]
}
Have there been any breaking config changes?
Before publishing this package it would make sense to update to the latest cucumber version. According to webdriverio/webdriverio#843 the current implementation is not compatible with the new version.
I am getting the below error after upgrading from version 0.2.12 to version 0.2.15:
I am not using Babel so not sure why this is happening
I am currently using:
node v6.3.0
npm v4.0.2
webdriverio v4.5.1
wdio-allure-reporter v0.1.2
wdio-selenium-standalone-service v0.0.7
wdio-visual-regression-service v0.5.0
cucumber v1.3.1
All tests are run directly on my computer through the commandline and the only thing that has changed was webdriverio from version 4.4.0 to 4.5.1 and since reverting wdio-cucumber-framework back to the version i was using previously, my framework is working as expected.
I'm prototyping a solution at the moment using Cucumber as the runner and Allure with the reporter. I noticed that in the Allure Report, each step was recorded as a separate test case.
I took a look here, and was expecting handleBeforeScenarioEvent
to emit a 'test:start' instead of a 'suite:start' event and for handleBeforeStep
to emit 'runner:command' instead of a 'test:start, etc.. Is there a reason why this is not the case?
I have steps in the following order
After Step 2 even Step 3 is marked as pending.
I have
{
failFast: false
ignoreUndefinedDefinitions: true,
failAmbiguousDefinitions: false
}
Feature: Search the Web
As a human
I want to search the web
So I can find information
@watch
Scenario: Search for Facebook
Given I have visited yahoo.com
When I search for "Facebook"
Then I see "Facebook"
Scenario: Search for Youtube
Given I have visited google.com
When I search for "Youtube"
Then I see "Youtube"
...
this.Given(/^I have visited yahoo\.com$/, site => ... );
this.When(/^I search for Facebook$/, site => ....);
this.Then(/^I see Facebook$/, site => ....);
...
this.Given(/^I have visited google\.com$/, site => ... );
this.When(/^I search for Youtube$/, site => ....);
this.Then(/^I see Youtube$/, site => ....);
...
What will be exported?
module.exports = () => {
this.Given(/^I have visited yahoo\.com$/, site => ... );
this.When(/^I search for Facebook$/, site => ....);
this.Then(/^I see Facebook$/, site => ....);
}
[wdio] Running...
...
2 scenario (1 passed, 1 skipped)
3 steps (1 pending, 2 skipped)
Is it possible to use tags as an input in the command line like you would when running on cucumber by itself to just run a subsection of tests or can this only be done via the cucumberOpts in the wdio.conf.js?
I would like the JSON output to include the Given When and Then steps. Is there a way this can be added to the JSON reporter when Cucumber is being used? If not, is there a way to add this to a custom reporter?
When project contains multiple cucumber feature files:
specs: [
featuresPath + '**/*.feature'
],
And we are targeting a specific feature with a tag
cucumberOpts: {
tags: ['@working']
}
The test runner will open an browser window for each feature file regardless of if their are tests to run in that file.
The peer dependency on cucumber, which has recently updated their major version number, is annoying.
I see that a corresponding tweak to this package has been made, could you please publish a new version, thanks.
From @gsccheng on September 24, 2016 23:10
I'm not sure where to post this issue but I'll start here at the top level since I use the wdio test runner with Cucumber.
I think I may be getting a race condition where my spec reporter doesn't always show the test result because the runner is ending prematurely. It seems to only occur when there are multiple browser commands, whether they are in the same step definition or not.
I simplified my code into these code snippets. I'm wondering if anyone can reproduce this.
Here's my gist to the config file
// features/auth.feature
Feature: Auth
Some description
Scenario: Google Auth
Given this should work
// features/step_definitions/auth.js
import { expect } from 'chai';
[...]
this.Given(/^this should work$/, function () {
browser.url('https://google.com');
browser.getSource();
expect('foo').to.exist;
});
// Output:
myApp [testing] :> npm run ui-test
> [email protected] ui-test /Users/GabbAHH/Desktop/Dev/myApp
> better-npm-run ui-test
running better-npm-run in /Users/GabbAHH/Desktop/Dev/myApp
Executing script: ui-test
to be executed: ./node_modules/.bin/wdio wdio.conf.js
=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================
[16:02:15] COMMAND POST "/wd/hub/session"
[16:02:15] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":6,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[16:02:17] INFO SET SESSION ID 42e1e89c-0bbb-4553-b7d7-bce852f847cf
[16:02:17] RESULT {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0)","userDataDir":"/var/folders/59/6pd62vqn20j5qx2hv1l1w9_r0000gn/T/.org.chromium.Chromium.FUqeyq"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"version":"53.0.2785.116","platform":"MAC","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"42e1e89c-0bbb-4553-b7d7-bce852f847cf","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
[16:02:18] COMMAND POST "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf/url"
[16:02:18] DATA {"url":"https://google.com"}
[16:02:25] RESULT null
[16:02:25] COMMAND GET "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf/source"
[16:02:25] DATA {}
[16:02:25] RESULT "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\" itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"en\"><head><meta content=\"Search the world's information, including webpages, ... (230174 more bytes)
[16:02:25] COMMAND DELETE "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf"
[16:02:25] DATA {}
[16:02:25] RESULT null
Now if I remove the second command of browser.getSource()
, I am able to complete the test properly:
So,
// features/step_definitions/auth.js
this.Given(/^this should work$/, function () {
browser.url('https://google.com');
expect('foo').to.exist;
});
gives:
myApp [testing] :> npm run ui-test
> [email protected] ui-test /Users/GabbAHH/Desktop/Dev/myApp
> better-npm-run ui-test
running better-npm-run in /Users/GabbAHH/Desktop/Dev/myApp
Executing script: ui-test
to be executed: ./node_modules/.bin/wdio wdio.conf.js
=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================
[16:02:41] COMMAND POST "/wd/hub/session"
[16:02:41] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":6,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[16:02:44] INFO SET SESSION ID 2ef670fe-d842-4052-8d24-260e48fcb376
[16:02:44] RESULT {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0)","userDataDir":"/var/folders/59/6pd62vqn20j5qx2hv1l1w9_r0000gn/T/.org.chromium.Chromium.GidKiN"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"version":"53.0.2785.116","platform":"MAC","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"2ef670fe-d842-4052-8d24-260e48fcb376","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
[16:02:45] COMMAND POST "/wd/hub/session/2ef670fe-d842-4052-8d24-260e48fcb376/url"
[16:02:45] DATA {"url":"https://google.com"}
[16:02:50] RESULT null
[16:02:50] COMMAND DELETE "/wd/hub/session/2ef670fe-d842-4052-8d24-260e48fcb376"
[16:02:50] DATA {}
[16:02:50] RESULT null
------------------------------------------------------------------
[chrome #0a] Session ID: 2ef670fe-d842-4052-8d24-260e48fcb376
[chrome #0a] Spec: /Users/GabbAHH/Desktop/Dev/myApp/features/auth.feature
[chrome #0a] Running: chrome
[chrome #0a]
[chrome #0a] Auth
[chrome #0a]
[chrome #0a] Google Auth
[chrome #0a] ✓ this should work
[chrome #0a]
[chrome #0a]
[chrome #0a] 1 passing (9s)
[chrome #0a]
Copied from original issue: webdriverio/webdriverio#1611
Hello!
latest release solved undefined error for reporting
but ./build
folder in a package installed via npm install [email protected]
still contains old build files, e.g.:
var err = stepResult.getFailureException();
error = {
message: err.message,
stack: err.stack
};
this.failedCount++;
instead of:
var err = stepResult.getFailureException();
if (err instanceof Error) {
error = {
message: err.message,
stack: err.stack
};
} else {
error = {
message: err
};
}
this.failedCount++;
inside ./build/reporter.js
for now we need to manually build new version from ./lib
that is up-to-date
updating ./build
folder on npm would be much appreciated!
Currently, we can pass in things like tags, and supposedly profiles at runtime, but I have been unable to get profiles working.
so you can do this...
wdio wdio.conf.js --cucumberOpts.tags some_tags
but the following fails to do anything...
wdio wdio.conf.js --cucumberOpts.profile something
I have a seperate file that contains my profiles...
//cucumber.js
common = '--strict --format rerun:@rerun.txt'
module.exports = {
'default': common + '--format summary',
dry: '--dry-run',
progress: '--format progress',
something: '--tags @some_tag'
};
I require this in my wdio.conf.js file
var profiles = require("./features/support/cucumber.js");
Even setting the cucumberOpts in config file explicitly fails to have any affect...
cucumberOpts: {
..
profile: [profiles.something]
..
}
Can you bump the cucumber dependency or set it as a peer dependency.
Given a feature:
Feature: My Feature
Scenario: My Scenario
Given some context
When I do something
Then I achieve some goal
I would expect to have a similar output in the console, but instead I get:
My Feature
My Scenario
✓ some context
✓ I do something
✓ I achieve some goal
It's missing all the keywords to make proper sentences which are usually added by cucumber.
I am using the spec
reporter with the pretty
formatter.
As per the comment on 93b4733
"Set dependency pattern to resolve 1.0.x only"
^1.0.0 locks only the major version, where ~1.0.0 would only allow the revision version number to update.
I am using wdio-cucumber-framework for our project and want capability to re-run the failed scenarios completely instead of just re-trying the failed steps. Is there a way to do it? I have tried using cucumber option 'rerun' in webdriverio config, but it doesn't generate any rerun file.
Does this framework support it?
If yes, how to use it?
If not, is anyone working on it? If not, I can try to look into it.
Please let me know. Thanks
If I am specifying multiple tags e.g - tags: ['@p1','@p2'], in cucumberOpts the test runner ignores all tests without any error. I have test scenarios for both tags. It only works if only one tag or without any tag.
"webdriverio": ^4.6.2",
"wdio-cucumber-framework": "^0.2.5",
cucumberOpts: {
require: [
], // <string[]> (file/dir) require files before executing features
backtrace: false, // <boolean> show full backtrace for errors
// <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
dryRun: false, // <boolean> invoke formatters without executing steps
failFast: false, // <boolean> abort the run on first failure
format: ['pretty'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
colors: true, // <boolean> disable colors in formatter output
snippets: false, // <boolean> hide step definition snippets for pending steps
source: true, // <boolean> hide source uris
profile: [], // <string[]> (name) specify the profile to use
strict: false, // <boolean> fail if there are any undefined or pending steps
tags: ['@P1','@P2'], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
timeout: 120000, // <number> timeout for step definitions
ignoreUndefinedDefinitions: true, // <boolean> Enable this config to treat undefined definitions as warnings.
}
I used browser.call in my code to execute a promise and then i have a browser.url after after it to redirect to other page but what happens is that it executes the browser.url first then it executes the browser.call.
Wanted to test out webdriverio for a project I'm working on because I've found it very easy to use myself as well as potentially easier to maintain on a cross functional team of developers. What I have is an application that is a wrapper around a browser and some tests I'm trying to convert to use webdriverio. I've gotten most of the POC work done and last thing is to work out is concurrency.
In the application, I have a cache that dictates which instance to use. By default the same instance is reused, however, within the capabilities, we run a method to generate a unique cache id in the capabilities similar to below.
capabilities: [{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
//
browserName: 'chrome',
chromeOptions : {
args: [ "cache_id=" + (global.cache = desktopCache.cacheId()), "log-file=/project/logs/${global.cache}-core.log" ]
}
}]
The above code only runs desktopCache.generateCacheId()
for the first test and the subsequent sessions all use the same id that was generated the first time rather than using a unique id for each. Should I not expect my method to be ran each time a session is generated? If not, is it possible to do this? Reason is because we need a unique cache id set for each test (similar to how we have maxInstances which allow chrome to generate unique sessions.
Am I correct in assuming that the wdio-sync dependency is only used if sync: true
is in the configuration? If so, wouldn't it be best that wdio-sync be changed to a peer dependency?
I ask this because I have a test suite that is run asynchronously and yet fibers has to be compiled and installed upon npm install, taking quite some time, when I suppose it's not even used.
From @dimirey on August 1, 2016 22:42
My cucumber tests often fail due to an issue where defined steps are mistakenly considered undefined. When run again, the failed 'undefined' steps occasionally pass correctly as defined. This happens when running ~16 tests in parallel. The failures started after updating webdriverio and the cucumber framework to the latest versions.
This doesn't seem to happen when running tests individually, only when tests (which share step definitions) are run in parallel.
unable to find any logs which have significance to this
Create a user and assert that the settings conform with the Org settings I enter in the user details "A" "B" "C" "D":
module.exports = function(){
var add_user = require("../support/pages/page_admin_users_adduser.js");
this.When(/^I Enter in the user details "([^"]*)" "([^"]*)" "([^"]*)" "([^"]*)"$/, function (arg1, arg2, arg3, arg4) {
add_user.first_name_textfield.waitForVisible()
add_user.first_name_textfield.setValue(arg1)
add_user.last_name_textfield.waitForVisible()
add_user.last_name_textfield.setValue(arg2)
add_user.display_name_textfield.waitForVisible()
add_user.display_name_textfield.setValue(arg1 + " " + arg2)
add_user.email_textfield.waitForVisible()
add_user.email_textfield.setValue(arg3)
add_user.password_textfield.waitForVisible()
add_user.password_textfield.setValue(arg4);
});
}
Copied from original issue: webdriverio/webdriverio#1507
When a retry is kicked off the functions that were added to the World are no longer available on. They are available in the first run ( as retry has not been kicked off) when the retry happens it looks like it removes the World context from the step definitions.
// worldjs
const expect = require('chai').expect;
const fixedUsers = require('../../../lib/fixtures/fixture.users');
const routes = require('../../../config/dist/routes');
const Brain = require('../../../lib/tools/dist/brain');
const users = require('../../../lib/api/dist/users');
function World () {
this.fixedUsers = fixedUsers;
this.expect = expect;
this.routes = routes;
this.brain = new Brain();
this.users = users;
};
module.exports = function () {
this.World = World;
};
//step defs
this.Given(/^some step definition$/, { retry: 2 }, () => {
// Access to this.expect and others on runs run,
// when retry happens because something failed
// then the methods from world are undefined
})
wdio-cuucmber-framework version: 0.2.5
wdio version: 4.2.11
cucumber version: 1.2.2
When running cucumber tests in webdriverio, the error logs do not tell me exactly what is wrong with the test. I just see "undefined"
F․․
0 passing (24.70s)
2 pending
1 failing
I'd like to see what is undefined.
I wanted to use version 2 from Github branch (for Cucumber 2.x support), but it cannot be loaded. The package is downloaded correctly to node_modules. (node: v6.11.2)
in package.json
"wdio-cucumber-framework": "webdriverio/wdio-cucumber-framework#cucumberv2",
cat node_modules/wdio-cucumber-framework/package.json
{
"name": "wdio-cucumber-framework",
"version": "1.0.0-beta.0",
"description": "A WebdriverIO plugin. Adapter for Cucumber2 testing framework.",
yarn run v0.27.5
$ ./node_modules/.bin/wdio wdio.conf.js
ERROR: Couldn't load "wdio-cucumber-framework" framework. You need to install it with `$ npm install wdio-cucumber-framework`!
Error: Cannot find module 'wdio-cucumber-framework'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Runner.initialiseFramework (/Users/monkeyking/vega/node_modules/webdriverio/build/lib/runner.js:517:24)
at Runner._callee$ (/Users/monkeyking/vega/node_modules/webdriverio/build/lib/runner.js:100:55)
at tryCatch (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/Users/monkeyking/vega/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at Runner.initialiseFramework (/Users/monkeyking/vega/node_modules/webdriverio/build/lib/runner.js:523:23)
at Runner._callee$ (/Users/monkeyking/vega/node_modules/webdriverio/build/lib/runner.js:100:55)
at tryCatch (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/monkeyking/vega/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/Users/monkeyking/vega/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/monkeyking/vega/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Can you please point me to right direction?
Not sure if its not possible currently or if im doing something wrong.
I really liked how webdriverio works compared to selenium-webdriver. Im trying to use cucumberjs with webdriverio. I created a sample feature file and no step definitions. When i run using webdriverio config it just says as below but does not split the code skeleton snippets to console just how cucumberjs does. Could you help me if i had to set any flag for that?
I've got
wdio wdio.conf.js --cucumberOpts.profile 'critical'
And in cucumber.js file got
module.exports = {
'default': '--format rerun:@rerun.txt',
'critical': '--tags @critical'
}
And various scenarios tagged @wip, @high and 1 tagged as @critical
when I run the wdio running command all the tests run and not that specific profile. Anyone know If im doing something wrong?
Since cucumber-js removed the ast_tree_walker recently (cucumber/cucumber-js@dc698bf) the adapter needs to be adjusted to use https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/support_code/library.js instead to invoke setDefaultTimeout
with latest version of cucumber and ES6 always getting this error
I want to use the 'format' option while I run wdio-cucumber. But I cant figure out how to make this work, lets say I want to write output from cucumber js into a json file.
cucumberOpts: {
failFast: false,
timeout: 20000,
snippets: false,
backtrace: true,
format: ['json:report/out.json']
}
I want to generate my report as cucumber js format as the default 'dot' or 'json' reporter is not a option for me to print pretty cucumber test results
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs
node_modules\npm\bin\npm-cli.js" "install" "wdio-cucumber-framework" "--save-
dev"
npm ERR! node v5.5.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node build.js || nodejs build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node build.js || nodejs bui
ld.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js || nodejs build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
Hello, I'm trying to have cucumber output a json report using the format configuration key. Features run fine, but nothing gets written to the specified file:
cucumberOpts: {
...
format: ['pretty', 'json:bdd-report.json'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
...
},
Any clues?
Hey there,
I got a problem to access the "world" instance from afterStep or other hooks. Is this possible?
best regards
Philipp
This is my config. It is not working if i pass a directory to require parameter. If i pass a specific step definition file, it works. So, I can't run multiple step definitions with this.
exports.config = {
/**
* server configurations
*/
host: '172.20.197.113',
port: 4444,
/**
* specify test files
*/
specs: [
'./runner-specs/cucumber/features/*.feature'
],
/**
* capabilities
*/
capabilities: [{
browserName: 'chrome',
version: '42.0'
}],
/**
* test configurations
*/
logLevel: 'silent',
coloredLogs: true,
screenshotPath: 'shots',
waitforTimeout: 10000,
framework: 'cucumber',
reporters: ['dot'],
reporterOptions: {
outputDir: './'
},
cucumberOpts: {
require: ['./runner-specs/cucumber/features/step_definitions/']
}
};
@christian-bromann First of all, I m sorry to bring up this back. Couldnt reopen the older issue. I know you replied to this in the other issue i created #56
But just thought to understand/get clear. Sorry again on first place.
So i see protractor cucumber framework (https://www.npmjs.com/package/protractor-cucumber-framework) does print the snippets to the console. So it must be getting that from cucumber in some way right?
When i run the cucumber tests with protractor, when there are no steps defined it prints as below in the console.
But when i run similar test with wdio-cucumber-framework, i get the below in console -->
It doesnt display the snippets for undefined steps.
This would be a useful feature as someone new to the framework can use this skeleton to build tests.
Is this something still could be added as a functionality or do i have to set any flag or this is out of scope for wdio-cucumber-framework?
It seems unnecessary as whether the element is an inputfield should be inferable via an element's tagName
Unless I'm missing a caveat or edgecases
cc @dhoulker
I'm using the cucumber framework for my tests.
I've tried to use a customer reporter that i wrote when using Mocha, however the test:start
event doesn't seem to be firing when i switch to cucumber.
The 'start'
and 'suite:start'
events are working fine.
Has anyone else run into this?
Cucumber.SupportCode seems to be undefined. This is a problem for someone working through the examples, because the default install of cucumber.js is now 2.x.
[22:52:40] COMMAND POST "/wd/hub/session"
[22:52:40] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":5,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.4.0","name":"webdriverio"}}}
[22:52:42] INFO SET SESSION ID ceb7807c-b201-46b9-b25e-e01c32ba4403
[22:52:42] RESULT {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed)","userDataDir":"C:\\Users\\mmiller\\AppData\\Local\\Temp\\scoped_dir26084_13138"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"version":"54.0.2840.99","platform":"XP","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"ceb7807c-b201-46b9-b25e-e01c32ba4403","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
ERROR: Cannot read property 'StepDefinition' of undefined
chrome
Type at new CucumberAdapter (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\build\adapter.js:227:55)
at Object.callee$0$0$ (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\build\adapter.js:416:27)
at tryCatch (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:72:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:334:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:105:21)
at tryCatch (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:72:40)
at invoke (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:146:20)
at C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:191:11
at Promise.exports.(anonymous function).target.(anonymous function).function.target.(anonymous function).F (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\core-js\library\modules\$.export.js:30:36)
at callInvokeWithMethodAndArg (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:190:16)
at AsyncIterator.enqueue (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:211:37)
at AsyncIterator.prototype.(anonymous function) [as next] (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:105:21)
at Object.runtime.async (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\node_modules\babel-runtime\regenerator\runtime.js:228:12)
at Object.callee$0$0 [as run] (C:\repositories\webdriverio-test\node_modules\wdio-cucumber-framework\build\adapter.js:413:32)
at Runner._callee$ (C:\repositories\webdriverio-test\node_modules\webdriverio\build\lib\runner.js:228:55)
at tryCatch (C:\repositories\webdriverio-test\node_modules\regenerator-runtime\runtime.js:63:40)
Issue info can be found here:
Just clone cucumber-boilerplate project, npm install and run the demo and got:
/Volumes/Data/tom/www/cucumber-boilerplate/node_modules/webdriverio/build/lib/utils/ReporterStats.js:318
this.getSuiteStats(runner, runner.parent).tests[runner.title] = new TestStats(runner);
^
TypeError: Cannot read property 'tests' of undefined
at ReporterStats.testStart (/Volumes/Data/tom/www/cucumber-boilerplate/node_modules/webdriverio/build/lib/utils/ReporterStats.js:318:54)
at BaseReporter.<anonymous> (/Volumes/Data/tom/www/cucumber-boilerplate/node_modules/webdriverio/build/lib/utils/BaseReporter.js:151:25)
at emitOne (events.js:96:13)
at BaseReporter.emit (events.js:188:7)
at BaseReporter.handleEvent (/Volumes/Data/tom/www/cucumber-boilerplate/node_modules/webdriverio/build/lib/utils/BaseReporter.js:300:27)
at Launcher.messageHandler (/Volumes/Data/tom/www/cucumber-boilerplate/node_modules/webdriverio/build/lib/launcher.js:594:28)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at process.nextTick (internal/child_process.js:752:12)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
If I pin version 0.2.12 explicitly, re-install stuff, it works fine.
Hi there,
I cant get the name-option to work.
if I put into my config:
cucumberOpts: {
name: ['Viewing all teams on the homepage'],
}
it does work.
But when I apply this from the command line:
wdio --cucumberOpts.name="Viewing all teams on the homepage"
the value is a string. But Cucumber.Cli.Configuration
needs to have an array. I can specify the --cucumberOpts.name
twice, but thats an ugly workaround, isn't it?
best regards
Philipp
Problem
The wdio-cucumber-framework does pass the strict option (true/false), but ignores the result. This happens due to the fact that cucumber handles each individual step result regardless of the strict mode setting, but in the end determines the feature result and checks for the strict mode option.
You can see it here in the cucumber project:
https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/runtime/features_runner.js#L6
https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/runtime/features_result.js#L22
Suggestion
The reporter should check for the strict mode option and overwrite the step result in case the step is undefined or skipped/pending to fail
According to the cucumber js documentation hooks can be tagged or have custom timeouts (not the default of 5000)
https://github.com/cucumber/cucumber-js#tagged-hooks
https://github.com/cucumber/cucumber-js#hook-timeouts
I see however no support for this in the hookRunner.js
For some reason when I call the callback() at the end of my test it restarts my test. And keeps looping over my first test.
Any idea why this behavior?
I'm using wdio sync, w/ sync=true
and my steps are sync-my-step.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.