This commit is contained in:
2020-03-31 21:00:13 +00:00
parent 3daa9c60c5
commit 61cf9a9dd4
5 changed files with 40 additions and 14 deletions

View File

@@ -54,9 +54,9 @@ CURRENT TODOs
todo: Client automated testing todo: Client automated testing
- Need several as basis for all future, make sure it's right. - Need several as basis for all future, make sure it's right.
todo: new widget? how to? from grid? todo: new widget
- no obvious way to make a new widget except in picklist or duplicate option
- There should be a new option (in addition to duplicate) within the existing widget form because it makes sense to want to make a new one while editing previous one - There should be a new option (in addition to duplicate) within the existing widget form because it makes sense to want to make a new one while editing previous one
- Plus you could have arrived there from anywhere, don't want to have to reload a big list just to add a new one
todo: Make errorBoxError message box on all forms a component instead as it's just boilerplate todo: Make errorBoxError message box on all forms a component instead as it's just boilerplate
- For consistency and so can change it later at will without re-editing all forms - For consistency and so can change it later at will without re-editing all forms

View File

@@ -129,6 +129,7 @@
v-if="item.surface" v-if="item.surface"
:disabled="item.disabled" :disabled="item.disabled"
@click="clickMenuItem(item)" @click="clickMenuItem(item)"
:data-cy="item.key"
> >
<v-icon :color="item.color ? item.color : ''"> <v-icon :color="item.color ? item.color : ''">
{{ item.icon }} {{ item.icon }}

View File

@@ -22,6 +22,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -36,6 +37,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -49,6 +51,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -62,6 +65,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -77,6 +81,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -94,6 +99,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -107,6 +113,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))
@@ -120,6 +127,7 @@
:readonly="readOnly" :readonly="readOnly"
:label="t(item.fld)" :label="t(item.fld)"
:ref="item.fld" :ref="item.fld"
:data-cy="item.fld"
:error-messages="form().serverErrors(parentVM, item.fld)" :error-messages="form().serverErrors(parentVM, item.fld)"
:rules="[ :rules="[
form().customFieldsCheck(parentVM, item, _self, t(item.fld)) form().customFieldsCheck(parentVM, item, _self, t(item.fld))

View File

@@ -7,6 +7,7 @@
<v-col cols="12" mt-1 mb-2> <v-col cols="12" mt-1 mb-2>
<v-alert <v-alert
ref="errorbox" ref="errorbox"
data-cy="errorbox"
v-show="formState.errorBoxMessage" v-show="formState.errorBoxMessage"
color="error" color="error"
icon="fa-exclamation-circle " icon="fa-exclamation-circle "
@@ -30,6 +31,7 @@
]" ]"
:error-messages="form().serverErrors(this, 'name')" :error-messages="form().serverErrors(this, 'name')"
ref="name" ref="name"
data-cy="name"
@input="fieldValueChanged('name')" @input="fieldValueChanged('name')"
></v-text-field> ></v-text-field>
</v-col> </v-col>
@@ -44,6 +46,7 @@
v-model="obj.serial" v-model="obj.serial"
:readonly="true" :readonly="true"
:label="t('WidgetSerial')" :label="t('WidgetSerial')"
data-cy="serial"
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col <v-col
@@ -61,6 +64,7 @@
:counter="10" :counter="10"
:label="t('WidgetCount')" :label="t('WidgetCount')"
ref="count" ref="count"
data-cy="count"
:rules="[form().integerValid(this, 'count')]" :rules="[form().integerValid(this, 'count')]"
:error-messages="form().serverErrors(this, 'count')" :error-messages="form().serverErrors(this, 'count')"
@input="fieldValueChanged('count')" @input="fieldValueChanged('count')"
@@ -80,6 +84,7 @@
:readonly="formState.readOnly" :readonly="formState.readOnly"
:label="t('WidgetDollarAmount')" :label="t('WidgetDollarAmount')"
ref="dollarAmount" ref="dollarAmount"
data-cy="dollarAmount"
:rules="[ :rules="[
form().decimalValid(this, 'dollarAmount'), form().decimalValid(this, 'dollarAmount'),
form().required(this, 'dollarAmount') form().required(this, 'dollarAmount')
@@ -95,6 +100,7 @@
v-model="obj.startDate" v-model="obj.startDate"
:readonly="formState.readOnly" :readonly="formState.readOnly"
ref="startDate" ref="startDate"
data-cy="startDate"
:error-messages="form().serverErrors(this, 'startDate')" :error-messages="form().serverErrors(this, 'startDate')"
@input="fieldValueChanged('startDate')" @input="fieldValueChanged('startDate')"
></gz-date-time-picker> ></gz-date-time-picker>
@@ -108,6 +114,7 @@
v-model="obj.endDate" v-model="obj.endDate"
:readonly="formState.readOnly" :readonly="formState.readOnly"
ref="endDate" ref="endDate"
data-cy="endDate"
@input="fieldValueChanged('endDate')" @input="fieldValueChanged('endDate')"
></gz-date-time-picker> ></gz-date-time-picker>
</v-col> </v-col>
@@ -123,6 +130,7 @@
:readonly="formState.readOnly" :readonly="formState.readOnly"
:label="t('Active')" :label="t('Active')"
ref="active" ref="active"
data-cy="active"
:error-messages="form().serverErrors(this, 'active')" :error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active')" @change="fieldValueChanged('active')"
></v-checkbox> ></v-checkbox>
@@ -142,6 +150,7 @@
:readonly="formState.readOnly" :readonly="formState.readOnly"
:label="t('User')" :label="t('User')"
ref="userid" ref="userid"
data-cy="userid"
:error-messages="form().serverErrors(this, 'userid')" :error-messages="form().serverErrors(this, 'userid')"
@input="fieldValueChanged('userid')" @input="fieldValueChanged('userid')"
></gz-pick-list> ></gz-pick-list>
@@ -162,6 +171,7 @@
:readonly="formState.readOnly" :readonly="formState.readOnly"
:label="t('WidgetUserType')" :label="t('WidgetUserType')"
ref="usertype" ref="usertype"
data-cy="usertype"
:rules="[form().integerValid(this, 'usertype')]" :rules="[form().integerValid(this, 'usertype')]"
:error-messages="form().serverErrors(this, 'usertype')" :error-messages="form().serverErrors(this, 'usertype')"
@input="fieldValueChanged('usertype')" @input="fieldValueChanged('usertype')"
@@ -175,6 +185,7 @@
:label="t('WidgetNotes')" :label="t('WidgetNotes')"
:error-messages="form().serverErrors(this, 'notes')" :error-messages="form().serverErrors(this, 'notes')"
ref="notes" ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')" @input="fieldValueChanged('notes')"
auto-grow auto-grow
clearable clearable
@@ -186,6 +197,7 @@
v-model="obj.tags" v-model="obj.tags"
:readonly="formState.readOnly" :readonly="formState.readOnly"
ref="tags" ref="tags"
data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')" :error-messages="form().serverErrors(this, 'tags')"
@input="fieldValueChanged('tags')" @input="fieldValueChanged('tags')"
></gz-tag-picker> ></gz-tag-picker>
@@ -198,6 +210,7 @@
:readOnly="formState.readOnly" :readOnly="formState.readOnly"
:parentVM="this" :parentVM="this"
ref="customFields" ref="customFields"
data-cy="customFields"
:error-messages="form().serverErrors(this, 'customFields')" :error-messages="form().serverErrors(this, 'customFields')"
@input="fieldValueChanged('customFields')" @input="fieldValueChanged('customFields')"
></gz-custom-fields> ></gz-custom-fields>

View File

@@ -1,7 +1,7 @@
// https://docs.cypress.io/api/introduction/api.html // https://docs.cypress.io/api/introduction/api.html
describe("Login", () => { describe("WIDGET", () => {
it("Successfully logs in navigate and log out", () => { it("Performs all crud ops on widget", () => {
cy.visit("/login"); cy.visit("/login");
cy.get("input[name=username]") cy.get("input[name=username]")
@@ -13,17 +13,21 @@ describe("Login", () => {
.clear() .clear()
.type(`${Cypress.env("adminpassword")}{enter}`); .type(`${Cypress.env("adminpassword")}{enter}`);
// we should be redirected to /dashboard
cy.url().should("include", "/home-dashboard"); cy.url().should("include", "/home-dashboard");
cy.visit("/widgets/0");
cy.url().should("include", "/widgets/0");
//navigate and confirm // // we should be redirected to /dashboard
//open nav and home menu // cy.url().should("include", "/home-dashboard");
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=home]").click(); // //navigate and confirm
cy.get("[data-cy='nav/home-user-settings']").click(); // //open nav and home menu
cy.url().should("include", "/home-user-settings"); // cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=contextmenu]").click(); // cy.get("[data-cy=home]").click();
cy.get("[data-cy='app:logout']").click(); // cy.get("[data-cy='nav/home-user-settings']").click();
cy.url().should("include", "/login"); // cy.url().should("include", "/home-user-settings");
// cy.get("[data-cy=contextmenu]").click();
// cy.get("[data-cy='app:logout']").click();
// cy.url().should("include", "/login");
}); });
}); });