webdriverio / create-wdio

One-line installer for WebdriverIO
https://webdriver.io
MIT License
21 stars 10 forks source link

Running npm init wdio@latest ./e2e gives errors #474

Closed vikramjb closed 1 year ago

vikramjb commented 1 year ago

This worked last night but when trying to setup a new framework by running the command given below tonight, it is giving errors

Command to Run : npm init wdio@latest ./e2e

Output of the command:

Need to install the following packages: create-wdio@8.2.4 Ok to proceed? (y) y

             -:...........................-:.
             +                              +
          `` +      `...`        `...`      + `
        ./+/ +    .:://:::`    `::///::`  ` + ++/.
       .+oo+ +    /:+ooo+-/    /-+ooo+-/ ./ + +oo+.
       -ooo+ +    /-+ooo+-/    /-+ooo+-/ .: + +ooo.
        -+o+ +    `::///:-`    `::///::`    + +o+-
         ``. /.     `````        `````     .: .``
              .----------------------------.
       `-::::::::::::::::::::::::::::::::::::::::-`
      .+oooo/:------------------------------:/oooo+.
  `.--/oooo-                                  :oooo/--.`
.::-``:oooo`                                  .oooo-``-::.

./--oooo--.: :.-- .oooo- -/. -/ -/oooo////////////////////////////////////oooo/. /- +`/+oooooooooooooooooooooooooooooooooooooooooooooooo+: .+ -/ +o/.:oooooooooooooooooooooooooooooooooooooooooooo:-/o/ +. -/ .o+ -oooosoooososssssooooo------------------:oooo-oo+. -/ .o+ -oooodooohyyssosshoooo .oooo- oo. +. -/ .o+ -oooodooysdooooooyyooo`.--.`` .:::-oooo- oo. +. -/ .o+ -oooodoyyodsoooooyyooo.//-..-:/:..//../oooo- oo. +. -/ .o+ -oooohsyoooyysssysoooo+- -:::. .oooo- oo. +. -/ .o+ -ooooosooooooosooooooo+//////////////////oooo- oo. +. -/ .o+ -oooooooooooooooooooooooooooooooooooooooooooo- oo. +. -/ .o+ -oooooooooooooooooooooooooooooooooooooooooooo- oo. +. -+////o+ -oooo---:///:----://::------------------:oooo- oo////+- +ooooooo/-oooo`:-```.:.:..+/- .:::::::::: .oooo-+ooooooo+ oooooooo+-oooo--/.:+ -/-/.:::::::::: .oooo-.+oooooooo +-/+://-/ -oooo-:.o-:.:-```.: .///:`````` -oooo-/-//:+:-+ : :..--:-:.+ooo+/://o+/-.-:////:-....-::::-....--/+ooo+.:.:--.-- /

Installing @wdio/cli to initialize project... ✔ Success!

=============================== 🤖 WDIO Configuration Wizard 🧙

