diff --git a/e2e/support/index.js b/e2e/support/index.js index 7367ee9..d703ea7 100644 --- a/e2e/support/index.js +++ b/e2e/support/index.js @@ -24,6 +24,7 @@ Cypress.config("cyid", `cy${new Date().getTime()}`); /////////////////////////////////////////////////////////////// //Generate fresh data // +// //via UI // before(() => { // cy.visit("/login"); @@ -45,7 +46,43 @@ Cypress.config("cyid", `cy${new Date().getTime()}`); // cy.url({ timeout: 300000 }).should("include", "/login"); // }); //via API +function confirmJobDone(jobId, authToken) { + cy.request({ + method: "GET", + url: `${Cypress.env("apiBaseUrl")}job-operations/status/${jobId}`, + auth: { + bearer: authToken + } + }).then((resp) => { + //3 means job done + if (resp.body.data == 3) return; + // else recurse + confirmJobDone(jobId, authToken); + }); +} before(() => { - cy.request(method, `${Cypress.env("apiBaseUrl")}auth`, `{"login":"${Cypress.env('adminusername')}"},"password":"${Cypress.env('adminpassword')}"`);//{"login":"superuser","password":"l3tm3in"} - -}); \ No newline at end of file + cy.request({ + url: `${Cypress.env("apiBaseUrl")}auth`, + method: "POST", + body: { + login: Cypress.env("adminusername"), + password: Cypress.env("adminpassword") + } + }) + .its("body") + .then((res) => { + cy.request({ + method: "POST", + url: `${Cypress.env("apiBaseUrl")}trial/seed/small/-7/true`, + auth: { + bearer: res.data.token + } + }) + .its("body") + .then((resjob) => { + cy.log(`resjob is: ${resjob}`); + // expect(resjob.body).to.have.property('jobId'); + confirmJobDone(resjob.jobId, res.data.token); + }); + }); +}); diff --git a/e2e/tests/regression/accounting-user/accounting-features.js b/e2e/tests/regression/accounting-user/accounting-features.js index 0e17168..c83656c 100644 --- a/e2e/tests/regression/accounting-user/accounting-features.js +++ b/e2e/tests/regression/accounting-user/accounting-features.js @@ -1,6 +1,6 @@ /// describe("When Accounting user logs in", () => { - it("should correctly run all functionality", () => { + it.skip("should correctly run all functionality", () => { //format for typing input and setting value is always YYYY-MM-DD for date and HH:MM in 24 hour time for time const dNow = new Date(); const dToday = `${dNow.getFullYear()}-${(dNow.getMonth() + 1) diff --git a/e2e/tests/regression/service-user/service-user-features.js b/e2e/tests/regression/service-user/service-user-features.js index 0414d90..a31c623 100644 --- a/e2e/tests/regression/service-user/service-user-features.js +++ b/e2e/tests/regression/service-user/service-user-features.js @@ -3,7 +3,7 @@ import dayjs from "../../../support/dayjs.min.js"; describe("When Service user logs in", () => { - it("should correctly run all functionality", () => { + it.skip("should correctly run all functionality", () => { cy.visit("/login"); cy.get("input[name=username]").clear().type(Cypress.env("serviceuser")); // {enter} causes the form to submit