diff --git a/.github/workflows/cypress-ci.yaml b/.github/workflows/cypress-ci.yaml index 340849817..cbe8572a2 100644 --- a/.github/workflows/cypress-ci.yaml +++ b/.github/workflows/cypress-ci.yaml @@ -39,4 +39,3 @@ jobs: with: name: cypress-screenshots path: '${{ github.workspace }}/tests/functional/screenshots' - diff --git a/tests/functional/cypress/e2e/about.cy.js b/tests/functional/cypress/e2e/about.cy.js index e1d2f4013..e8140deb7 100644 --- a/tests/functional/cypress/e2e/about.cy.js +++ b/tests/functional/cypress/e2e/about.cy.js @@ -3,12 +3,12 @@ const depEnv = Cypress.env('depEnv'); const baseUrl = Cypress.env('baseUrl'); + describe('Application About Page', () => { it('Visits the app about page', () => { if(depEnv=="") { - cy.visit(`/app`); cy.contains('Create, publish forms, and receive submissions with the Common Hosted Forms Service.').should('be.visible'); } @@ -21,4 +21,4 @@ describe('Application About Page', () => { } }); -}); +}); \ No newline at end of file diff --git a/tests/functional/cypress/e2e/form-design-advanceddata.cy.js b/tests/functional/cypress/e2e/form-design-advanceddata.cy.js index c119a06e2..b5a5b3bcf 100644 --- a/tests/functional/cypress/e2e/form-design-advanceddata.cy.js +++ b/tests/functional/cypress/e2e/form-design-advanceddata.cy.js @@ -218,6 +218,15 @@ it('Checks the Container component', () => { cy.get('.list-group-item').should('be.visible'); cy.get('[ref="datagrid-dataGrid"]').should('be.visible'); cy.get('.col-md-1').should('be.visible'); + + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + //Delete form after test run + //cy.get('.mdi-delete').click(); + cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click(); + cy.get('[data-test="continue-btn-continue"]').click(); }) diff --git a/tests/functional/cypress/e2e/form-design-advancedfield.cy.js b/tests/functional/cypress/e2e/form-design-advancedfield.cy.js index 552fe8854..1530de35c 100644 --- a/tests/functional/cypress/e2e/form-design-advancedfield.cy.js +++ b/tests/functional/cypress/e2e/form-design-advancedfield.cy.js @@ -257,11 +257,11 @@ describe('Form Designer', () => { }); cy.location('search').then(search => { //let pathName = fullUrl.pathname - let arr = search.split('='); - let arrayValues = arr[1].split('&'); + let arr = search.split('='); + let arrayValues = arr[1].split('&'); cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`); - cy.waitForLoad(); - }) + cy.waitForLoad(); + cy.waitForLoad(); // for print option verification cy.get(':nth-child(2) > .d-print-none > :nth-child(1) > .v-btn').should('be.visible'); @@ -314,11 +314,14 @@ describe('Form Designer', () => { cy.get('.col-md-9 > a').contains('add1.png'); cy.get('.ui > .choices__list > .choices__item').contains('THRIFTY FOODS'); - + //Delete form after test run + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + cy.waitForLoad(); + cy.get('.mdi-delete').click(); + cy.get('[data-test="continue-btn-continue"]').click(); + + }) }); - - - - -}); +}); \ No newline at end of file diff --git a/tests/functional/cypress/e2e/form-design-basicfields.cy.js b/tests/functional/cypress/e2e/form-design-basicfields.cy.js index 228d0dfd3..e6a0854a3 100644 --- a/tests/functional/cypress/e2e/form-design-basicfields.cy.js +++ b/tests/functional/cypress/e2e/form-design-basicfields.cy.js @@ -284,12 +284,18 @@ describe('Form Designer', () => { //cy.get('label').contains('Number').should('be.visible'); cy.get('label').contains('Select Gender'); + //Delete form after test run + cy.visit(`/${depEnv}/form/design?d=${arrayValues[0]}&f=${dval[0]}`); + cy.waitForLoad(); + cy.waitForLoad(); + //cy.get('[data-cy="settingsRouterLink"] > .text').click(); + cy.get('[data-cy="settingsRouterLink"] > .v-btn').click(); + cy.get('.mt-6 > :nth-child(2) > div > :nth-child(5) > .v-btn').click(); + cy.get('[data-test="continue-btn-continue"]').click(); + + }); - }); - }); - -}); \ No newline at end of file diff --git a/tests/functional/cypress/e2e/form-design-basiclayout-advanced-layout.cy.js b/tests/functional/cypress/e2e/form-design-basiclayout-advanced-layout.cy.js index bd1dcc03d..91b889e2c 100644 --- a/tests/functional/cypress/e2e/form-design-basiclayout-advanced-layout.cy.js +++ b/tests/functional/cypress/e2e/form-design-basiclayout-advanced-layout.cy.js @@ -249,6 +249,14 @@ it('Checks the Table', () => { cy.get('fieldset').should('be.visible'); cy.get('legend').should('be.visible'); cy.get('.v-skeleton-loader > .v-container').should('be.visible'); + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + //Delete form after test run + //cy.get('.mdi-delete').click(); + cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click(); + cy.get('[data-test="continue-btn-continue"]').click(); }) diff --git a/tests/functional/cypress/e2e/form-simple-form-publish.cy.js b/tests/functional/cypress/e2e/form-simple-form-publish.cy.js index 88ab713e3..af58f7e53 100644 --- a/tests/functional/cypress/e2e/form-simple-form-publish.cy.js +++ b/tests/functional/cypress/e2e/form-simple-form-publish.cy.js @@ -36,7 +36,7 @@ describe('Form Designer', () => { }); -// Verifying fields in the form settings page +// Publish a simple form with Simplebc Address component it('Checks simplebcaddress and form submission', () => { cy.viewport(1000, 1100); cy.waitForLoad(); @@ -80,7 +80,7 @@ describe('Form Designer', () => { //cy.log(arrayValues[2]); cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); cy.waitForLoad(); - }) + //Publish the form cy.get('.v-label > span').click(); @@ -98,11 +98,18 @@ describe('Form Designer', () => { expect(shareFormLinkButton).to.not.be.null; shareFormLinkButton.trigger('click'); cy.get('.mx-2 > .v-btn').click(); - }); - - - + }) + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + //Delete form after test run + //cy.get('.mdi-delete').click(); + cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click(); + cy.get('[data-test="continue-btn-continue"]').click(); + + }); }); diff --git a/tests/functional/cypress/e2e/form-team-management.cy.js b/tests/functional/cypress/e2e/form-team-management.cy.js new file mode 100644 index 000000000..ce520187e --- /dev/null +++ b/tests/functional/cypress/e2e/form-team-management.cy.js @@ -0,0 +1,195 @@ +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 team management before form publish', () => { + 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.intercept('GET', `/${depEnv}/api/v1/forms/*`).as('getForm'); + // Form saving + let savedButton = cy.get('[data-cy=saveButton]'); + expect(savedButton).to.not.be.null; + savedButton.trigger('click'); + cy.waitForLoad(); + + + // Go to My forms + cy.wait('@getForm').then(()=>{ + let userFormsLinks = cy.get('[data-cy=userFormsLinks]'); + expect(userFormsLinks).to.not.be.null; + userFormsLinks.trigger('click'); + }); + // Filter the newly created form + cy.location('search').then(search => { + //let pathName = fullUrl.pathname + let arr = search.split('='); + let arrayValues = arr[1].split('&'); + cy.log(arrayValues[0]); + //cy.log(arrayValues[1]); + //cy.log(arrayValues[2]); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + }) + + //Go to Team Management + + cy.get('.mdi-account-multiple').click(); + cy.get('.mdi-account-plus').click(); + //Search for a member to add + cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); + cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('NIM'); + cy.get(':nth-child(2) > .v-chip__content').should('be.visible'); + cy.get(':nth-child(4) > .v-chip__content').should('be.visible'); + cy.get(':nth-child(5) > .v-chip__content').should('be.visible'); + cy.contains('John, Nimya 1 CITZ:EX (nimya.1.john@gov.bc.ca)').click(); + cy.get(':nth-child(2) > .v-chip__content').click(); + cy.get(':nth-child(4) > .v-chip__content').click(); + cy.get(':nth-child(5) > .v-chip__content').click(); + cy.get('.v-btn--elevated > .v-btn__content > span').click(); + // Verify member is added with proper roles + cy.get('#input-90').should('be.checked'); + cy.get('#input-91').should('be.checked'); + cy.get('#input-93').should('be.checked'); + //Manage column views + cy.get('.mdi-view-column').click(); + cy.get('#input-121').should('be.checked'); + cy.get('#input-122').should('be.checked'); + cy.get('#input-123').should('be.checked'); + cy.get('#input-124').should('be.checked'); + + cy.get('#input-121').click(); + cy.waitForLoad(); + cy.get('#input-121').should('not.be.checked'); + //Column view management + + cy.get('.search').click(); + cy.get('.search').type('Designer'); + cy.get('[data-test="filter-table"] > .v-table__wrapper > table > tbody > .v-data-table__tr > :nth-child(2)').click(); + cy.get('[data-test="save-btn"] > .v-btn__content').click(); + cy.waitForLoad(); + //Verify the roles on dashboard + if(depEnv=="app") + { + cy.get('#input-137').should('not.exist'); + cy.get('#input-149').should('not.be.checked'); + } + else + { + cy.get('#input-150').should('not.be.checked'); + cy.get('#input-153').should('not.be.checked'); + cy.get('#input-154').should('not.be.checked'); + + } + + + + //Remove a user from Roles + cy.get('tbody > :nth-child(1) > [style="width: 1rem;"] > .v-btn').click(); + cy.waitForLoad(); + //cy.contains('REMOVE').click(); + cy.get('[data-test="continue-btn-continue"] > .v-btn__content > span').click(); + cy.waitForLoad(); + cy.contains('NIMJOHN').should('not.exist'); + + }); + + it('Checks team management after form publish', () => { + cy.viewport(1000, 1100); + cy.waitForLoad(); + + + cy.location('search').then(search => { + //let pathName = fullUrl.pathname + let arr = search.split('='); + let arrayValues = arr[1].split('&'); + cy.log(arrayValues[0]); + + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + cy.log(arrayValues[0]); + //Publish the form + cy.get('.v-label > span').click(); + + cy.get('span').contains('Publish Version 1'); + + cy.contains('Continue').should('be.visible'); + cy.contains('Continue').trigger('click'); + + + cy.get('.mdi-account-multiple').click(); + cy.get('.mdi-account-plus').click(); + //Search for a member to add + cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); + cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('NIM'); + cy.get(':nth-child(2) > .v-chip__content').should('be.visible'); + cy.get(':nth-child(4) > .v-chip__content').should('be.visible'); + cy.get(':nth-child(5) > .v-chip__content').should('be.visible'); + cy.contains('John, Nimya 1 CITZ:EX (nimya.1.john@gov.bc.ca)').click(); + cy.get(':nth-child(2) > .v-chip__content').click(); + cy.get(':nth-child(4) > .v-chip__content').click(); + cy.get(':nth-child(5) > .v-chip__content').click(); + cy.get('.v-btn--elevated > .v-btn__content > span').click(); + cy.waitForLoad(); + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + //Delete form after test run + cy.get('.mdi-delete').click(); + cy.get('[data-test="continue-btn-continue"]').click(); + }) + + }); + +}); \ No newline at end of file diff --git a/tests/functional/cypress/support/login.js b/tests/functional/cypress/support/login.js index 6ae23b5b7..08637931b 100644 --- a/tests/functional/cypress/support/login.js +++ b/tests/functional/cypress/support/login.js @@ -12,6 +12,9 @@ export function formsettings(){ } else { + + + cy.visit(`/${depEnv}`); } @@ -28,37 +31,49 @@ export function formsettings(){ let title="title" + Math.random().toString(16).slice(2); - cy.get('#input-15').type(title); - cy.get('#input-17').type('test description'); - cy.get('#input-22').click(); + + cy.get('[data-test="text-name"]').type(title); + + cy.get('[data-test="text-description"]').type('test description'); + + cy.get('input[value="public"]').click(); cy.get('.v-selection-control-group > .v-card').should('be.visible'); - cy.get('#input-23').click(); + cy.get('input[value="login"]').click(); cy.get('.v-row > .v-input > .v-input__control > .v-selection-control-group > :nth-child(1) > .v-label > span').contains('IDIR'); cy.get('span').contains('Basic BCeID'); cy.get(':nth-child(2) > .v-card > .v-card-text > .v-input--error > :nth-child(2)').contains('Please select 1 log-in type'); - cy.get('#input-24').click(); - cy.get('#checkbox-25').click(); - cy.get('#checkbox-28').click(); - cy.get('#checkbox-38').click(); - cy.get('#checkbox-54').click(); - cy.get('#input-91').click(); - cy.get('#input-91').type('abc@gmail.com'); - cy.get('#input-58').click(); + + cy.get('input[value="team"]').click(); + + cy.get('[data-test="canSaveAndEditDraftsCheckbox"]').click(); + cy.get(':nth-child(3) > .v-card > .v-card-text > :nth-child(2) > .v-input__control > .v-selection-control > .v-label > span').click();//Update the status of the form + //cy.get(':nth-child(3) > .v-input__control > .v-selection-control > .v-label > div > .mdi-flask').should('be.enabled');//Multiple draft upload + cy.get(':nth-child(5) > .v-input__control > .v-selection-control > .v-label > div > span > strong').click();//Copy existing submission + cy.get(':nth-child(7) > .v-input__control > .v-selection-control > .v-label > div').click();//Wide form Layout + + cy.get('[data-test="email-test"] > .v-input__control > .v-selection-control > .v-label > div > span').click(); + cy.get(':nth-child(4) > .v-card > .v-card-text > .v-text-field > .v-input__control > .v-field > .v-field__field > .v-field__input').type('abc@gmail.com'); + + cy.get('.v-row > :nth-child(1) > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); cy.contains("Citizens' Services (CITZ)").click(); - cy.get('#input-62').click(); + + cy.get('[data-test="case-select"]').click(); cy.get('.v-list').should('contain','Applications that will be evaluated followed'); cy.get('.v-list').should('contain','Collection of Datasets, data submission'); cy.get('.v-list').should('contain','Registrations or Sign up - no evaluation'); cy.get('.v-list').should('contain','Reporting usually on a repeating schedule or event driven like follow-ups'); cy.get('.v-list').should('contain','Feedback Form to determine satisfaction, agreement, likelihood, or other qualitative questions'); cy.contains('Reporting usually on a repeating schedule or event driven like follow-ups').click(); - cy.get('#input-69').click(); - cy.get('#input-75').click(); - cy.get('.mt-3 > .mdi-help-circle-outline').should('be.visible') + + cy.get('input[value="test"]').click(); + ; + cy.get('[data-test="api-true"] > .v-label > span').click(); + cy.get('.mt-3 > .mdi-help-circle-outline').should('be.visible'); cy.get('.mt-3 > .mdi-help-circle-outline').click(); cy.get('.d-flex > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); cy.get('.d-flex > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('test label'); - cy.get('#checkbox-80').click(); + cy.get(':nth-child(4) > .v-card-text > .v-input > .v-input__control > .v-selection-control > .v-label > span').click(); cy.get('button').contains('Continue').click(); + } \ No newline at end of file