webdriverio/webdriverio
在 GitHub 查看[🐛 Bug]: Soft assertions are not working for cucumber steps
Open
#14,573 创建于 2025年6月18日
Bug 🐛help wanted
描述
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.15.0
Node.js Version
v20.19.2
Mode
Standalone Mode
Which capabilities are you using?
{
browserName: 'chrome'
}
What happened?
softassertions are not working per the design with cucumber framwork. test is failing at the initial soft failure and the failure is nowhere reported either in cucumber json or allure report.
What is your expected behavior?
No response
How to reproduce the bug.
package.json
{
"scripts": {
"wdio": "wdio run wdio.conf.ts",
"wdio:debug": "wdio run wdio.conf.ts --debug",
"wdio:watch": "wdio run wdio.conf.ts --watch"
},
"name": "wdio-latest",
"type": "module",
"devDependencies": {
"@wdio/allure-reporter": "^9.15.0",
"@wdio/cli": "^9.15.0",
"@wdio/cucumber-framework": "^9.15.0",
"@wdio/local-runner": "^9.15.0",
"@wdio/spec-reporter": "^9.15.0",
"@wdio/visual-service": "^8.0.4",
"wdio-cucumberjs-json-reporter": "^6.0.1",
"wdio-html-nice-reporter": "^8.1.7",
"wdio-json-html-reporter": "^1.5.13",
"wdio-video-reporter": "^6.1.1"
}
}
step file
import { Given, When, Then } from '@wdio/cucumber-framework';
import LoginPage from '../pageobjects/login.page.js';
import SecurePage from '../pageobjects/secure.page.js';
const pages = {
login: LoginPage
}
Given(/^I am on the (\w+) page$/, async (page) => {
await pages[page].open()
});
When(/^I login with (\w+) and (.+)$/, async (username, password) => {
await LoginPage.login(username, password)
});
Then(/^I should see a flash message saying (.*)$/, async (message) => {
await expect(SecurePage.flashAlert).toBeExisting();
await browser.saveScreenshot('examplePage1.png', {
/* some options */
fullPage: true,
format: 'png'
})
await expect.soft(SecurePage.flashAlert).toHaveText('Shanmukha');
await expect.soft(SecurePage.flashAlert).toHaveText('Shanmukha2');
// await expect(SecurePage.flashAlert).toHaveText(message);
// await expect(browser).toMatchSnapshot('examplePage.png');
// await expect(SecurePage.flashAlert).toHaveText('messagehas been successfully logged in!');
});
feature file
Feature: The Internet Guinea Pig Website
Scenario Outline: As a user, I can log into the secure area
Given I am on the login page
When I login with <username> and <password>
Then I should see a flash message saying <message>
Examples:
| username | password | message |
| tomsmith | SuperSecretPassword! | You logged into a secure area! |
| foobar | barfoo | Your username is invalid! |
reporters: ['spec',['allure', {outputDir: 'allure-results',useCucumberStepReporter:true}],'video','cucumberjs-json'],
attached the allure report screenshot
Relevant log output
2025-06-18T14:44:19.657Z INFO @wdio/cli:launcher: Run onPrepare hook
2025-06-18T14:44:19.658Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2025-06-18T14:44:19.659Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2025-06-18T14:44:19.664Z INFO webdriver: Using Chromedriver v137.0.7151.104 from cache directory C:\Users\PHANEE~1.GAJ\AppData\Local\Temp
2025-06-18T14:44:19.677Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2025-06-18T14:44:19.678Z INFO @wdio/local-runner: Start worker 0-0 with arg: run wdio.conf.ts
2025-06-18T14:45:14.650Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2025-06-18T14:45:14.655Z INFO @wdio/local-runner: Shutting down spawned worker
2025-06-18T14:45:14.912Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues