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.
- Loading branch information
Showing
2 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
tests/functional/cypress/e2e/form-team-management.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,116 @@ | ||
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 simplebcaddress and form submission', () => { | ||
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(); | ||
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 ([email protected])').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.get('#input-86').should('have.value','true'); | ||
cy.get('#input-87').should('have.value','true'); | ||
cy.get('#input-88').should('have.value','true'); | ||
cy.get('#input-91').should('have.value','true'); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}); | ||
|
||
}); |
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 |
---|---|---|
|
@@ -37,8 +37,8 @@ export function formsettings(){ | |
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('[email protected]'); | ||
cy.get('#input-92').click(); | ||
cy.get('#input-92').type('[email protected]'); | ||
cy.get('#input-58').click(); | ||
cy.contains("Citizens' Services (CITZ)").click(); | ||
cy.get('#input-62').click(); | ||
|