Git Product home page Git Product logo

cucumber-mink's People

Contributors

arnaud-dezandee avatar brockfanning avatar dependabot[bot] avatar greenkeeperio-bot avatar gvianot2 avatar jbelfodil avatar rmat0n avatar rrehbein 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

Watchers

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

cucumber-mink's Issues

Use cucumber mink from within a node javascript file

I want to run cucumber mink using gulp (instead of from the command line).
So to do this, I need to just run mink from a javascript file.

I have tried doing:

const cucumber = require('cucumber');
const Mink = require('cucumber-mink');
Mink.init(cucumber);

and

const { defineSupportCode } = require('cucumber');

defineSupportCode((cucumber) => {
  const Mink = require('cucumber-mink');
  Mink.init(cucumber);
});

However, both times I receive the same error:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.relative (path.js:1247:5)
    at getDefinitionLineAndUri (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:146:28)
    at Object.BeforeAll (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:84:34)
    at Mink.registerHooks (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber-mink/src/mink.js:180:14)
    at Mink.init (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber-mink/src/mink.js:80:10)
    at Object.<anonymous> (/Users/lishmanm/Documents/workspace/cucumber-test/test.js:3:6)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

Is it possible to run cucumber mink from a javascript file rather than the command line?
Is there something I am missing/not understanding here?

How to access webdriver additional functions?

I have a step definition that clears all cookies and looks like this:

    this.Given(/^I am an anonymous user$/, function (callback) {
   //https://selenium.googlecode.com/git/docs/api/py/webdriver_remote/selenium.webdriver.remote.webdriver.html
   browser.manage().deleteAllCookies().then(callback);
   });

However, the way I am running the code (cucumber-mink -- -r mink.js etc), I am unable to get to 'browser' or 'browser.manage()'.

If I try this.driver or this.driver.manage() -- no luck.

Also I have additional functionality that uses the Protractor driver (waitForAngular). Do I need to invoke cucumber-mink via cucumber-js to fix this problem? My other issue asks that thanks #163

Clarify the doc, add working exemples ?

Hi, thanks for this package, I believe it has a huge potential, beeing a fan of behat/mink myself.
However as an advanced beginner in javascript I struggle to make it work.

Could you add working exemples ?

Problem 1 : Local or global install ?

According to this issue : cucumber/cucumber-js#908, cucumber needs to be installed locally only
When I run

npm install -g cucumber && npm install -g cucumber-mink
cucumber-mink

I got :

Error: Cannot find module 'cucumber' from '/Volumes/data/projects/test-cucumber-mink'
...

Problem 2 - how to use support files ?

Do you have a working exemple on how to use support files ?
It took me a long time to understand that the exemples in the code repository are written in es-6, finally I used the code described here, and finally succeed in opening a browser with selenium (protractor webdriver-manager)
Also I had to dig into the issues to find this: ./node_modules/.bin/cucumber-mink --inject=false -- -r features/support/mink.js

Problem 3

Maybe not related to cucumber-mink, but I tried all the browsers, including phantom js, and they all return a blank page, whathever I do

Failures:

