This commit is contained in:
2020-10-19 19:11:34 +00:00
parent 067a7e2ef7
commit 34a9b57b68
10 changed files with 90 additions and 83 deletions

View File

@@ -0,0 +1,29 @@
// https://docs.cypress.io/api/introduction/api.html
describe("Login", () => {
it("Logs in navigates to user options and log out", () => {
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}`);
// we should be redirected to /dashboard
cy.url().should("include", "/ay-evaluate");
//navigate and confirm
//open nav and home menu
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=home]").click();
cy.get("[data-cy='nav/home-user-settings']").click();
cy.url().should("include", "/home-user-settings");
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=logout]").click();
cy.url().should("include", "/login");
});
});

View File

@@ -0,0 +1,65 @@
//################# COMMENTED OUT BECAUSE TOO PROBLEMATIC TO TEST, HAS SIDE EFFECTS AND IF IT FAILS THEN NEEDS TO BE REVERSED TO RE-RUN THE TEST AGAIN
//BAH
// // https://docs.cypress.io/api/introduction/api.html
// describe("CUSTOMIZE", () => {
// it("Edits and works", () => {
// 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.visit("/widgets/1");
// cy.url().should("include", "/widgets/1");
// //check serial field is present, then hide it and check it's gone then re-show it again
// cy.get("[data-cy=serial]").should("exist");
// cy.get("[data-cy=WidgetCustom8]").should("not.exist");
// cy.wait(100);
// cy.get("[data-cy=contextmenu]").click();
// cy.get('[data-cy="app:customize"]').click();
// cy.url().should("include", "/customize/Widget");
// //hide serial
// cy.get("[data-cy=SerialVisible]").uncheck({ force: true });
// cy.wait(10);
// //show widget 8 and set it to a type
// cy.get("[data-cy=WidgetCustom8]").scrollIntoView();
// cy.get("[data-cy=WidgetCustom8Visible]").check({ force: true });
// cy.get("[data-cy=WidgetCustom8SelectType]").type("tr{enter}", {
// force: true
// });
// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click();
// cy.go("back");
// //check customize worked
// cy.get("[data-cy=serial]").should("not.exist");
// cy.get("[data-cy=WidgetCustom8]").should("exist");
// //reverse
// cy.wait(100);
// cy.get("[data-cy=contextmenu]").click();
// cy.get('[data-cy="app:customize"]').click();
// cy.url().should("include", "/customize/Widget");
// cy.get("[data-cy=SerialVisible]").check({ force: true });
// cy.get("[data-cy=WidgetCustom8Visible]").uncheck({ force: true });
// cy.get("[data-cy=WidgetCustom8SelectType]").type("te{enter}", {
// force: true
// });
// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click();
// cy.go("back");
// cy.get("[data-cy=serial]").should("exist");
// cy.get("[data-cy=WidgetCustom8]").should("not.exist");
// //-----
// });
// });

View File

@@ -0,0 +1,92 @@
describe("GZ-DATA-TABLE", () => {
it("Operations work", () => {
cy.visit("/login");
cy.get("input[name=username]")
.clear()
.type("BizAdminFull");
// {enter} causes the form to submit
cy.get("input[name=password]")
.clear()
.type("BizAdminFull{enter}");
//cy.url().should("include", "/home-dashboard");
cy.visit("/widgets");
cy.url().should("include", "/widgets");
cy.contains("Rows per page");
//select default widget list view
cy.get("[data-cy=selectlistview]").type("-{enter}", { force: true });
//confirm we see the data expected
cy.contains("Name");
cy.contains("Serial #");
cy.contains("Price");
//refresh
cy.get("[data-cy=refresh]").click();
//confirm the first column is the widget name
cy.get("thead > tr > th:nth-child(1) > span").contains("Name");
// cy.get('[aria-label="Next page"] > .v-btn__content > .v-icon').click();
// cy.get(".v-data-footer__select input:nth-child(2)").type("10{enter}", {
// force: true,
// });
// //confirm rows
// cy.get("tbody")
// .find("tr")
// .should("have.length", 10);
cy.get(".v-data-footer__select input:nth-child(2)").type("5{enter}", {
force: true
});
//confirm 5 rows
cy.get("tbody")
.find("tr")
.should("have.length", 5);
//filter
cy.get("[data-cy=filter]").click();
cy.contains("List view");
//move username to first position
cy.get(
'[data-cy="columncard:username"] > .v-card__text > .d-flex > :nth-child(1) > .v-btn__content > [data-cy=movestart]'
).click();
//go back to widgetlist
cy.go("back");
//confirm the first column is now the username
cy.get("thead > tr > th:nth-child(1) > span").contains("User");
//switch back to default filter
cy.get("[data-cy=selectlistview]").type("-{enter}{esc}", { force: true });
//open a widget record
cy.wait(100);
cy.get("tbody > :nth-child(1) > :nth-child(1)").click();
//cy.get(":nth-child(1) > :nth-child(1) > .subtitle-1 > a").click();
//confirm on widget edit form
cy.get('[data-cy="widget-edit:delete"]');
//go back to widgetlist
cy.go("back");
//new
cy.get("[data-cy='widget-list:new']").click();
cy.url().should("include", "/widgets/0");
//cy.get("thead > tr > th:nth-child(1)").contains("User");
// //navigate and confirm
// //open nav and home menu
// cy.get("[data-cy=navicon]").click();
// cy.get("[data-cy=home]").click();
// cy.get("[data-cy='nav/home-user-settings']").click();
//
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=logout]").click();
cy.url().should("include", "/login");
});
});

View File

@@ -0,0 +1,62 @@
// // login just once using API
// let user;
// before(function fetchUser() {
// cy.request("POST", "http://localhost:7575/api/v8/auth", {
// username: Cypress.env("adminusername"),
// password: Cypress.env("adminpassword")
// })
// .its("body")
// .thsden(res => {
// user = res;
// });
// });
// // but set the user before visiting the page
// // so the app thinks it is already authenticated
// beforeEach(function setUser() {
// cy.visit("/", {
// onBeforeLoad(win) {
// // and before the page finishes loading
// // set the user object in local storage
// win.localStorage.setItem("user", JSON.stringify(user));
// }
// });
// // the page should be opened and the user should be logged in
// });
// describe("The home page", () => {
// it("Successfully loads the home page", () => {
// cy.visit("/");
// });
// });
// describe("JWT", () => {
// it("makes authenticated request", () => {
// // we can make authenticated request ourselves
// // since we know the token
// cy.request({
// url: "http://localhost:7575/api/v8/User/1",
// auth: {
// bearer: user.token
// }
// })
// .its("body")
// .should("deep.equal", [
// {
// id: 1,
// username: "test",
// firstName: "Test",
// lastName: "User"
// }
// ]);
// });
// it("is logged in", () => {
// cy.contains("Hi Test!").should("be.visible");
// });
// it("shows loaded user", () => {
// // this user information came from authenticated XHR call
// cy.contains("li", "Test User").should("be.visible");
// });
// });

View File

@@ -0,0 +1,65 @@
// https://docs.cypress.io/api/introduction/api.html
describe("PICK LIST TEMPLATE", () => {
it("Successfully changes pick list template", () => {
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", "/home-dashboard");
cy.visit("/adm-global-settings");
cy.url().should("include", "/adm-global-settings");
cy.get("[data-cy=picklisttemplates]").click();
cy.url().should("include", "/adm-global-select-templates");
cy.get("[data-cy=SelectTemplate]").type("3{enter}", { force: true });
//hide tags field
cy.get("[data-cy=usertagsInclude]").uncheck({ force: true });
// cy.get(
// '[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
// ).click();
cy.get(
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
).click({ force: true });
cy.visit("/widgets/0");
cy.url().should("include", "/widgets/0");
//select a user with a zone set
cy.get("[data-cy=userid] > .v-input")
.type("..zone")
.wait(500)
.type("{downarrow}{downarrow}{enter}");
//tags is off so there shouldn't be any "zones" visible in there
cy.contains("zone").should("not.exist");
//NOW DO THE OPPOSITE
cy.visit("/adm-global-settings");
cy.url().should("include", "/adm-global-settings");
cy.get("[data-cy=picklisttemplates]").click();
cy.url().should("include", "/adm-global-select-templates");
cy.get("[data-cy=SelectTemplate]").type("3{enter}", { force: true });
//show tags field
cy.get("[data-cy=usertagsInclude]").check({ force: true });
cy.get(
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
).click({ force: true });
cy.visit("/widgets/0");
cy.url().should("include", "/widgets/0");
//select a user with a zone set
cy.get("[data-cy=userid] > .v-input")
.type("..zone")
.wait(500)
.type("{downarrow}{downarrow}{enter}");
//tags is on so there should be "zone1" visible in there
cy.contains("zone").should("exist");
//-----------------
});
});