Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with execution after just updating cucumber to latest version(4.2.1) #68

Open
tigerdhana017 opened this issue Jun 4, 2018 · 6 comments

Comments

@tigerdhana017
Copy link

Hi,

I tried to run this project with just updating cucumber version to latest(4.2.1).
But I've caught an error below:

My-MAC:selenium-cucumber-js fbb$node index.js
/Users/fbb/Frameworks/cucumber-test8/selenium-cucumber-js/node_modules/babel-runtime/helpers/classCallCheck.js:7
throw new TypeError("Cannot call a class as a function");
^

TypeError: Cannot call a class as a function
at exports.default (/Users/fbb/Frameworks/cucumber-test8/selenium-cucumber-js/node_modules/babel-runtime/helpers/classCallCheck.js:7:11)
at Object.Cli (/Users/fbb/Frameworks/cucumber-test8/selenium-cucumber-js/node_modules/cucumber/lib/cli/index.js:78:34)
at Object. (/Users/fbb/Frameworks/cucumber-test8/selenium-cucumber-js/index.js:128:28)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

Kindly let me know what am I doing wrong here.

@kbytesys
Copy link
Contributor

kbytesys commented Aug 31, 2018

I think that the new version of cucumber requires a huge refactoring of the project :|

In the next days I will try to update the version and will change the whole code to es6 (I need a new cucumber version and es6 for an internal project used by my company), but I don't think that the owner of the project will be happy :P

@john-doherty
Copy link
Owner

Why would you change the codebase to es6?

@kbytesys
Copy link
Contributor

kbytesys commented Aug 31, 2018

Because the latest cucumber-js release uses es6 and you need to refactor index.js and world.js in order to use that library. We can't mix es5 and es6 because eslint will scream to us and run in circle 😄

BTW this could make the implementation of the helpers, steps, etc... much simpler:

Look to your example at "step-definitions/google-search-steps.js", you can write it in this way with es6:

    this.Then(/^I should see some results$/, () =>
        driver.wait(until.elementsLocated(by.css('div.g')), 10000)
            .then(() => driver.findElements(by.css('div.g')))
            .then((elements) => expect(elements.length).to.not.equal(0))
    );

@john-doherty
Copy link
Owner

john-doherty commented Aug 31, 2018

If that's true, it'll impact everyone using the project and all the tests/page objects they've created. I'll be honest, I'm not convinced it's necessary

@srutikritee
Copy link

When I am trying to upgrade to newer version from index file getting some error. Its not related to es5/6. Its related to Cli. Would you be able to help me on this.

@dcmarti
Copy link

dcmarti commented Apr 2, 2020

I've made changes to selenium-cucumber-js to make it compatible with Cucumber-js v6.0. There were a lot of braking changes :/ and upgrade is not backwards compatible.

To get it work you need to:

  1. Upgrade all step-definitions to use new sytax (remove this and module.export). Both features and page-objects should work fine.
  2. Unfortunately require-dir no longer support camel-case - you need to change folder name to camelCase to keep it working.
  3. I've changed command to selenium-cucumber-es6.

Repository: https://github.com/dcmarti/selenium-cucumber-es6
Comments are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants