Hi,
I have:
user.json file in src\config
login.fixture.ts in src\fixture
getuser.test.ts in src\tests\backend\Users\ (I haven't added test logic yet)
testDir: './src/tests', in playwright.config.ts
I run the tests from the root in PS terminal
the below failure is returned. None of the common reasons are true in my case. Any suggestions?
Error: Playwright Test did not expect test() to be called here. Most common reasons include: - You are calling test() in a configuration file. - You are calling test() in a file that is imported by the configuration file. - You have two different versions of @playwright/test. This usually happens when one of the dependencies in your package.json depends on @playwright/test.
16 | // Test 1: GET all users request for all users in user.json
17 | for (const user of users) {
18 | test(
GET all users request for all users in user.json - Username: ${user.username}
, async ({ page }) => { | ^ 19 | await login(user.username, user.password, user.role); 20 | // Perform the test logic for getting user profile using the token 21 | // ...
at C:\Users\souwehand\Documents\Automation\APPROACH\src\tests\backend\Users\getUser.test.ts:18:9
This thread is trying to answer question "How can I resolve the error 'Playwright Test did not expect test() to be called here' in my code?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].