1) Scenario: Go on post 1 # features/test.feature:3
   ✔ When I browse "http://cucumber-mink.js.org/" # node_modules/cucumber-mink/src/mink.js:115
   ✔ Then I wait 3 seconds # node_modules/cucumber-mink/src/mink.js:115
   ✖ Then I should see "In order to run ours test suite" # node_modules/cucumber-mink/src/mink.js:115
       AssertionError: expected '<html><head></head><body></body></html>' to include 'In order to run ours test suite'
           at Object.driver.html.then (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber-mink/src/step_definitions/assert_dom.js:13:21)
           at Object.exec (/Volumes/data/projects/test-cucumber-mink/node_modules/webdriverio/build/lib/helpers/safeExecute.js:28:24)
           at Object.resolve (/Volumes/data/projects/test-cucumber-mink/node_modules/webdriverio/build/lib/webdriverio.js:189:29)
           at /Volumes/data/projects/test-cucumber-mink/node_modules/webdriverio/build/lib/webdriverio.js:538:32
           at _fulfilled (/Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:854:54)
           at self.promiseDispatch.done (/Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:883:30)
           at Promise.promise.promiseDispatch (/Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:816:13)
           at /Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:624:44
           at runSingle (/Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:137:13)
           at flush (/Volumes/data/projects/test-cucumber-mink/node_modules/q/q.js:125:13)
           at _combinedTickCallback (internal/process/next_tick.js:67:7)
           at process._tickDomainCallback (internal/process/next_tick.js:122:9)
   - Then I take a screenshot # node_modules/cucumber-mink/src/mink.js:115
   ✖ After # node_modules/cucumber-mink/src/mink.js:192
       TypeError: event.isFailed is not a function
           at World.cucumber.After (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber-mink/src/mink.js:193:20)
           at Function.<anonymous> (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/lib/user_code_runner.js:59:25)
           at next (native)
           at tryCatcher (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/util.js:16:23)
           at PromiseSpawn._promiseFulfilled (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/generators.js:97:49)
           at Function.<anonymous> (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/generators.js:201:15)
           at Function.run (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/lib/user_code_runner.js:120:22)
           at Object.<anonymous> (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/lib/runtime/step_runner.js:40:53)
           at next (native)
           at tryCatcher (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/util.js:16:23)
           at PromiseSpawn._promiseFulfilled (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/generators.js:97:49)
           at Async._drainQueue (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/async.js:138:12)
           at Async._drainQueues (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/async.js:143:10)
           at Immediate.Async.drainQueues (/Volumes/data/projects/test-cucumber-mink/node_modules/cucumber/node_modules/bluebird/js/release/async.js:17:14)
           at runCallback (timers.js:574:20)
           at tryOnImmediate (timers.js:554:5)
           at processImmediate [as _immediateCallback] (timers.js:533:5)

Thank you very much

Incompatible cucumber versions?

Steps to reproduce;

  1. npm install -g cucumberjs
  2. Copy test/features/ from this repository to features/ in a new project/directory
  3. npm install --save cucumber-mink
  4. cucumberjs fails with:
> cucumberjs

/usr/local/lib/node_modules/cucumber/lib/cucumber/runtime/event_broadcaster.js:30
            throw error;
            ^
../../node_modules/cucumber-mink/dist/mink.js:261 function accepts a callback and returns a promise

cucumber.js version 1.2.2
cucumber-mink version 1.4.1

Failing assertions hang

The assertFn(...) calls appear to hang whenever an assertion fails. It doesn't output the step name, just remains stuck after the previous successful step.

I am using version 1.0.1.

For example with I should see "foo" I added a console.log before and after the call to assertFn(html, expectedText) in assert-dom.js. The second log is never reached when the html doesn't include foo, but is when the html does include foo.

I tested a try...catch block around it and the AssertionError is thrown correctly, so it does appear the issue is not with chai as far as I can tell.

manySteps not behaving as scenario

I have the following 'login' scenario

  Scenario: Login as Caroline
    Given I browse "http://example.lo/"
    When I am on "/signout/" #signs out and redirects to signin screen
    And I press "a.btn-signin"
    And I fill in "input#email" with "[email protected]"
    And I press "input#submit-login"
    Then I should see "Caroline"

It works well as such.

I make a single step out of it:

Mink.defineStep(/^I login as "([^"]*)"$/, function(email, callback){
  Mink.manyStep([
    'I am on "/signout/"',
    'I press "a.btn-signin"',
    'I fill in "input#email" with "' + email + '"',
    'I press "input#submit-login"',
  ]);
  callback();
});

and adapt the scenario:

  Scenario: Login as Caroline
    Given I browse "http://example.lo/"
    When I login as "[email protected]"
    Then I should see "Caroline"

The scenario fails.

I went so far as to see that the "fill in" step does not perform in the manyStep version, no clue why.

Any hints?

Separate step definitions from webdriver management

It would be great to use Mink's step definitions without the library creating and managing the webdriver-io instance.

Any plans to make the managed webdriver instance configurable? I'd love to pull just the steps into my project and manage the driver instance separately, but I see they are tightly coupled.

Cucumber-mink not showing steps in browser

I've tied cucumber-mink into an existing test suite which launches the browser and visually shows the steps, however the mink tests don't visually show the steps (the steps pass and fail correctly).

Visual isn't important for me, but others want to see it or it doesn't work. Ideas?

"event.isFailed is not a function" while trying to screenshot

Hi!

I'm using cucumber-js with '-r' option to run cucumber-mink tests. My goal is to execute all the tests, generate a .json output file and create a html report with all tests results (including snapshots on failure scenarios). I'm able to execute all the tests using chrome, but on a failed scenario I see the following behavior:

./node_modules/.bin/cucumber-js -r features/support/mink.js -f json:./cucumber_report.json

...

  1. Scenario: Render in desktop and mobile # features/key.feature:15
    ✔ Given I browse "http://localhost:3000/" # node_modules/cucumber-mink/src/mink.js:115
    ✔ And I am on "/keys" # node_modules/cucumber-mink/src/mink.js:115
    ✖ When I send key "Tab" in "#keys" element # node_modules/cucumber-mink/src/mink.js:115
    Error: An element could not be located on the page using the given search parameters.
    at element("#keys") - click.js:12:17
    at click("#keys") -
    • Then I should see "9" in the "#result" element # node_modules/cucumber-mink/src/mink.js:115
      ✖ After # node_modules/cucumber-mink/src/mink.js:192
      TypeError: event.isFailed is not a function
      at World.cucumber.After (/pauloeliasjr/cucumber-mink-test/node_modules/cucumber-mink/src/mink.js:193:20)
      at Function. (/pauloeliasjr/cucumber-mink-test/node_modules/cucumber/lib/user_code_runner.js:59:25)
      at Generator.next ()
      at Generator.tryCatcher (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/util.js:16:23)
      at PromiseSpawn._promiseFulfilled (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/generators.js:97:49)
      at Function. (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/generators.js:201:15)
      at Function.run (/pauloeliasjr/cucumber-mink-test/node_modules/cucumber/lib/user_code_runner.js:120:22)
      at Object. (/pauloeliasjr/cucumber-mink-test/node_modules/cucumber/lib/runtime/step_runner.js:41:53)
      at Generator.next ()
      at Generator.tryCatcher (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/util.js:16:23)
      at PromiseSpawn._promiseFulfilled (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/generators.js:97:49)
      at Async._drainQueue (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/async.js:138:12)
      at Async._drainQueues (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/async.js:143:10)
      at Immediate.Async.drainQueues (/pauloeliasjr/cucumber-mink-test/node_modules/bluebird/js/release/async.js:17:14)
      at runCallback (timers.js:756:18)
      at tryOnImmediate (timers.js:717:5)

When all tests finish, I'm able to generate the json file but there is no reference on it to any screenshot taken from any failed scenario. The odd thing is that I can see the screenshots file on my current directory after the tests execution.

-rw-r--r-- 1 root root 28011 Jan 30 18:27 ERROR_chrome_2018-01-30T18-27-37.901Z.png
-rw-r--r-- 1 root root 28011 Jan 30 18:27 ERROR_chrome_2018-01-30T18-27-38.130Z.png
-rw-r--r-- 1 root root 28011 Jan 30 18:27 ERROR_chrome_2018-01-30T18-27-38.331Z.png
-rw-r--r-- 1 root root 28011 Jan 30 18:27 ERROR_chrome_2018-01-30T18-27-38.549Z.png
-rw-r--r-- 1 root root 28011 Jan 30 18:27 ERROR_chrome_2018-01-30T18-27-38.782Z.png

Am I missing something?
Any help would be appreciated.

manyStep() returns `function accepts a callback and returns a promise`

I'm using Cucumber Mink and I have some quite complex steps that I'd like factor out into a single step to make my scenarios a bit more legible, and I thought Mink.manyStep would fit the bill. However, I'm struggling to get this to work, as I get the error function accepts a callback and returns a promise. Here's what my step definition looks like:

Mink.When(/^I do my thing$/, function (callback) {
  Mink.manyStep([
    'I do thing 1',
    'I do thing 2',
    'I do thing 3',
    'I do thing 4'
  ], callback)
});

It's very possible I'm doing something wrong, would appreciate some guidance if I am! :)

Thanks

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Ability to check cookies

Step definitions allowing to check if a cookie exists would be great.

Worth considering, thanks,

callback function not called in manyStep()

Hi,

