This commit is contained in:
@@ -24,6 +24,7 @@ Cypress.config("cyid", `cy${new Date().getTime()}`);
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
//Generate fresh data
|
//Generate fresh data
|
||||||
//
|
//
|
||||||
|
//
|
||||||
//via UI
|
//via UI
|
||||||
// before(() => {
|
// before(() => {
|
||||||
// cy.visit("/login");
|
// cy.visit("/login");
|
||||||
@@ -45,7 +46,43 @@ Cypress.config("cyid", `cy${new Date().getTime()}`);
|
|||||||
// cy.url({ timeout: 300000 }).should("include", "/login");
|
// cy.url({ timeout: 300000 }).should("include", "/login");
|
||||||
// });
|
// });
|
||||||
//via API
|
//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(() => {
|
before(() => {
|
||||||
cy.request(method, `${Cypress.env("apiBaseUrl")}auth`, `{"login":"${Cypress.env('adminusername')}"},"password":"${Cypress.env('adminpassword')}"`);//{"login":"superuser","password":"l3tm3in"}
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe("When Accounting user logs in", () => {
|
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
|
//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 dNow = new Date();
|
||||||
const dToday = `${dNow.getFullYear()}-${(dNow.getMonth() + 1)
|
const dToday = `${dNow.getFullYear()}-${(dNow.getMonth() + 1)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import dayjs from "../../../support/dayjs.min.js";
|
import dayjs from "../../../support/dayjs.min.js";
|
||||||
|
|
||||||
describe("When Service user logs in", () => {
|
describe("When Service user logs in", () => {
|
||||||
it("should correctly run all functionality", () => {
|
it.skip("should correctly run all functionality", () => {
|
||||||
cy.visit("/login");
|
cy.visit("/login");
|
||||||
cy.get("input[name=username]").clear().type(Cypress.env("serviceuser"));
|
cy.get("input[name=username]").clear().type(Cypress.env("serviceuser"));
|
||||||
// {enter} causes the form to submit
|
// {enter} causes the form to submit
|
||||||
|
|||||||
Reference in New Issue
Block a user