Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Back end mocking with teremock #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Martynienas
Copy link

Added helper class requestMocker into framework
Added sample tests - requestMocking.test.js
Added documentation to Readme

README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@vaidasmaciulis vaidasmaciulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please solve merge conflicts.

let mocker = new RequestMocker();
let helpers = new Helpers();

it("Recording all requests and replaying it on the second test run google", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test fails:
image

await mocker.stop();

//Assert
expect(fs.existsSync("mockData\\Request mocking by recording and replaying and indercetipt specific requests\\Recording all requests and replaying it on the second test run google\\interceptors\\get.json")).toBe(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use "/" slashes to be cross-platform and consistent with other paths in framework

await mocker.stop();

//Assert
expect(fs.existsSync("mockData\\Request mocking by recording and replaying and indercetipt specific requests\\Recording all requests and replaying it on the second test run google\\interceptors\\get.json")).toBe(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path should be updated according to describe: "Request mocking by recording and replaying and indercetipt specific requests" > "Request mocking by recording and replaying specific requests"

const targetDir = `./mockData/${jasmine["currentSuite"].fullName}/${jasmine["currentTest"].description}`;
await teremock.start({ page, wd: targetDir, interceptors: { interceptors } });
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no constructor, class should be refactored to single ton pattern, like i.e.: https://github.com/devbridge/test-juggler/blob/master/framework/interceptor.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants