12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- Cypress.Commands.add("networkStub", () => {
- cy.intercept("POST", "/api/login", "true");
- cy.intercept("POST", "/api/mark/clear", "true");
- cy.intercept("POST", "/api/mark/updateSetting", "true");
- cy.intercept("GET", "/api/mark/subject-select", "true");
- cy.intercept("POST", "/api/mark/subject-select", "true");
- cy.intercept(
- "POST",
- "/api/mark/subject/query",
- `[
- {
- "id": 426,
- "subjectCode": "431",
- "subjectName": "金融学综合"
- }
- ]`
- );
- cy.intercept("POST", "/api/mark/getSetting", {
- fixture: "settings-1.json",
- }).as("setting");
- cy.intercept("POST", "/api/mark/getStatus", {
- fixture: "status-1.json",
- });
- cy.intercept("POST", "/api/mark/getGroup", {
- fixture: "groups-1.json",
- });
- cy.intercept("POST", "/api/mark/getTask", {
- fixture: "task-1.json",
- }).as("task");
- cy.intercept("GET", "/api/slice/**", (req) => {
- function getFixtureFilenameForUrl(url: string) {
- return "assets/" + url.split("/").pop() + ",null";
- }
- const fixtureFilename = getFixtureFilenameForUrl(req.url);
- req.reply({ fixture: fixtureFilename });
- });
- });
|