-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Implement test.step
for long test scenarios
#7254
Comments
@emakhachek (i assume we're talking about @playwright/test testrunner)
It actually sounds like you use tests as "steps". So instead of having something like this that you try to configure with the custom "fail-fast" logic: describe('test renting a car', () => {
// SOMEHOW configure this to fail the whole test suite (only one)
// if at least one test is failed
test('step 1 - login', async () => { /* ... login workflow ... */ });
test('step 2 - rent a car', async () => { /* ... rent a car sequence ... */ });
test('step 3 - checkout', async () => { /* ... checkout cart ... */ });
test('step 4 - check status', async () => { /* ... validate success ...*/ });
}); You actually will get the needed behavior with an explicit test(`test renting a car`, async () => {
await test.step('step 1 - login');
/* ... login workflow ... */
await test.step('step 2 - rent a car');
/* ... rent a car sequence ... */
await test.step('step 3 - checkout');
/* ... checkout cart ... */
await test.step('step 4 - check status');
/* ... validate success ...*/
}); We don't have Let us know if this is something you're looking for and you'd love to have implemented! |
I like this solution more than to override test environment with a custom one. I hope anyone vote for it. Thanks) |
test.step
for long test scenarios
This would be very interesting to have! Especially if the reporters know what steps succeeded / failed, so they can update the status of these steps in testware. |
cc @ortoniKC might be interesting for you to subscribe to this issue. Since it makes it possible to split long tests into smaller parts while keeping the same page object. |
#7956 implemented the following basic syntax: test('my test', async ({ page }) => {
await test.step('login', async () => {
await page.goto('myurl');
await page.fill('#username', 'username');
await page.fill('#password', 'password');
await page.click('text=Log in');
});
await test.step('another step', async () => {
// ...
});
}); See here: https://playwright.dev/docs/api/class-test#test-step |
Edit from maintainers: see this comment for feature description
Hi All,
I am currently using: jest, playwright, jest-playwright-preset.
Thanks to testRunner: “jest-circus/runner” I was able to override testEnvironment with a custom “fail fast” testEnvironment like it was mentioned here:
jestjs/jest#6527 (comment)
The goal is to fail the whole test suite (only one) if at least one test is failed (custom config for specific suite where all test are related to each other).
I found maxFailures: 1 option but it's shared between all projects.
I want this option to be applied only for one suite (test file) via setting maxFailures: 1 for one of the Projects combining with testIgnore or testDir options.
Thanks)
The text was updated successfully, but these errors were encountered: