This commit is contained in:
2020-04-04 22:53:22 +00:00
parent 5124aed04b
commit a065571e8b
4 changed files with 46 additions and 12 deletions

View File

@@ -51,9 +51,6 @@ CURRENT TODOs
todo: add tests for the following:
- customize form form
- NOTE: All cypress tests run serially anyway, so it's perfectly ok to customize the widget form, go see if it worked, then come back and reverse it without affecting the other tests
- so do a real customization and with the conditional data-cy attribute possibility there's no reason not to put that attribute anywhere desired like on every clickable element tested etc
- picklist editor form
todo: Customer login should have help links go to a special customer end user section in the manual, but they can still view the rest of the manual becuase maybe they will buy it

View File

@@ -24,6 +24,8 @@
item-value="id"
:label="$ay.t('PickListTemplates')"
@input="templateSelected"
:data-cy="!!$ay.dev ? 'SelectTemplate' : false"
:disabled="formState.dirty"
>
</v-select>
</v-col>
@@ -143,6 +145,7 @@ export default {
workingArray: [],
fieldKeys: [],
templateId: 0,
lastFetchedTemplateId: 0,
formState: {
ready: false,
dirty: false,
@@ -226,14 +229,17 @@ export default {
});
},
templateSelected: function() {
if (this.formState.dirty) {
window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => {
if (dialogResult != true) {
return;
}
});
let vm = this;
if (vm.lastFetchedTemplateId == vm.templateId) {
return; //no change
}
vm.workingArray = [];
if (!vm.templateId || vm.templateId == 0) {
vm.lastFetchedTemplateId = 0;
return;
} else {
vm.getDataFromApi();
}
this.getDataFromApi();
},
getDataFromApi() {
let vm = this;
@@ -241,7 +247,7 @@ export default {
if (!vm.templateId || vm.templateId == 0) {
return;
}
vm.lastFetchedTemplateId = vm.templateId;
window.$gz.form.deleteAllErrorBoxErrors(vm);
//get available fields

View File

@@ -2,7 +2,11 @@
<v-card class="mx-auto" v-if="formState.ready">
<v-list subheader>
<v-subheader>{{ $ay.t("UserInterfaceSettings") }}</v-subheader>
<v-list-item link to="adm-global-select-templates">
<v-list-item
link
to="adm-global-select-templates"
:data-cy="!!$ay.dev ? 'picklisttemplates' : false"
>
<v-list-item-title>{{ $ay.t("PickListTemplates") }}</v-list-item-title>
</v-list-item>
</v-list>

View File

@@ -0,0 +1,27 @@
// 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("u{tab}", {
force: true
});
//-----------------
});
});