How to pass parameters between steps in Cucumber with JS?
Hi guys, I have a small issue with Cucumber and I'm new to it, I have the scenarios below: Scenario: 005 I can checkout successfully when entering valid information at required fields When I enter first name into field First Name Scenario: 006.... And Order Information displays first name correctly I had entered value in the first scenario and I want to pass that value into the 2nd scenario but don't know how6.2KViews0likes1CommentError when running DataTables in Cucumber 7.0.0
Hello! I have stumbled upon many issues regarding my Cucumber Uplift to version 7.0.0 and I cannot seem to find a solution for this error: Can't convert DataTable to List<Map<class java.lang.String,class java.lang.String>>. You have to write the conversion for it in this method. I cannot add the code here since its confidential but do you know how to solve this issue? The method uses DataTableWrapper and from what I have read the issue should be solved by changing getMaps to getLists but that does not work for me. All kinds of help would be greatly appreciated! Best Regards Lisa MarieSolved5.7KViews0likes1CommentSetting timeout does not work with cucumber-js v7
Hi I'm busy migrating our tests from v6 to v7. We set the timeout using the setDefaultTimeout function. With v6 everything is working fine. With v7 it seems that setDefaultTimeout is not working, I only get the timeouts to work in step methods when I add { timeout: 60000}. Any ideas what can be different between v6 and v7? Regards Marco3.9KViews0likes2CommentsWhat are the new features that will get Updated cucumber from info cukes 1.2.5 to io.cucumber 4.7.2
Hi All , I want to know what are the new features that are added in the cucumber version 4.7.2 from cucumber version 1.2.5 currently i am using info.cukes cucumber 1.2.5 and planning to update to io.cucumber 4.7.2(or any latest version) . Will these things possible in the updated version 1) Parallel execution with out any third party plugin ( on scenario basis and also while running in a grid ) 2) Automatic mail sending with extend report generation 3) Automatic mail after executing scenario please share me the details of updated features and suggest me that updating is better or not ,will i get any exiting features or not Thanks in AdvanceSolved3.6KViews0likes2CommentsWelcome to the Cucumber Open community
You have come to the right place for questions about Behaviour-Driven Development and Cucumber Open (the open source implementations of Cucumber). Please follow these guidelines: Keeping it as short as possible, only including the essential parts of source code, logs and error messages Say what Cucumber platform and version you are using (for example Cucumber-JVM 6.0.0.RC1) Ask the community instead of asking individuals directly as it puts unnecessary pressure on them and excludes others ASK YOUR CUCUMBERQUESTION Thanks for using Cucumber! 🥒🥒🥒2.7KViews0likes0CommentsCucumber: My test scenario is running twice - I only want it to run once
I am running a cucumber puppeteer project in node.js I have only one feature file with one scenario. I have only one step file. In the last step I close the browser. However the browser re-launches and repeats the test. Both runs pass with no failures. How do I stop the repeat test? This is feature file ------------------------------------------- Feature:RollForwardandBack Scenario:Verifypro2login,rollforward GivenThebrowserisopen WhenIopenpro2site WhenIentervalidusernameandpassword WhenIclicktheloginbutton ThenIseeSelectCompanyDialog WhenIclickSelectdropdown ThenIseelistofcompanies WhenIselectxxx company WhenIclickLogintoCompany ThenIgotohomepage WhenIselectmymodelinmodellist WhenIclickontheRevenuefolderinleftnav WhenIclickonRevenueSummary2inleftnav WhenIgotoRevenueSummarypage WhenIclickonRollForwardintopmenubar WhenIseeRollModelForwardDialog WhenIclickonarrowtotherightofthecurrentMonth WhenIseeaconfirmationdialog WhenIclickSave ThenIconfirmthatForecaststartperiodinthegridhasincreasedby1month WhenIsavetheForecastdate WhenIclickonTOC ThenIconfirmTOCForecaststartperiodiscorrect WhenIagainclickonRollForwardintopmenubar ThenIconfirmthattheForecaststartperiodinthedialogboxhasincreasedby1month WhenIclickonarrowtotheleftofthecurrentmonth WhenIagainseeaconfirmationdialog WhenIagainclickSave WhenIagainclickonRevenueSummary2inleftnav ThenIconfirmthatForecaststartperiodinthegridhasdecreasedby1month const { When, Then, Given } = require("cucumber") var chai = require('chai') , expect = chai.expect() , should = chai.should() const puppeteer = require("puppeteer") const dotenv = require("dotenv") dotenv.config({ path: 'config.env' }); const company = 'xxx'; let utils = require('./../../utility/utils'); let dateDifferenceDays; let originalDateStr; let originalDate; let rolledDateStr; let rolledDate; let originaFirstForecastColumnLetter; let originaFirstForecastColumnInt; let rolledFirstForecastColumnLetter; let rolledFirstForecastColumnInt; let forecastDate; async function openBrowser() { return await this.launchBrowser(); // this.browser = await puppeteer.launch({ headless: false, defaultViewport: null }) // this.page = await this.browser.newPage(); } async function openPro2Site() { expectedUrl = 'https://pro2.xxx.com'; return await this.visit(expectedUrl); } async function enterValidUsernameAndPassword() { return await this.fillLoginForm(process.env.USER); // await this.page.waitForFunction( // 'document.querySelector("#inputEmail")' // ); // await this.page.type('#inputEmail', process.env.USER); // await this.page.type('#inputPassword', process.env.PASSWORD); } async function clickLoginButton() { await this.page.waitForFunction( 'document.querySelector("body").innerText.includes("Login")' ); await this.page.click('button[class="btn btn-block mt-2"]'); } async function selectCompanyDialog() { await this.page.waitForFunction( 'document.querySelector("body").innerText.includes("Select Company")' ); } async function clickSelectDropdown() { // try input[id=["react-select-2-input"]; //const selector = '.css-1e07y6s'; const selector='input[id="react-select-2-input"]'; return await this.clickSelectDropdown(company, selector); //return await this.clickAfterWaitForSelector(selector); } async function selectIndoreCCompany() { const selector = '#react-select-2-option-24'; await this.clickSelectedCompany(company, selector,1000); } async function loginToCompany() { await this.page.waitFor(500); await this.page.click('button[class="btn btn-block mt-3"]'); } async function seeCompanyList() { await this.page.waitForFunction( 'document.querySelector("body").innerText.includes("xxx")' ); } async function goToHomePage() { await this.page.waitFor(1500); await this.page.url().should.equal('https://pro2.xxx.com/#/'); console.log('got to login 100'); } async function selectMyModel() { await this.page.waitFor(20000);// This was very necessary //Expose selected model title h4 const btnSelector = 'button[class="btn btn-lg modu-threepointbt br-left-30 br-right-30"]'; //Expose model list await this.page.click(btnSelector); await this.page.waitFor(5000); const result0 = await this.page.evaluate(() => { [...element] = document.querySelectorAll('h4[class="addmodul-name"]'); return [...element.map(x => x.textContent.trim())]; }); let selectedModel = result0[0]; if (selectedModel !== 'mymodel') { const result = await this.page.evaluate(() => { [...element] = document.querySelectorAll('span[id="updateModal"]'); return [...element.map(x => x.textContent.trim())]; }); const model = 'mymodel'; const foundIndex = result.indexOf(model) let selector3 = `.appendmod-header li:nth-child(${foundIndex + 1}) > #updateModal`; await this.clickAfterWaitForSelector(selector3); await this.page.waitFor(5000); } //close model list await this.page.click(btnSelector); } async function clickRevenueFolder() { let selector; const result = await this.page.evaluate(() => { [...element] = document.querySelectorAll('a[href^="#function"'); return [...element.map(x => x.textContent.trim())]; }); const folderTitle = 'Revenue'; const foundIndex = result.indexOf(folderTitle) if (result[0] === 'Financial') { selector = 'a[href="#function1"]'; } else { selector = 'a[href="#function0"]'; } await this.clickSelector(selector); } async function clickRevenuePage() { this.page.waitFor(8000); await this.page.evaluate(() => { selector = 'a[href="#/sheet/6106"]' this.document.querySelector(selector).click() }) } async function verifyRevenueSummaryPage() { const url = 'https://pro2.xxx.com/#/sheet/6106'; //const wait = 25000; const wait = 5000; await this.verifyUrl(url, wait); } async function clickRollForwardInMenu() { const selector = 'a[id="rollmodelDropdown"]'; await this.clickSelector(selector); } async function getOriginalDate() { //from dialog box const selectorTitle = 'p[class="dropdown-item title"]'; const selectorDate = 'div[class="rollmodel_cal_date"]'; originalDate = await this.getOriginalForecastDateStr(selectorTitle, selectorDate); // format Dec-22 } async function clickRollForwardArrow() { const selector = 'i[class="fas fa-chevron-right"]' await this.clickAfterWaitForSelector(selector); } async function waitForConfirmationDialog() { const selector = 'section[class="modal-main liappend-headermodal position-relative"]'; await this.waitForThisSelector(selector); } async function clickSave() { const selector = 'button[class="btn mymodalbtn_save float-right"]' await this.clickAfterWaitForSelector(selector); } // async function waitForToaster() { // selector = 'document.querySelector("body").innerText.includes("forecast date updated successfully")' // vanishDelay = 10 * 1000; // await this.confirmToaster(selector, vanishDelay); // } async function confirmRollForwardGrid() { const selector = 'div.grid-column-header-forecast'; const wait = (240 * 1000); const monthDifference = await this.confirmRollGrid(selector, originalDate, wait); monthDifference.should.equal(1); } async function saveForecastDate() { const selector = 'div.grid-column-header-forecast'; forecastDate = await this.getForecastDate(selector, 0); } async function clickTOC() { const wait = 3 * 1000; selector = 'a[data-for="sidebarTableContent"]'; await this.clickTOCInLeftNav(selector, wait); } async function confirmTOC() { //selector = 'div[class="custom-control custom-radio d-flex flex-row chart-time-frame-model-label-text"]'; selector = '.w-90 > .form-row > .form-group > .d-flex:nth-child(2) > .custom-control:nth-child(2)' const wait = (1 * 1000); const monthDifference = await this.confirmTOCForecastDate(selector, forecastDate, wait); monthDifference.should.equal(0); } async function clickRollForwardInMenuAgain() { const selector = 'a[id="rollmodelDropdown"]'; const wait = 10 * 1000; await this.clickSelector(selector, wait); await this.page.waitFor(2 * 1000); } async function confirmRollForwardDialog() { const selector = 'div[class="rollmodel_cal_date"]'; rolledDateStr = await this.getRolledDateStr(selector); monthDifference = await this.confirmRollDialog(rolledDateStr, originalDate); monthDifference.should.equal(1); } async function clickRollBackwardArrow() { const selector = 'i[class="fas fa-chevron-left"]' await this.clickAfterWaitForSelector(selector); } async function confirmRollBackwardGrid() { const selector = 'div.grid-column-header-forecast'; const wait = (30 * 1000); const monthDifference = await this.confirmRollGrid(selector, originalDate, wait); monthDifference.should.equal(0); await this.closeBrowser(); } //////////////////////////////////// // async function clickRollBackwardArrow() { // selector='i[class="fas fa-chevron-left"]' // } ///////////////////////////////////// //LOGIN SECTION Given("The browser is open", { timeout: 30000 }, openBrowser) When("I open pro2 site", { timeout: 10000 }, openPro2Site); When("I enter valid username and password", enterValidUsernameAndPassword); When("I click the login button", clickLoginButton); Then("I see Select Company Dialog", selectCompanyDialog); When("I click Select dropdown", { timeout: 10000 }, clickSelectDropdown); Then("I see list of companies", seeCompanyList); When('I select IndoreC company', selectIndoreCCompany); When('I click Login to Company', loginToCompany); Then('I go to home page', goToHomePage); ////////////////////////////////////// When('I select mymodel in model list', { timeout: 60000 }, selectMyModel); When('I click on the Revenue folder in left nav', { timeout: 60000 }, clickRevenueFolder); When('I click on Revenue Summary 2 in left nav', { timeout: 60000 }, clickRevenuePage); When("I go to Revenue Summary page", { timeout: 60000 }, verifyRevenueSummaryPage); When('I click on Roll Forward in top menu bar', clickRollForwardInMenu); When('I see Roll Model Forward Dialog', getOriginalDate); When('I click on arrow to the right of the current Month', clickRollForwardArrow); When('I see a confirmation dialog', waitForConfirmationDialog); When('I click Save', clickSave); //When('I see a completion toaster within 4 minutes', { timeout: 240 * 1000 }, waitForToaster); Then('I confirm that Forecast start period in the grid has increased by 1 month', { timeout: 250 * 1000 }, confirmRollForwardGrid); When('I save the Forecast date', { timeout: 20000 }, saveForecastDate); When('I click on TOC', { timeout: 20000 }, clickTOC); Then('I confirm TOC Forecast start period is correct', { timeout: 20000 }, confirmTOC) When('I again click on Roll Forward in top menu bar', { timeout: 20000 }, clickRollForwardInMenuAgain); Then('I confirm that the Forecast start period in the dialog box has increased by 1 month', { timeout: 0 }, confirmRollForwardDialog); When('I click on arrow to the left of the current month', clickRollBackwardArrow); When('I again see a confirmation dialog', waitForConfirmationDialog); When('I again click Save', clickSave); When('I again click on Revenue Summary 2 in left nav', { timeout: 60000 }, clickRevenuePage); Then('I confirm that Forecast start period in the grid has decreased by 1 month', { timeout: 60000 }, confirmRollBackwardGrid); I am running a cucumber puppeteer project in node.js I have only one feature file with one scenario. I have only one step file. In the last step I close the browser. However the breowser re-launches and repeats the test. Both runs pass with no failures. How do I stop the repeat test?2.5KViews0likes0Comments[ERR_PACKAGE_PATH_NOT_EXPORTED] when running ng e2e
Hello, trying to use cucumber with protractor in angular. When runningng e2e --port 4201I get an error: E/launcher - Error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED] [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in C:\Users\dndum\Documents\Projects\angular-project\node_modules@cucumber\cucumber\package.json at throwExportsNotFound (internal/modules/esm/resolve.js:299:9) at packageExportsResolve (internal/modules/esm/resolve.js:522:3) at resolveExports (internal/modules/cjs/loader.js:424:36) at Function.Module._findPath (internal/modules/cjs/loader.js:464:31) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:802:27) at Function.Module._load (internal/modules/cjs/loader.js:667:27) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at ModuleLoader.require (C:\Users\dndum\Documents\Projects\angular-project\node_modules@serenity-js\core\src\io\ModuleLoader.ts:68:20) at ModuleLoader.versionOf (C:\Users\dndum\Documents\Projects\angular-project\node_modules@serenity-js\core\src\io\ModuleLoader.ts:80:33) [11:27:45] E/launcher - Process exited with error code 100 An unexpected error occurred: undefined Please advise on how to proceed. Thank you!2.3KViews0likes1CommentCucumber v7 formatter crash
Hi all I'm migrating from cucumber v6 to v7. I run my test using following command: cucumber-jsfeatures/-pui--requiresteps/--format@cucumber/pretty-formatter Whenever I run my test I always get (also without pretty format I get the same error): TypeError: formatter.finished is not a function at bluebird_1.default.each (D:\git\ISCVmain\apps\cath\automation\node_modules\@cucumber\cucumber\lib\cli\index.js:101:33) at tryCatcher (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\util.js:16:23) at Object.gotValue (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\reduce.js:166:18) at Object.gotAccum (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\reduce.js:155:25) at Object.tryCatcher (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\promise.js:547:31) at Promise._settlePromise (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\promise.js:604:18) at Promise._settlePromise0 (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\promise.js:649:10) at Promise._settlePromises (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\promise.js:729:18) at _drainQueueStep (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\async.js:93:12) at _drainQueue (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\async.js:86:9) at Async._drainQueues (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\async.js:102:5) at Immediate.Async.drainQueues (D:\git\ISCVmain\apps\cath\automation\node_modules\bluebird\js\release\async.js:15:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) Anyone any idea what is happening? Regards Marco2.1KViews0likes3CommentsCucumber Failing to Run on Remote Machine
I'm trying to run cucumber via the locally installed version under the node_modules/.bin folder on a remote machine This is the command I am using '.\node_modules\.bin\cucumber-js --tagstest-framework' This is supposed to run a simple scenario that double-checks that a local instance of my application is running. This is the error message I am getting You appear to be executing an install of cucumber (most likely a global install) 14:17:17 that is different from your local install (the one required in your support files). 14:17:17 For cucumber to work, you need to execute the same install that is required in your support files. 14:17:17 Please execute the locally installed version to run your tests. 14:17:17 14:17:17 Executed Path: F:\Jenkins\workspace\test_app\UiTest.Playwright\node_modules\@cucumber\cucumber\lib\index.js 14:17:17 Local Path: F:\Jenkins\workspace\test_app\UiTest.Playwright\node_modules\@cucumber\cucumber\lib\index.js I understand the issue, in that it isn't happy with the instance of cucumber-js I am trying to use to run the tests but the one is wants me to use (local path) is identical to the executed path, so, I'm at a loss on what to do next. I am not running into this issue on my personal machine, only the remote machine for the record2KViews0likes1Comment