? What type of testing would you like to do? E2E Testing - of Web or Mobile Applications ? Where is your automation backend located? On my local machine ? Which environment you would like to automate? Web - web applications in the browser ? With which browser should we start? Chrome ? Which framework do you want to use? Cucumber (https://cucumber.io/) ? Do you want to use a compiler? TypeScript (https://www.typescriptlang.org/) ? Do you want WebdriverIO to autogenerate some test files? Yes ? Where should these feature files be located? C:\Projects\SourceTrials\wdtests\e2e\features**.feature ? Where should these step definitions be located? C:\Projects\SourceTrials\wdtests\e2e\features\step-definitions\steps.ts ? Do you want to use page objects (https://martinfowler.com/bliki/PageObject.html)? Yes ? Where are your page objects located? C:\Projects\SourceTrials\wdtests\e2e\features\pageobjects**.ts ? Which reporter do you want to use? spec ? Do you want to add a plugin to your test setup? ? Do you want to add a service to your test setup? chromedriver ? What is the base url? http://localhost ? Do you want me to run npm install Yes

Setting up TypeScript... ✔ Success!

Installing wdio packages:

added 159 packages, and audited 612 packages in 31s

88 packages are looking for funding run npm fund for details

9 moderate severity vulnerabilities

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details. ✔ Success!

Creating a WebdriverIO config file... ✔ Success!

Autogenerating test files... wdio.js config

Initialize WebdriverIO and setup configuration in your current project.

Options: --version Show version number [boolean] --watch Run WebdriverIO in watch mode [boolean] -h, --hostname automation driver host address [string] -p, --port automation driver port [number] --path path to WebDriver endpoints (default "/") [string] -u, --user username if using a cloud service as automation backend [string] -k, --key corresponding access key to the user [string] -l, --logLevel level of logging verbosity [choices: "trace", "debug", "info", "warn", "error", "silent"] --bail stop test runner after specific amount of tests have fa iled [number] --baseUrl shorten url command calls by setting a base url[string] -w, --waitforTimeout timeout for all waitForXXX commands [number] -f, --framework defines the framework (Mocha, Jasmine or Cucumber) to r un the specs [string] -r, --reporters reporters to print out the results on stdout [array] --suite overwrites the specs attribute and runs the defined sui te [array] --spec run only a certain spec file - overrides specs piped fr om stdin [array] --exclude exclude certain spec file from the test run - overrides exclude piped from stdin [array] --multi-run Run individual spec files x amount of times [number] --mochaOpts Mocha options --jasmineOpts Jasmine options --cucumberOpts Cucumber options --autoCompileOpts Auto compilation options --coverage Enable coverage for browser runner --yarn Install packages via Yarn package manager. [boolean] [default: false] -y, --yes will fill in all config defaults without prompting [boolean] [default: false] -t, --npmTag define NPM tag to use for WebdriverIO related packages [string] [default: "latest"] --help Show help [boolean]

Documentation: https://webdriver.io @wdio/cli (v8.12.1)

Error: ⚠️ Couldn't write config file: ReferenceError: C:\Projects\SourceTrials\wdtests\e2e\node_modules\@wdio\cli\build\templates\exampleFiles\cucumber\step_definitions\steps.js.ejs:9 7| */ 8| if (answers.usePageObjects) { %>

9| <%- answers.isUsingTypeScript || answers.esmSupport 10| ? import LoginPage from '${relativePath}/login.page${answers.esmSupport ? '.js' : ''}'; 11| : const LoginPage = require('${relativePath}/login.page'); %> 12| <%- answers.isUsingTypeScript || answers.esmSupport

relativePath is not defined at eval ("C:\Projects\SourceTrials\wdtests\e2e\node_modules\@wdio\cli\build\templates\exampleFiles\cucumber\step_definitions\steps.js.ejs":25:33) at steps.js (C:\Projects\SourceTrials\wdtests\e2e\node_modules\ejs\lib\ejs.js:703:17) at tryHandleCache (C:\Projects\SourceTrials\wdtests\e2e\node_modules\ejs\lib\ejs.js:274:36) at exports.renderFile (C:\Projects\SourceTrials\wdtests\e2e\node_modules\ejs\lib\ejs.js:491:10) at node:internal/util:375:7 at new Promise () at node:internal/util:361:12 at generateLocalRunnerTestFiles (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/utils.js:369:35) at async createWDIOConfig (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/utils.js:730:13) at async runConfigCommand (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/commands/config.js:119:5) at createWDIOConfig (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/utils.js:735:15) at async runConfigCommand (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/commands/config.js:119:5) at async Object.handler (file:///C:/Projects/SourceTrials/wdtests/e2e/node_modules/@wdio/cli/build/commands/config.js:129:5)

⚠️ Ups, something went wrong: Error calling: npx wdio config! npm ERR! code 1 npm ERR! path C:\Projects\SourceTrials\wdtests npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-wdio ./e2e

npm ERR! A complete log of this run can be found in: npm ERR! D:\Users\v\AppData\Local\npm-cache_logs\2023-07-10T13_32_20_639Z-debug-0.log

Not entirely sure what the problem is or what change to cause this error. Any help would be appreciated.

christian-bromann commented 1 year ago

Pushed a fix and triggered a release. This should be out any minute. Thanks for reporting.

vikramjb commented 1 year ago

@christian-bromann That worked!. Fantastic response mate :)