I have a test to be run on a set of pages. I am trying to run it as Parameterized test.
2 test cases cannot have same name so string interpolations used to give them a unique name as can be seen in the example. I am trying to achieve this with the code snippet below.
import { test, expect } from '@playwright/test';
[
{ name: 'Alice'},
{ name: 'Bob' },
{ name: 'Charlie' },
].forEach(({name}) => {
test(`Publishing Error Message ${name}`, async ({ page }) => {
// Set the timeout to 200 seconds
test.setTimeout(200000);
});
});
Still, I am getting the error:
Error: duplicate test title "Publishing Error Message", first declared in example.spec.ts:9
I have a test to be run on a set of pages. I am trying to run it as Parameterized test.
2 test cases cannot have same name so string interpolations used to give them a unique name as can be seen in the example. I am trying to achieve this with the code snippet below.
import { test, expect } from '@playwright/test';
[
{ name: 'Alice'},
{ name: 'Bob' },
{ name: 'Charlie' },
].forEach(({name}) => {
test(`Publishing Error Message ${name}`, async ({ page }) => {
// Set the timeout to 200 seconds
test.setTimeout(200000);
});
});
Still, I am getting the error:
Error: duplicate test title "Publishing Error Message", first declared in example.spec.ts:9
Share
Improve this question
asked Nov 20, 2024 at 9:26
NutsAndBoltsNutsAndBolts
4291 gold badge4 silver badges16 bronze badges
1
- 2 your code is working for me – hardkoded Commented Nov 20, 2024 at 13:02
1 Answer
Reset to default 1There is nothing wrong with your code. You can restart typescript server or reload vscode window in case typescript is still throwing old errors.