I want to hide the technical steps (clicks, input fields values insertion...) from the business features (like, I can login, I can search for, etc).
To do a small tests I wrote a small test which opens https://twitter.com clicks the log in button and then on the new page inserts the values for the username and password fields.
Actually I wanted to test if when I use manyStep definition I could hide the printout of the username and password values when cucumber runs the scenarios

Therefore I tried using the manyStep step definition as follows:
My step definition looks as follows:

`
var Mink = require('cucumber-mink');

function manyStepTest(callback) {
Mink.manyStep([
'I click on "button.submit"',
'I fill in "input[name='session[username_or_email]']" with "Teeest"',
'I fill in "input[name='session[password]']" with "Teeest"',
], callback);
callback(); // hack because that the callback is not used in Mink.manyStep()
}

module.exports = function() {
this.Given(/^I do many steps$/, manyStepTest);
};
`

and my feature looks like this:
`
Feature: I can login on twitter

Background:
Given I browse "https://twitter.com/"

Scenario: Twitter login
When I am on the homepage
Given I do many steps
Then I should see "twitter"
`

When I ran the feature without the last "callback();" in the function manyStepTest from the step definition I got a timeout error:
`
Feature: I can login on twitter

Scenario: Twitter login
Given I browse "https://twitter.com/"
When I am on the homepage
Given I do many steps
Then I should see "twitter"

Failures:

  1. Scenario: Twitter login - features/home.feature:6
    Step: Given I do many steps - features/home.feature:8
    Step Definition: features/step_definitions/login.js:49
    Message:
    function timed out after 5000 milliseconds

1 scenario (1 failed)
4 steps (1 failed, 1 skipped, 2 passed)
0m08.543s
`

With the callback function added, the feature passes without problems:
`
Feature: I can login on twitter

Scenario: Twitter login
Given I browse "https://twitter.com/"
When I am on the homepage
Given I do many steps
Then I should see "twitter"

1 scenario (1 passed)
4 steps (4 passed)
0m01.203s
`

The Cucumber Mink version which I use is: [email protected]

I've checked the source code and I found the manyStep definition in dist/mink.js and src/mink.js but the callback is missing and the function signature is:
function manyStep(lines).

Am I missing something in my manyStep definition? Is a call of the callback function missing in the implementation of the manyStep function or it I must call the callback manually like I did in my step definition?

Best Regards,
Jovan

Driver baseUrl param not being used from support/mink.js

Doing exactly what is done in #22 using v1.6.0 of cucumber mink results in the base url not being set.

This is the directory tree

features
  |-- support
      |-- mink.js

Command: cucumber-mink


If I run BASE_URL=http://google.com cucumber-mink it works.

Problem in version 1.1.0 when running as support for Cucumber.js

Hello,

First I would like to thank you for this project.
The error I'm encountering in cucumber-mink version 1.1.0 is:

$  ./node_modules/.bin/cucumberjs -r ./phantom.js 
/Users/karine/Projects/testing/phantom.js:16
  Mink.init(this, parameters);
       ^

TypeError: Mink.init is not a function
    at Object.module.exports (/Users/karine/Projects/testing/phantom.js:16:8)
    at /Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli/support_code_loader.js:65:25
    at Array.forEach (native)
    at Object.wrapper (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli/support_code_loader.js:62:15)
    at Object.initializer (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli/support_code_loader.js:24:41)
    at Object.Library (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/support_code/library.js:122:25)
    at Object.getSupportCodeLibrary (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli/support_code_loader.js:10:58)
    at Object.getSupportCodeLibrary (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli/configuration.js:128:32)
    at Object.getSupportCodeLibrary (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/runtime.js:43:46)
    at Object.start (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/runtime.js:12:37)
    at Object.run (/Users/karine/Projects/testing/node_modules/cucumber/lib/cucumber/cli.js:60:15)
    at Object.<anonymous> (/Users/karine/Projects/testing/node_modules/cucumber/bin/cucumber.js:4:5)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

My phantom.js file is (and works fine with previous version of cucumber-mink):

var Mink = require('cucumber-mink');

// Phantomjs - GhostDriver
const parameters = {
  driver: {
    screenshotPath: 'test/',
    desiredCapabilities: {
      browserName: 'phantomjs',
    },
    logLevel: 'silent',
    port: 8910,
  },
};

