generated from AppiumTestDistribution/appium-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
My Appium interceptor-plugin version is 1.0.2. My test case suite of WebDriverIO is similar to the following.
The test suite "Intercept Mock Tests" below includes 2 test cases.
The problem is when the first test case finishes successfully (add mock, and remove mock no problem), and when the test runner continues to the second test case, the mobile app is stuck at the await loadDataOnTheHomeScreen(); this step will load data and displays on the screen, the problem is the app is keep loading data until the test case failed, when the test case failed, the Appium session is end, the network is resumed and the data is loaded and shows on the home screen.
How can I solve this problem?
Thanks.
var mockId;
describe("Intercept Mock Tests", () => {
before(async () => {
await launchApp();
});
beforeEach(async () => {
await loadDataOnTheHomeScreen();
});
afterEach(async() => {
await driver.execute("interceptor: removeMock", {
id: mockId,
});
});
["enabled", "disabled"].forEach((mode) => {
it("Mock Response", async () => {
const mockConfig = {
url: "**/api/v1/mobile/access",
updateResponseBody: [
{
jsonPath: "$.githubAccess",
value: mode === "enabled",
},
],
};
mockId = await driver.execute("interceptor: addMock", {
config: mockConfig,
});
await $("~github.login").click();
if (mode ==== "enabled") {
await expect($("~github.login.button")).toBeDisplayed();
} else {
await expect($("~github.login.button")).not.toBeDisplayed();
}
});
});
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels