This commit is contained in:
@@ -34,7 +34,21 @@ Cypress.Commands.add("chooseVSelect", (dataCyTag, selectionText) => {
|
||||
Cypress.Commands.add("choosePickList", (dataCyTag, selectionText) => {
|
||||
cy.get(`[data-cy='${dataCyTag}']`).click({ force: true }).type(selectionText);
|
||||
cy.wait(500);
|
||||
cy.get(".v-list-item__title")
|
||||
.contains(new RegExp(selectionText))
|
||||
.click();
|
||||
cy.get(".v-list-item__title").contains(new RegExp(selectionText)).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ayLogin", (user, urlAfterLogin) => {
|
||||
if(!urlAfterLogin){
|
||||
urlAfterLogin="/ay-evaluate"
|
||||
}
|
||||
cy.visit("/login");
|
||||
|
||||
cy.get("input[name=username]").clear().type(Cypress.env(user).login);
|
||||
|
||||
// {enter} causes the form to submit
|
||||
cy.get("input[name=password]")
|
||||
.clear()
|
||||
.type(`${Cypress.env(user).password}{enter}`);
|
||||
|
||||
cy.url().should("include", urlAfterLogin);
|
||||
});
|
||||
|
||||
@@ -20,72 +20,4 @@ import "./commands";
|
||||
// require('./commands')
|
||||
|
||||
//unique test run ID for all tests
|
||||
Cypress.config("cyid", `cy${new Date().getTime()}`);
|
||||
///////////////////////////////////////////////////////////////
|
||||
//Generate fresh data
|
||||
//
|
||||
//
|
||||
// //via UI
|
||||
// // before(() => {
|
||||
// // cy.visit("/login");
|
||||
|
||||
// // cy.get("input[name=username]").clear().type(Cypress.env("adminusername"));
|
||||
|
||||
// // // {enter} causes the form to submit
|
||||
// // cy.get("input[name=password]")
|
||||
// // .clear()
|
||||
// // .type(`${Cypress.env("adminpassword")}{enter}`);
|
||||
// // cy.url().should("include", "/ay-evaluate");
|
||||
|
||||
// // cy.get("[data-cy=btnSeed]").click();
|
||||
// // cy.get("[data-cy=btnStart]").click();
|
||||
// // cy.get('[data-cy="gzconfirm:yesbutton"]').click();
|
||||
// // //cy.contains("permanently erase");
|
||||
// // cy.get('[data-cy="gzconfirm:yesbutton"]').click();
|
||||
// // //long delay here while data is being generated
|
||||
// // 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
|
||||
cy.wait(1000);
|
||||
confirmJobDone(jobId, authToken);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// before(() => {
|
||||
// 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: ${JSON.stringify(resjob)}`);
|
||||
// // expect(resjob.body).to.have.property('jobId');
|
||||
// confirmJobDone(resjob.jobId, res.data.token);
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
Cypress.config("cyid", `cy${new Date().getTime()}`);
|
||||
Reference in New Issue
Block a user