Playwright and Cucumber integration
Hi, I would like to migrate from Protractor with cucumber framework, since it is deprecated. Kindly guide me how to integrate Cucumber in playwright. How to mention feature file path, step definition file path and required files in playwright config.js file. Thanks!423Views0likes0CommentsStuck with Cucumber.js - how do I run the same test on different pages?
Hi all, I'm new to Cucumber.js and automated testing in general. I am using Selenium Webdriver and Cucumber.js to run tests from Node.js, and so far so good. However, I have a hopefully simple problem I just can't seem to find a solution to: How do I run the same test without triggering the "Multiple step definitions match" error? Say, I have 2 .feature files: Feature: Home Page Scenario: Check the home page Given I am on the home page Then there should be a banner // other tests and Feature: About Page Scenario: Check the about page Given I am on the about page Then there should be a banner // other test On their respective .js steps files (homePageSteps.js and aboutPageSteps.js) I have the expression: Then('there should be a banner', async function() { var homeBanner = await banners.checkBannerExists(this, 'banner'); assert.ok(homeBanner!==null); }); But of course running either feature file gives the error: ✖ Then there should be a banner Multiple step definitions match: there should be a banner - features/pages/steps/homePageSteps.js:32 there should be a banner - features/pages/steps/aboutPageSteps.js:20 Does anyone know how I should be going about using the same test in multiple places/pages? PS: I have extracted the checkBannerExists function to `./support/components/banner.js` as such: const { By } = require('selenium-webdriver'); async function checkBannerExists(webdriver, bannerClass) { var banner = await webdriver.driver.findElement(By.className(bannerClass)).getRect(); return banner.height; }; module.exports = { checkBannerExists };357Views0likes0CommentsMultiple Data type in cucumber
Hello All, This is our Scenerio" Feature: Is this valid number? Tell us if it's a valid numberScenario Outline: Is this a valid number Given a <number> When I ask is it a valid number Then I should be told "<answer>"Examples: | number | answer | | 1 | Yes | | One | Nope | | 1.3 | can't say|" and this is our step def "const assert = require("assert"); const { Given, When, Then } = require("@cucumber/cucumber");function isItNumber(number) { if (number === 1) { return "Yes"; } else if (number === "One") { return "Nope"; } else { return "can't say"; } }Given("a {number}", function (number) { console.log("this.number", number); this.a = number; });When("I ask is it a valid number", function () { this.actualAnswer = isItNumber(this.a); });Then("I should be told {string}", function (expectedAnswer) { assert.strictEqual(this.actualAnswer, expectedAnswer); });" But we are getting error with this.347Views0likes0CommentsHow do we execute multiple tags of cucumber in one runner in sequence? We are trying to execute runn
we are trying to automation end to end regression scenarios. We are facing issue where we are not able to put the tags in sequence for each runner. it seems tag 3 to tag 9 are taken on priority and then tag 1 and 2. Ours is Selenium Cucumber framework.199Views0likes0CommentsCompatibility Issues
Hello , I just wanted to know the compatility versions of Node JS and Cucumber JS. Currently I have nodeJS version v16.20.2 and cucumberJS version as 10.0.0, it is saying that,"Cucumber can only run on Node.js versions 18 || >=20". Can anyone tell, which version of cucumberJS should I use with NodeJSv16.20.2? Regards, Siva396Views0likes0CommentsCucumber Feature File as Report replacing the paramter
I have feature files in which most of the test cases are parameterized.... so it is so difficult non-engineers to read it as source of truth. Is it possible to generate complete feature file with examples replacing value. I want to generate html report like below for PO as source of truth (example in Feature : Some BusinessRules --> Rule: UI Rule 1 > TC1 -->TC2 --> Rule: UI Rule 2 --> TC1 -->TC2232Views0likes0Commentscucumber js test data
Hi, I have created a framework that utilize the faker js framework to generate test data and share it across the feature file. Following is a simple example: Scenario Outline: Create a new repository # The repository should be private Given Create a new repository name "<repo>", description "<description>", and README file When Navigate to the home page Then Verify the repository name "<repo>" can be found under Top Repositories Examples: | repo | description | | {string.alpha(10)} | {loren.text} | Due to the fake js framework there are unlimited options (in this example I'm using string.alpha(10) and loren.text). Currently it generate a new feature file with the fake values and I execute the new feature file. I'm looking for a better way to replace the value by changing the feature file document before it's getting executed. Can you guide me on how it can be done? Thanks444Views0likes0CommentsCucumber HTML report does not render when opened via an email
I am trying to send a cucumber HTML report from Jenkins through email. The report is generated successfully in Prestige Park Grove, but when I open it from the email, it does not render properly. What could be the reason for this?633Views0likes0CommentsHow to skip executing the step for a concrete example, but run it for others?
Hi guys! I am trying to find a way how to skip (not execute) only one step for a specific scenario example, but execute it for another one. Current implementation will execute both scenario examples and in cucumber report I will see it's passing for both, but in reality no code should be executed for second example and mark it as not run (or skipped) Basicacally, is there a way how to indicate a step to not be executed if I run it for another @ca example? (as you can see inside step implementation I have if statement only for @us example, but I don't need to execute this step for @ca one. Appreciate for any help! Example of the feature: Scenario Outline: Approve Report Given I login as "<user>" into "portal" And Open "<caseType>" case And I verify the Report has documents When I approve the Report Then the case status changes to "<expectedCaseStatus>" @us Examples: | user | caseType | expectedCaseStatus | | test user | US | US Report Approved | @ca Examples: | user | caseType | expectedCaseStatus | | test user | CA | CA Report Approved | Then('I verify the Report has documents', async function (this: CustomWorld) { const { playwrightConfig: { page }, } = this; const myPage = new MyPage(page); const caseTypeName = this.getGlobalVariable('caseType'); if (caseTypeName.includes('US')) { await myPage.openDocumentTab(); expect(myPage.documentStatus('my status')); } } );878Views0likes0Comments