cucumberjs

Protractor option does not work in package.json script

北城以北 提交于 2021-02-11 12:14:15
问题 The following command works as expected: protractor --cucumberOpts.tags='not @tag1' conf.js Now I want to add this command as a script to package.json like this: "scripts": { "my-script": "protractor --cucumberOpts.tags='not @tag1' conf.js" } Running the command npm run my-script gives me the following error: Usage: protractor [configFile] [options] configFile defaults to protractor.conf.js The [options] object will override values from the config file. See the reference config for a full

Automatic Step Generation in cucumber javascript using javascript

狂风中的少年 提交于 2021-02-07 12:24:16
问题 I am using javascript for cucumber javascript for automation.My concern is can i generate .js file for step definitions automatically? as of now am copy pasting them(steps) from command line window so can I skip it and directly generate the step file? 回答1: Two Suggestions: 1. You can create a new gherkin file, and run it with cucumber.js, it will generate JavaScript stub automatically for you. For example: "cucumber-js math.feature" It will output something like: 1) Scenario: easy maths -

CucumberJS: Take screenshot after each step

此生再无相见时 提交于 2021-01-29 03:21:59
问题 Has anybody figured out how to take screenshot for every step of a scenario in cucumberjs, and attach it to the json report? 回答1: Apparently this can be done via a custom reporter, using Cucumber event handlers. browser.takeScreenshot().then((png: any) => { var decodedImage = new Buffer(png, 'base64'); currentStep.embeddings.push({ data: decodedImage.toString('base64'), mime_type: 'image/png' }); }); 来源: https://stackoverflow.com/questions/40832067/cucumberjs-take-screenshot-after-each-step

Error running ./node_modules/.bin/cucumber-js in GitLab CI

∥☆過路亽.° 提交于 2021-01-28 19:45:09
问题 I am setting up a CI build for my node project. Although my npm run test works as expected in my local environment, the gitlab ci is throwing an exception. The test command fails in: > nyc ./node_modules/.bin/cucumber-js ./test/BDD/**/*.feature -f node_modules/cucumber-pretty -f json:./test/report/cucumber_report.json --require-module ts-node/register --require ./test/**/*.ts Error: Parse error in 'test/BDD/step-definition.ts': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine,

How to debug (protractor) cucumberjs framework 'can not find step definition' problem?

和自甴很熟 提交于 2020-04-18 05:47:29
问题 I have used protractor testing along with cucumberjs framework for a while. I've encountered this 'step definition not found' issue before but it was always a config quick fix until I am playing with this 'cukefarm' library at https://www.npmjs.com/package/cukefarm. The 'cukefarm' use 'protractor-cucumber-framework' (https://github.com/protractor-cucumber-framework/protractor-cucumber-framework) which I also played before. So I start following 'cukefarm' readme page and start building a hello

unable to make relative path for step and feature files in protractor cucumberJS

青春壹個敷衍的年華 提交于 2020-03-25 19:22:07
问题 I have designed framework for protractor and for this I want that for each feature file I should be able to navigate to its respective step definition, for that I went through documentation of cucumber gherkin full support https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete and added the given code to settings.json but then also its not navigating to steps Please find the pic of my settings.json and folder structure and suggest me what should be the relative

client.elements is not working from a step definition using nightwatch-api

▼魔方 西西 提交于 2020-03-25 18:38:27
问题 I'm trying to do nightwatch and cucumber integration for BDD. I'm unable to access client.elements function in a step function. const { client } = require('nightwatch-api'); const { Given, Then, When } = require('cucumber'); const homePage = client.page.homepage(); Then(/^click "([^"]*)" service from list$/, async(service) => { let result = await client.url('http://localhost:8080/').elements('css selector', 'div.flex.mt-4.v-card.v-sheet.theme--light > div > div > table > tbody > tr'); console

Is there any way to specify eg (car|cars) in a cucumber step definition?

↘锁芯ラ 提交于 2020-03-25 12:33:20
问题 So I have 2 scenarios....one starts out Given I have 1 car The other starts out Given I have 2 cars I'd like them to use the same step definition - ie something like this Given('I have {int} (car|cars)', I know it's possible to do specify 2 possible values (ie car or cars), but I can't for the life of me remember how. Does anyone know? I'm using typescript, protractor, angular, selenium. Have also tried Given(/^I have {int} (car|cars)$ 回答1: Within cukeExp, the () become optional characters.

Proper usage of cucumber with typescript?

人走茶凉 提交于 2020-03-21 16:03:14
问题 I was following a tutorial but the setup is really bad. Basically it uses typescript to convert .ts files to .js. So basically pollutes your whole source code with .js files around. So as soon as you import your .ts file from source code, all dependencies are duplicated with a .js file. Do you know how to do proper typescript cucumber tests? A hacky solution: Copy all features and all files to another temp folder, run from there. I would expect cucumber to be a bit more mature than this,

Protractor - Error Handling in Framework

一个人想着一个人 提交于 2020-01-23 02:53:04
问题 How can we handle error in a Protractor - Cucumber based framework? There are assert failures, which is a genuine fail and there are errors in javascript code (e.g. - element not found, array is empty, something undefined etc..). I wish to handle the later in a graceful manner. Currently Protractor tests fail for the said errors but the messages are not friendly and hard to comprehend. They mostly point to location of errors in protractor library files and not where the actual error occurred