Skip to content

Commit

Permalink
Merge branch 'main' into feat/forms-1240-external-api
Browse files Browse the repository at this point in the history
  • Loading branch information
usingtechnology committed Jun 13, 2024
2 parents 0285b02 + 9bee9bb commit 851e23f
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 40 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cypress-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ jobs:
with:
name: cypress-screenshots
path: '${{ github.workspace }}/tests/functional/screenshots'

4 changes: 2 additions & 2 deletions tests/functional/cypress/e2e/about.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -21,4 +21,4 @@ describe('Application About Page', () => {
}

});
});
});
9 changes: 9 additions & 0 deletions tests/functional/cypress/e2e/form-design-advanceddata.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

})

Expand Down
23 changes: 13 additions & 10 deletions tests/functional/cypress/e2e/form-design-advancedfield.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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();

})

});




});
});
14 changes: 10 additions & 4 deletions tests/functional/cypress/e2e/form-design-basicfields.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

});



});


});

});
Original file line number Diff line number Diff line change
Expand Up @@ -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();

})

Expand Down
19 changes: 13 additions & 6 deletions tests/functional/cypress/e2e/form-simple-form-publish.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();


});

});

Expand Down
195 changes: 195 additions & 0 deletions tests/functional/cypress/e2e/form-team-management.cy.js
Original file line number Diff line number Diff line change
@@ -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 ([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();
// 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 ([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.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();
})

});

});
Loading

0 comments on commit 851e23f

Please sign in to comment.