module.exports = function () {
  Mink.init(this, parameters);
}

The cucumberjs version is 0.9.5

Hangs on start, phantomjs running

$ phantomjs --version
1.9.8
$ node --version
v4.2.1
$ cucumber-mink
Cucumber-mink v1.0.2. Launching phantomjs on port 8910...

and then it just sits there?

Configuration options lost

Hello,

While trying to use browserstack as a selenium remote server:

// features/support/mink.js

var Mink = require('cucumber-mink');

// BrowserStack
var parameters = {
    driver: {
        desiredCapabilities: {
            'browserstack.local': true,
            'browserstack.debug': true,
            browser:              'Safari',
            browser_version:      '8.0',
            os:                   'OS X',
            os_version:           'Yosemite',
            resolution:           '1280x1024',
            build:                'Test'
        },
        host:                'hub.browserstack.com',
        port:                80,
        user:                'XXXXXXXXXX',
        key:                 'XXXXXXXXXXXXXXXXXXXX',
        logLevel:            'verbose'
    }
};

console.log("mink.js init script");

module.exports = function () {
    Mink.init(this, parameters);
};

with a single feature:

Feature: Post page

  Background:
    Given I browse "https://thomas.rabaix.net/"

  Scenario: Go on post 1
    Given I am on homepage
    And I follow "Resume"
    Then I should be on "/resume/fr"

The command is started with: node_modules/.bin/cucumber-mink -- -r features/support/mink.js

I get

RuntimeError: Couldn't connect to selenium server
    at init([object Object]) - anonymous function

