Skip to content

Commit

Permalink
test:FORMS-1547 Cypress test scripts for design export/import design …
Browse files Browse the repository at this point in the history
…functionality (bcgov#1530)

* #FORMS-974

* bcgov#974 updates

* bcgov#980 modification to cypress config

* FORMS-980

* bcgov#992

* bcgov#992 Fix cypress scripts

* bcgov#1011 Form design page

* bcgov#1011 test scripts

* bcgov#1023 cypress scripts

* bcgov#1023 advanced data components

* bcgov#1023 Updated scripts

* bcgov#1023 updation

* Updated json file

* Test/forms (bcgov#1011)(bcgov#1023) (bcgov#1307)

* #FORMS-974

* bcgov#974 updates

* bcgov#980 modification to cypress config

* FORMS-980

* bcgov#992

* bcgov#992 Fix cypress scripts

* bcgov#1011 Form design page

* bcgov#1011 test scripts

* bcgov#1023 cypress scripts

* bcgov#1023 advanced data components

* bcgov#1023 Updated scripts

* bcgov#1023 updation

* Updated json file

* bcgov#1059 workflow file for cypress

* bcgov#1059 updated the base url

* bcgov#1059 updated workflow

* Updated node version

* updated

* updated

* Updation

* updated file

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* updated package file

* Update cypress-ci.yaml

* Updated config file

* Update cypress-ci.yaml

* bcgov#1059 updated package

* bcgov#1060 scripts for Advanced fields and BC Gov components

* Fixing review comments

* Updated changes

* # Updated with PR comments

* updated

* Update form-design-basicfields.cy.js

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Modifies test scripts

* Updated files

* Fixed errors during CI/CD Run

* Updated browser type

* Updated Simple BC address component

* Updated

* Fields updated

* Test script changed

* Updated

* Updated fields

* Updated env variable

* Update form-design-basicfields.cy.js

* Updated

* Update cypress-ci.yaml

* Updated email input

* screenshots

* Updated path

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Updated version on workflow

* Fix to failed tests

* Fix to BC address component

* Updated the  component

* Changed button element

* Fixed BC components

* Modified submission

* Modified components

* Updated attribute

* Updated

* Changed simpleBC address component

* Update package.json

* Update package-lock.json

* Test scripts

* Updated

* Pushed the changes

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Env change

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Updated

* Updated to take default env variable

* Updated with current workflow

* updated

* Formatted

* Update cypress.config.js

* updated

* Test scripts for updating submission data

* Scripts for adding notes

* Added scripts for logout after each run

* Adding statuses to submission

* Fixed alert message for subscription settings

* Fixing CI/CD running issues

* Fixed issues on schedule date verification

* bcgov#1488 public form submission

* bcgov#1488 form for public

* form settings page for public form

* Added scripts for public forms with no status assign ability

* Changes with login page

* Removed additional login page

* bcgov#1478/Draft submission

* Scripts for draft submission

* bcgov#1478 Added column management functionality and delete button

* Fixed some CI/Cd issues

* bcgov#1478 Renamed public form

* Removed duplicate files

* # Fixed issues after implimenting custom metadata

* Updated settings button

* #1540 Test scripts for revise status changes

* Modified scripts

* Fixed CI/Cd issue

* #1547 test scripts for export/imprt design

* #1547 added preview form

* Added downloads folder to config file

* Added downloads folder

* Fixed spacing issue

* Removed downloaded files

* Modified download folder path

* Fixed some fornmatting issue

* Updated component check

---------

Co-authored-by: jasonchung1871 <[email protected]>
  • Loading branch information
nimya-aot and jasonchung1871 authored Nov 21, 2024
1 parent 68bd7c3 commit a86f055
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/functional/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = defineConfig({
video: false,
fixturesFolder: 'cypress/fixtures',
screenshotsFolder: 'screenshots',
downloadsFolder: 'cypress/downloads',
videosFolder: 'videos',

e2e: {
Expand Down
135 changes: 135 additions & 0 deletions tests/functional/cypress/e2e/form-design-export-import-design.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
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);
const path = require("path");
const downloadsFolder=Cypress.config("downloadsFolder");
cy.readFile(path.join(downloadsFolder,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('[data-cy="redoButton"] > .v-btn').click();
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('.mdi-menu').click();


// Form saving
let savedButton = cy.get('[data-cy=saveButton]');
expect(savedButton).to.not.be.null;
savedButton.trigger('click');
cy.wait(2000);

// Filter the newly created form
cy.location('search').then(search => {
let arr = search.split('=');
let arrayValues = arr[1].split('&');
cy.log(arrayValues[0]);
let dval=arr[2].split('&');
cy.log(dval);
//Form preview
cy.visit(`/${depEnv}/form/preview?f=${arrayValues[0]}&d=${dval[0]}`);
cy.waitForLoad();
//Verify new design is updated in the form
cy.get('label').contains('Select List').should('be.visible');

//Delete form after test run
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.get('[data-test="canRemoveForm"]').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();
});



});


});
1 change: 1 addition & 0 deletions tests/functional/cypress/fixtures/test_schema.json
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":""}]}

0 comments on commit a86f055

Please sign in to comment.