forked from bcgov/common-hosted-form-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bcgov#1547 test scripts for export/imprt design
- Loading branch information
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
tests/functional/cypress/e2e/form-design-export-import-design.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import 'cypress-keycloak-commands'; | ||
import 'cypress-drag-drop'; | ||
import { formsettings } from '../support/login.js'; | ||
|
||
const depEnv = Cypress.env('depEnv'); | ||
|
||
|
||
Cypress.Commands.add('waitForLoad', () => { | ||
const loaderTimeout = 60000; | ||
|
||
cy.get('.nprogress-busy', { timeout: loaderTimeout }).should('not.exist'); | ||
}); | ||
|
||
|
||
|
||
describe('Form Designer', () => { | ||
|
||
beforeEach(()=>{ | ||
|
||
|
||
|
||
cy.on('uncaught:exception', (err, runnable) => { | ||
// Form.io throws an uncaught exception for missing projectid | ||
// Cypress catches it as undefined: undefined so we can't get the text | ||
console.log(err); | ||
return false; | ||
}); | ||
}); | ||
it('Visits the form settings page', () => { | ||
|
||
|
||
cy.viewport(1000, 1100); | ||
cy.waitForLoad(); | ||
|
||
formsettings(); | ||
|
||
|
||
}); | ||
// Publish a simple form with Simplebc Address component | ||
it('Checks Export/Import design functionality', () => { | ||
cy.viewport(1000, 1100); | ||
cy.waitForLoad(); | ||
|
||
cy.get('button').contains('BC Government').click(); | ||
cy.get('div.formio-builder-form').then($el => { | ||
const coords = $el[0].getBoundingClientRect(); | ||
cy.get('[data-key="simplebcaddress"]') | ||
.trigger('mousedown', { which: 1}, { force: true }) | ||
.trigger('mousemove', coords.x, -550, { force: true }) | ||
//.trigger('mousemove', coords.y, +100, { force: true }) | ||
.trigger('mouseup', { force: true }); | ||
cy.waitForLoad(); | ||
//cy.get('input[name="data[label]"]').type('s'); | ||
cy.get('button').contains('Save').click(); | ||
//cy.get('.btn-success').click(); | ||
|
||
|
||
}); | ||
|
||
cy.get('.mdi-publish').click(); | ||
let fileUploadInputField = cy.get('input[type=file]'); | ||
cy.get('input[type=file]').should('not.to.be.null'); | ||
fileUploadInputField.attachFile('test_schema.json'); | ||
cy.wait(2000); | ||
cy.get('input[name="data[simplebcaddress]"]').should('not.exist'); | ||
|
||
cy.get('.mdi-download').click(); | ||
cy.wait(2000); | ||
//Verifies design downloads into download folder | ||
cy.get("h3").then(($elem) => { | ||
const rem = $elem.text(); | ||
let arr = rem.split(':'); | ||
|
||
cy.log(arr); | ||
let remname = arr[1] + "_schema.json"; | ||
cy.wait(2000); | ||
cy.readFile(`cypress\\downloads\\${remname}`).should("exist"); | ||
}); | ||
//Verify visibility of right side buttons on design page | ||
cy.get('[data-cy="saveButton"] > .v-btn').should('be.enabled'); | ||
cy.get('[data-cy="previewRouterLink"] > .v-btn').should('be.enabled'); | ||
cy.get('[data-cy="undoButton"] > .v-btn').should('be.enabled'); | ||
cy.get('[data-cy="redoButton"] > .v-btn').should('not.be.enabled'); | ||
cy.get('.mdi-undo').click(); | ||
cy.get('[data-cy="redoButton"] > .v-btn').should('be.enabled'); | ||
cy.get('.float-button > :nth-child(1) > .v-btn').should('be.enabled'); | ||
cy.get('.float-button > :nth-child(1) > .v-btn').click(); | ||
cy.get('.mdi-arrow-down').should('not.exist'); | ||
|
||
cy.get('.mdi-arrow-up').should('exist'); | ||
cy.get('.mdi-close').click(); | ||
cy.get('[data-cy="saveButton"] > .v-btn').should('not.exist'); | ||
cy.get('.mdi-undo').should('not.exist'); | ||
cy.get('.mdi-redo').should('not.exist'); | ||
cy.get('.mdi-menu').should('be.visible'); | ||
cy.get('.mdi-arrow-up').should('be.visible'); | ||
cy.get('#logoutButton > .v-btn__content > span').click(); | ||
|
||
|
||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"display":"form","type":"form","components":[{"label":"Text Field","labelPosition":"top","placeholder":"","description":"","tooltip":"","inputMask":"","allowMultipleMasks":false,"hideLabel":false,"showWordCount":false,"showCharCount":false,"spellcheck":true,"disabled":false,"multiple":false,"case":"","validate":{"isUseForCopy":false,"required":false,"customMessage":"","minLength":"","maxLength":"","custom":"","customPrivate":false,"strictDateValidation":false,"multiple":false,"unique":false,"pattern":""},"key":"simpletextfield","conditional":{"show":null,"when":null,"eq":"","json":""},"customConditional":"","type":"simpletextfield","input":true,"prefix":"","customClass":"","suffix":"","protected":false,"unique":false,"persistent":true,"hidden":false,"clearOnHide":true,"refreshOn":"","redrawOn":"","tableView":false,"modalEdit":false,"dataGridLabel":false,"errorLabel":"","tabindex":"","autofocus":false,"dbIndex":false,"customDefaultValue":"","calculateValue":"","calculateServer":false,"widget":{"type":"input"},"attributes":{},"validateOn":"change","overlay":{"style":"","left":"","top":"","width":"","height":""},"allowCalculateOverride":false,"encrypted":false,"properties":{},"addons":[],"mask":false,"inputType":"text","inputFormat":"plain","displayMask":"","truncateMultipleSpaces":false,"id":"e06ab8h","defaultValue":null},{"label":"Select List","labelPosition":"top","placeholder":"","description":"","tooltip":"","hideLabel":false,"disabled":false,"multiple":false,"data":{"values":[{"label":"","value":""}],"json":"","url":"","resource":"","custom":""},"validate":{"isUseForCopy":false,"required":false,"customMessage":"","custom":"","customPrivate":false,"strictDateValidation":false,"multiple":false,"unique":false,"onlyAvailableItems":false},"key":"simpleselect","conditional":{"show":null,"when":null,"eq":"","json":""},"customConditional":"","type":"simpleselect","input":true,"prefix":"","customClass":"","suffix":"","protected":false,"unique":false,"persistent":true,"hidden":false,"clearOnHide":true,"refreshOn":"","redrawOn":"","tableView":true,"modalEdit":false,"dataGridLabel":false,"errorLabel":"","tabindex":"","autofocus":false,"dbIndex":false,"customDefaultValue":"","calculateValue":"","calculateServer":false,"widget":"choicesjs","attributes":{},"validateOn":"change","overlay":{"style":"","left":"","top":"","width":"","height":""},"allowCalculateOverride":false,"encrypted":false,"showCharCount":false,"showWordCount":false,"properties":{},"allowMultipleMasks":false,"addons":[],"dataSrc":"values","authenticate":false,"ignoreCache":false,"template":"<span>{{ item.label }}</span>","idPath":"id","clearOnRefresh":false,"limit":100,"valueProperty":"","lazyLoad":true,"filter":"","searchEnabled":true,"searchDebounce":0.3,"searchField":"","minSearch":0,"readOnlyValue":false,"selectFields":"","selectThreshold":0.3,"uniqueOptions":false,"fuseOptions":{"include":"score","threshold":0.3},"indexeddb":{"filter":{}},"customOptions":{},"useExactSearch":false,"dataType":"auto","searchThreshold":0.3,"id":"e1sd0mn","defaultValue":""},{"type":"button","label":"Submit","key":"submit","size":"md","block":false,"action":"submit","disableOnInvalid":true,"theme":"primary","id":"efoc92","input":true,"placeholder":"","prefix":"","customClass":"","suffix":"","multiple":false,"defaultValue":null,"protected":false,"unique":false,"persistent":false,"hidden":false,"clearOnHide":true,"refreshOn":"","redrawOn":"","tableView":false,"modalEdit":false,"dataGridLabel":true,"labelPosition":"top","description":"","errorLabel":"","tooltip":"","hideLabel":false,"tabindex":"","disabled":false,"autofocus":false,"dbIndex":false,"customDefaultValue":"","calculateValue":"","calculateServer":false,"widget":{"type":"input"},"attributes":{},"validateOn":"change","validate":{"required":false,"custom":"","customPrivate":false,"strictDateValidation":false,"multiple":false,"unique":false},"conditional":{"show":null,"when":null,"eq":""},"overlay":{"style":"","left":"","top":"","width":"","height":""},"allowCalculateOverride":false,"encrypted":false,"showCharCount":false,"showWordCount":false,"properties":{},"allowMultipleMasks":false,"addons":[],"leftIcon":"","rightIcon":""}]} |