Skip to content

Commit

Permalink
test: FORMS-1692 Cypress test scripts for the Polygon marker point fo…
Browse files Browse the repository at this point in the history
…r Map component (#1585)

* #992 Fix cypress scripts

* #1011 Form design page

* #1011 test scripts

* #1023 cypress scripts

* #1023 advanced data components

* #1023 Updated scripts

* #1023 updation

* Updated json file

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

* #FORMS-974

* #974 updates

* #980 modification to cypress config

* FORMS-980

* #992

* #992 Fix cypress scripts

* #1011 Form design page

* #1011 test scripts

* #1023 cypress scripts

* #1023 advanced data components

* #1023 Updated scripts

* #1023 updation

* Updated json file

* #1059 workflow file for cypress

* #1059 updated the base url

* #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

* #1059 updated package

* #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

* #1488 public form submission

* #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

* #1478/Draft submission

* Scripts for draft submission

* #1478 Added column management functionality and delete button

* Fixed some CI/Cd issues

* #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

* #1578 updated scripts

* #1578 Added email notification

* #1528 Scripts for email management

* #1528 Fixed some running issues

* Fixed running issues

* Modified form-team-managememnt.cy.js file name

* Fixed issue with export button click

* #1346 Test scripts for API export functionality validation

* #1346 Added External API existence checks

* #1619 Added scripts for validatimg Meta form section

* #1619 Added help link validations on form settings page

* #1621 Test scripts for Map component display tab

* #Added preview button validation along with this script

* #1621 Added validations for custom css class

* Fixed running issues

* Fixed running issues with adding team member on PR env

* #1620 Added marker points for Map component

* #Added validations for circular point marker

* Modified test scripts to run on PR environment

* Added validations for Map component

* Added polygon marker point for map component

* Fixed running issues on PR env

* Added submission workflow for the map component

* Fixed some spacing issues

* Fixed some running issues on PR env

---------

Co-authored-by: jasonchung1871 <[email protected]>
  • Loading branch information
nimya-aot and jasonchung1871 authored Feb 4, 2025
1 parent 68819b7 commit 38cbe50
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 21 deletions.
8 changes: 4 additions & 4 deletions tests/functional/cypress/e2e/form-design-advanceddata.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ it('Checks the Container component', () => {
cy.get('button').contains('Save').click();

});

/*
//Verify Edit Json button
cy.get('[ref=editJson]').then($el => {
Expand All @@ -112,7 +112,7 @@ it('Checks the Container component', () => {
});
let acecont=cy.get('div.ace_content');
/*
cy.get('div.ace_content').then($el => {
cy.get('div.ace_content').type('{selectall}{backspace}');
Expand Down Expand Up @@ -144,10 +144,10 @@ it('Checks the Container component', () => {
cy.get('.ui').click();
cy.contains('Male').should('be.visible');
*/
cy.get('button').contains('Save').click();

*/

//});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ 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(()=>{
Expand All @@ -24,14 +19,9 @@ describe('Form Designer', () => {
});
});
it('Visits the form settings page', () => {


cy.viewport(1000, 1100);
cy.waitForLoad();

formsettings();


});
// Checks Map component functionalities
it('Checks Map component for Point marker', () => {
Expand All @@ -43,7 +33,6 @@ describe('Form Designer', () => {
cy.get('[data-type="map"]')
.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');
Expand All @@ -59,8 +48,6 @@ describe('Form Designer', () => {
cy.get('input[name="data[customClass]"').should('exist');
cy.get(':nth-child(2) > .nav-link').click();
cy.wait(2000);
//cy.get('a[title="Draw a marker"]').then($el => {

cy.get('a[title="Draw a marker"]').then($el => {
const marker_elem=$el[0];
cy.get(marker_elem).click({force: true});
Expand All @@ -70,7 +57,6 @@ describe('Form Designer', () => {
cy.get(layer_del_btn)
.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords.x, -30, { force: true })
//.trigger('mousemove', coords.y, +100, { force: true })
.trigger('mouseup', { force: true });
});
cy.get('img[alt="Marker"]').click({ force: true });
Expand Down Expand Up @@ -128,7 +114,6 @@ describe('Form Designer', () => {
let shareFormButton = cy.get('[data-cy=shareFormButton]');
expect(shareFormButton).to.not.be.null;
shareFormButton.trigger('click').then(()=>{
//let shareFormLinkButton = cy.get('[data-cy=shareFormLinkButtonss]');
let shareFormLinkButton=cy.get('.mx-2');
expect(shareFormLinkButton).to.not.be.null;
shareFormLinkButton.trigger('click');
Expand All @@ -147,4 +132,4 @@ describe('Form Designer', () => {

});

});
});
167 changes: 167 additions & 0 deletions tests/functional/cypress/e2e/form-design-map-polygon-marker.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
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();
});
// Checks Map component functionalities
it('Checks Map component for Polygon marker', () => {
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-type="map"]')
.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords.x, -550, { force: true })
.trigger('mouseup', { force: true });
cy.waitForLoad();
cy.get('input[name="data[label]"]').type('s');
cy.get('textarea[name="data[description]"]').should("have.attr","placeholder","This will appear below the map");
cy.get('textarea[name="data[description]"]').type('Map location above');
cy.wait(2000);
cy.get('textarea[placeholder="Add a tooltip beside the label"]').type('Add your desired location');
cy.wait(2000);
cy.get(':nth-child(2) > .nav-link').click();
cy.wait(2000);
cy.wait(2000);
cy.get('input[value="circle"]').click();
cy.get('input[value="polygon"]').click();
cy.get('input[name="data[numPoints]"').type('{selectall}{backspace}');
cy.get('input[name="data[numPoints]"').type('3');
cy.wait(2000);
cy.get('a[title="Draw a marker"]').then($el => {
const marker_elem=$el[0];
cy.get(marker_elem).click({force: true});
});

cy.get('a[title="No layers to delete"]').then($el => {
const layer_del_btn=$el[0];
cy.get(layer_del_btn)
.trigger('mousedown', { which: 1}, { force: true })
//.trigger('mousemove', coords.x, -30, { force: true })
.trigger('mousemove', coords.y, +450, { force: true })
.trigger('mouseup', { force: true });
});
cy.get('img[alt="Marker"]').click({ force: true });
cy.wait(2000);
cy.get('a.leaflet-draw-draw-polygon').then($el => {
const draw_polygon=$el[0];

cy.get(draw_polygon).click();
});
cy.get('div[class="leaflet-draw-tooltip leaflet-draw-tooltip-single"]').click();
cy.get('div[class="leaflet-draw-tooltip leaflet-draw-tooltip-single"]').click();
cy.get('div[class="leaflet-draw-tooltip leaflet-draw-tooltip-single"]').click();
cy.get('div[class="leaflet-draw-tooltip leaflet-draw-tooltip-single"]').click();
cy.get('a[title="No layers to delete"]').then($el => {
const layer_del_btn=$el[0];
cy.get(layer_del_btn)
.trigger('mousedown', { which: 1}, { force: true })
//.trigger('mousemove', coords.x, -30, { force: true })
.trigger('mousemove', coords.y, +350, { force: true })
.trigger('mouseup', { force: true });
});
cy.get('.leaflet-interactive').then($el => {
const interactive_btn=$el[1];
cy.get(interactive_btn).click({ force: true });
});
cy.get('div[class="leaflet-marker-icon leaflet-mouse-marker leaflet-zoom-hide leaflet-interactive"]').click({ force: true });

cy.get('a[title="Finish drawing"]').click({ force: true });
cy.get('.leaflet-interactive').should('exist');
cy.wait(2000);
cy.get('g').find('path[stroke-linejoin="round"]').should('exist');

});
cy.waitForLoad();
cy.get('button').contains('Save').click();
});

it('Checks form submission for a Map component', () => {
cy.viewport(1000, 1100);
cy.waitForLoad();
// 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 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();
//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');
//Form submission verification
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
cy.wait(2000);
cy.get('button').contains('Submit').should('be.visible');
cy.wait(2000);
cy.get('a.leaflet-draw-draw-circle').then($el => {
const draw_circle=$el[0];
cy.get(draw_circle).click();
});
cy.get('img[alt="Marker"]').then($el => {
const mark_cir=$el[0];
const coords = $el[0].getBoundingClientRect();
cy.get(mark_cir)
.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords.x, -5, { force: true })
.trigger('mouseup', coords.x, -5, { force: true })
cy.wait(2000);
});
cy.get('a[title="Draw a marker"]').then($el => {
const marker_elem=$el[0];
cy.get(marker_elem).click({force: true});
});
cy.get('div[class="leaflet-draw-tooltip leaflet-draw-tooltip-single"]').click({ force: true });

cy.get('div[class="leaflet-popup-content"]').find('p').contains('Only 3 features per submission').should('be.visible');
cy.get('button').contains('Submit').click();
cy.wait(4000);
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.location('pathname').should('eq', `/${depEnv}/form/success`);
cy.contains('h1', 'Your form has been submitted successfully');
cy.wait(4000);
cy.get('g').find('path[stroke-linejoin="round"]').should('exist');
//Delete form after test run
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();

});

});

});


2 changes: 1 addition & 1 deletion tests/functional/cypress/e2e/form-submission-export.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("Form Designer", () => {
let arrayValues = arr[1].split("&");
cy.log(arrayValues[0]);
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.wait(6000);
//Publish the form
cy.get(".v-label > span").click();

Expand Down

0 comments on commit 38cbe50

Please sign in to comment.