I dig into the code and I found out that the registerHook method (https://github.com/Adezandee/cucumber-mink/blob/master/src/mink.js#L167) is reseting the unit monad from webdriverio. So we are loosing the original values.

If I output some the hostname value, I get

WebdriverIO Monad hub.browserstack.com  // original configuration value
WebdriverIO Monad 127.0.0.1                       // reset from the hook ...
WebdriverIO Monad 127.0.0.1
WebdriverIO Monad 127.0.0.1

Something is wrong on my side ?

sauce labs in travis

Hi,
I'm trying to get cucumber-mink to run selenium tests against saucelabs from travis. I have sauce connect (sc tool) on in travis.
I've tried every possible combination to try to get this to work. I'm wondering if I'm configuring cucumber-mink and webdriverio correctly.

Roughly what I'm trying is what I have below (based on features/support/mink.js):

  { desiredCapabilities: 
      { browserName: 'internet explorer',
        platform: 'Windows 10',
        version: '11.103',
        'tunnel-identifier': '50.1',
        build: '50',
        name: 'integration',
      },
     host: username + ':' + accessKey + '@localhost',
     port: 4445,
     path: '/wd/hub',
 }

Am I configuring webdriver within cucumber-mink correctly?
Anybody else got this to work?

My run-script looks like this:

node_modules/.bin/cucumber-mink -- --require features/support --require features/step_definitions/

Sauce connect in travis says that selenium is listening on port 4445 within the travis console.

I've successfully run karma using karma-sauce-launcher on saucelabs in travis. The karma-sauce-launcher source code suggests it might be using a host ondemand.saucelabs.com on port 80. It's using wd. I've tried all of that as well.

I always get this (in travis):

{ RuntimeError: Couldn't connect to selenium server
    at init() - anonymous function
  message: 'Couldn\'t connect to selenium server',
  type: 'RuntimeError',
  seleniumStack: 
   { status: -1,
     type: 'ECONNREFUSED',
     message: 'Couldn\'t connect to selenium server',
     orgStatusMessage: 'Couldn\'t connect to selenium server' } }

handling redirects

It seems that cucumber-mink does not by defaut handle redirects transparently (at least with phantomjs).

I could come over some the redirect issues i encountered by adding a "I wait 1 seconds" step.

Why isn't handling redirects? feature or bug?

Can't get Mink working with other cucumberjs step libraries

Was trying to integrate https://github.com/ziprandom/cucumberjs-json-api-mocking into my mink setup, but it fails to find the step definitions and gives error "[ReferenceError: client is not defined]"

const chromedriver = require('chromedriver');
const Mink = require('cucumber-mink');
const jsonApi = require('cucumberjs-json-api-mocking');

const parameters = {
  driver: {
    desiredCapabilities: {
      browserName: 'chrome',
    },
    port: 9515,
  },
};

module.exports = function minkInit() {
  jsonApi.call(this);
  chromedriver.start([
    '--url-base=/wd/hub',
  ]);
  Mink.init(this, parameters);
};

Any help would be appreciated!

Thanks, loving Mink so far!!

Should be on is not working with parameters

For example I have following urls in menu:

/info/?page=terms

So I click on a link and I would like to verify that I am landed where expected

Then I should be on "/info/?page=terms" - doesn't work
while
Then I should be on "/info/" - works fine

What is kind of unexpected.

Driver baseUrl parameter not being used and throwing error

It seems the baseUrl parameter isn't being used by the root method in step_definitions/ext/navigation.js.

I am on version 1.0.0 and have the following configuration:

var mink = require('cucumber-mink');

var parameters = {
  driver: {
    baseUrl: 'https://example.local/',
    port: 3001,
    desiredCapabilities: {
      browserName: 'phantomjs'
    }
  }
};

module.exports = function () {
  mink.init(this, parameters);
};

Using the step And I am on the homepage I get:

Error: Please provide a base url to use root functions !
    at [object Object].exports.root (/path/to/node_modules/cucumber-mink/lib/step_definitions/ext/navigation.js:17:14)
    at Object.<anonymous> (/path/to/features/support/scenarios/auth.js:7:5)
    at process._tickDomainCallback (node.js:381:11)

And using And I am on "/" I get:

TypeError: Parameter 'url' must be a string, not object
    at Url.parse (url.js:110:11)
    at urlParse (url.js:104:5)
    at Object.urlResolve [as resolve] (url.js:437:10)
    at [object Object].exports.browse (/path/to/node_modules/cucumber-mink/lib/step_definitions/ext/navigation.js:24:23)
    at Object.<anonymous> (/path/to/features/support/scenarios/auth.js:7:5)
    at process._tickDomainCallback (node.js:381:11)

Should I not pass it in as a paramter but set it using the a baseUrl() method in step_definitions/ext/utility.js? At what point should that be called?

Couldn't connect to selenium server

Running cucumber-mink I get:

lotus@Infinity:~/code/soundboard-app$ cucumber-mink 
Cucumber-mink v1.0.2. Launching phantomjs on port 8910...

/usr/local/lib/node_modules/cucumber-mink/node_modules/webdriverio/node_modules/q/q.js:141
                throw e;
                      ^
Error: Couldn't connect to selenium server
  at new ErrorHandler.RuntimeError (/usr/local/lib/node_modules/cucumber-mink/node_modules/webdriverio/lib/utils/ErrorHandler.js:92:12)
  at RequestHandler.<anonymous> (/usr/local/lib/node_modules/cucumber-mink/node_modules/webdriverio/lib/utils/RequestHandler.js:147:25)
  at self.callback (/usr/local/lib/node_modules/cucumber-mink/node_modules/webdriverio/node_modules/request/request.js:373:22)
  at Request.emit (events.js:107:17)
  at Request.onRequestError (/usr/local/lib/node_modules/cucumber-mink/node_modules/webdriverio/node_modules/request/request.js:971:8)
  at ClientRequest.emit (events.js:107:17)
  at Socket.socketErrorListener (_http_client.js:271:9)
  at Socket.emit (events.js:107:17)
  at net.js:459:14
  at process._tickDomainCallback (node.js:381:11)

How to run cucumber-mink in remote machine using Selenium-grid's hub and node mode

I have started hub using following command:
"java -jar C:\Selenium\selenium-server-standalone-2.43.1.jar -role hub"
and node
"java -jar C:\Selenium\selenium-server-standalone-2.43.1.jar -role webdriver -hub http://localhost:4444/grid/register -port 8910 -browser browserName="chrome",version=ANY,platform=WINDOWS,maxInstances=5 -Dwebdriver.chrome.driver=C:\Selenium\chromedriver_win32\chromedriver.exe phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444"
but when I am executing chrome browser is not opening instead headless execution using Phantomjs is happening.. Please advice me how to proceed..

How can I re-define build-in step?

Trying to override default step to implement random values, in mink.js I've put:

    Mink.defineStep(/I fill in the following:/, function (hashDataTable) {
        let _this = this;
      return Promise.each(hashDataTable.raw(), function (field, value) {
            value = '12333232';
            _this.driver.setValue(field, value)
        }
      );
    });

and getting:

     Multiple step definitions match:
       /I fill in the following:/ - node_modules/cucumber-mink/dist/mink.js:171
       /I fill in the following:/ - node_modules/cucumber-mink/dist/mink.js:171

Follow sometimes does not click on the url

I am facing a problem with my tests as (sometimes) the follow does not redirect/click on the url .. and when I investigated this issue I found it related to phantomjs .. this is the error occurs to me
[DEBUG] Network - Resource request error: QNetworkReply::NetworkError(OperationCanceledError) ( "Operation canceled" ) URL: "http://localhost:8000/uae-en/categories/Clothing" and this is the issues on phantomjs repo [issue1|https://github.com/ariya/phantomjs/issues/10389] and [issue2|https://github.com/ariya/phantomjs/issues/12750] and I couldn't find a solution ... anyway my question is .. do you in cucumber-mink community have any idea how can I fix this??

Support random ID

Let's imagine very popular scenario where user can have one account per email.

And there is absolutely impossible to reset database after each test or before running cuucmber

So here is my test case:

Given I fill in "input[name='email']" with "[email protected]"
Then I press "Register"
Then I should see "[email protected]"

So when I run this test first time it will be successful.

But If I run it again - it will fail as email already registered.

So my question is how to be able to set some random id? As I see and as I did it before with cucumber - protractor (random id is different for next execution of the same test):

Given I fill in "input[name='email']" with "test.{randomId}@test.te"
Then I press "Register"
Then I should see "test.{randomId}@test.te"

or

Given I set "randomId"
Then I fill in "input[name='email']" with "test.{randomId}@test.te"
Then I press "Register"
Then I should see "test.{randomId}@test.te"

Is there any way to implement it or extend with hooks?

function timeouts when following links

Hello,

I've been playing with this trying to get an existing app tested. Right off the bat, I get an error when I try to follow a link as seen below. Any pointers as to what might be the reason for this to fail?

[17:04:41] Starting 'cucumber'...
.F-

Failures:

1) Scenario: search with valid query shows results # features/demo.feature:6
   ✔ Given I am on the homepage # node_modules/cucumber-mink/src/mink.js:21
   ✖ When I follow "Sobre" # node_modules/cucumber-mink/src/mink.js:21
       Error: function timed out, ensure the promise resolves within 5000 milliseconds
           at Timeout._onTimeout (/Users/paulo/Projects/UX/biscate/biscate.co.mz/node_modules/cucumber/lib/user_code_runner.js:93:22)
           at ontimeout (timers.js:458:11)
           at tryOnTimeout (timers.js:296:5)
           at Timer.listOnTimeout (timers.js:259:5)
   - Then I should see "Maputo" # node_modules/cucumber-mink/src/mink.js:21

1 scenario (1 failed)
3 steps (1 failed, 1 skipped, 1 passed)
0m09.441s
[17:05:17] 'cucumber' errored after 36 s
[17:05:17] Error in plugin "gulp-shell"
Message:
    Command `./node_modules/.bin/cucumber-js` failed with exit code 1

Thanks

elementsWithText should not be case sensitive

Don't you think that would be nice to change protractor.js elementsWithText, so that it's not case sensitive ?
I think if the displayed case is changed by css text-transform, it should not affect the tests

Enhanced support for AngularJS

Cucumber steps are prone to failing inconsistently while waiting for Angular's digest loop to complete, depending on the duration of the loop, and perhaps other factors. The Cucumber-Mink steps are awesome and I'd like to use them in my Angular project.

Do you plan to add support for Angular-based projects?

Or, how can we use Mink with another library, like Protractor, which works more nicely with Angular? Both libraries wrap the webdriver-io instance. It would be great if we could use Mink's steps with Protractor's wrapped webdriver, so that we get Mink's well-considered steps on top of an Angular-friendly driver.

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.