-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Below is my project structure. For some reason, Plotwright is unable to identify the test scripts and the execution is not happening. Can you help with this issue?
plotwright/
├── e2e/
├── imposters/
│ │ └── stub-api.json
│ └── specs/
│ └── example.spec.js
├── playwright.config.ts
└── plotwright.config.js
this is how my plotwright.config looks like. I just wanted to let you know that I have mentioned port 2526 here, which was not mentioned in your document. I have done this; otherwise, I will get the error.
{
"code": "EADDRINUSE",
"errno": -48,
"syscall": "listen",
"address": "::",
"port": 2525
}
This is my plotwright.config
/**
* plotwright.config.js
* @type {import('plotwright').Configuration}
*/
module.exports = {
playwright: {
testDir: "./e2e/specs",
},
mountebank: {
imposters: ["./e2e/imposters/stub-api.json"],
port: 2526,
},
};
this is how my playwright.config no change other than pointing the test directory to include e2e/specs
//playwright.config.ts
export default defineConfig({
testDir: "./e2e/specs",
....
});
I wrote a very simple test script. When the page loads, it should show only "Tomato" instead of loading all the fruits.
// ./e2e/specs/example.spec.js
import { test, describe, expect, step } from "plotwright";
describe("Test suite", () => {
test("Test example page", async ({ page, useStubs }) => {
await useStubs([import("./_stubs_/success-response-api.json")]);
await page.goto("https://demo.playwright.dev/api-mocking/");
await expect(page.getByText("Tomato")).toBeVisible();
});
});
This is the placeholder text I want to display when the page loads.
//stub-api.json
{
"port": 2525,
"protocol": "http",
"stubs": [
{
"predicates": [
{
"equals": {
"method": "GET",
"path": "/api/v1/fruits"
}
}
],
"responses": [
{
"is": {
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"name": "Tomato",
"id": 5
}
}
}
]
}
]
}
Finally, when I run the test its not able to discover the tests
% npx plotwright test
Mountebank: started ✅
Playwright: started ✅
Error: No tests found
Playwright: finished ❌
Mountebank: stopped ✅
Metadata
Metadata
Assignees
Labels
No labels