Skip to content

Commit

Permalink
test: FORMS-1528 Cypress test scripts for email management functional…
Browse files Browse the repository at this point in the history
…ity (#1534)

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

* 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

---------

Co-authored-by: jasonchung1871 <[email protected]>
  • Loading branch information
nimya-aot and jasonchung1871 authored Dec 4, 2024
1 parent 4582746 commit 6d042d9
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 188 deletions.
3 changes: 1 addition & 2 deletions tests/functional/cypress/e2e/form-apikey-cdogs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ describe('Form Designer', () => {

cy.get('[data-test="canRemoveForm"]').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.waitForLoad();
cy.waitForLoad();
cy.wait(9000);
cy.get('#logoutButton > .v-btn__content > span').click();

})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('Form Designer', () => {
const coords = $el[0].getBoundingClientRect();
cy.get('[data-type="bcaddress"]')
.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords.x, +30, { force: true })
.trigger('mousemove', coords.x, -30, { force: true })
//.trigger('mousemove', coords.y, +100, { force: true })
.trigger('mouseup', { force: true });
cy.waitForLoad();
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/cypress/e2e/form-submission-export.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,18 @@ describe("Form Designer", () => {
cy.get(".mdi-list-box-outline").click();
cy.waitForLoad();
//Export submission files
cy.get(".mdi-download").click();

//Verify submission file name
cy.get("h3").then(($elem) => {
const rem = $elem.text();
cy.log(rem);
const remname = rem + "_submissions.json";
cy.wait(2000);
cy.get(".mdi-download").click({ force: true });
cy.wait(2000);
cy.get(".ml-1").contains(remname);
});

cy.get(':nth-child(2) > .v-col > .v-input > .v-input__control > .v-selection-control-group > :nth-child(2) > .v-label > .radioboxLabelStyle').click();
cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').contains('1');
cy.contains('form.submissionId').should('be.visible');
Expand Down
216 changes: 216 additions & 0 deletions tests/functional/cypress/e2e/form-team-email-management.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
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("button").contains("Save").click();
});
// Form saving
let savedButton = cy.get("[data-cy=saveButton]");
expect(savedButton).to.not.be.null;
savedButton.trigger("click");
cy.wait(5000);
// Filter the newly created form
cy.location('search').then(search => {

let arr = search.split('=');
let arrayValues = arr[1].split('&');
cy.log(arrayValues[0]);
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('[data-test="ApproverRoleCheckbox"]').should("be.visible");
cy.get('[data-test="ReviewerRoleCheckbox"]').should("exist");
cy.get('[data-test="TeamManagerRoleCheckbox"]').should("be.visible");
cy.get('[data-test="ApproverRoleCheckbox"]').click({
multiple: true,
force: true,
});
//Manage column views

cy.get(".mdi-view-column").click();

cy.get("table").contains("td", "Reviewer").should("be.visible");
cy.get("table").contains("td", "Approver").should("be.visible");

cy.get(
'[data-test="filter-table"] > .v-table__wrapper > table > tbody > :nth-child(1) > :nth-child(2)'
).click();
cy.waitForLoad();

//Column view management

cy.get(".search").click();
cy.get(".search").type("Designer");
cy.get("table").contains("td", "Designer").should("be.visible");
cy.get('[data-test="save-btn"] > .v-btn__content').click();
cy.waitForLoad();

//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");
cy.get('[data-test="OwnerRoleCheckbox"]').click();
cy.wait(1000);
cy.get(".v-alert__content")
.contains("Can't remove the only owner.")
.should("be.visible");
cy.get(".v-alert__close").click();


//Email management functionality
cy.get(".mdi-cog").click();
cy.wait(2000);
cy.get(".mdi-email").click();
cy.wait(2000);
cy.get('input[type="text"]').then(($el) => {
const sub = $el[1];
const titl = $el[2];

//cy.get(sub).click({force: true});
cy.get(sub).should("have.value", "{{ form.name }} Accepted");
cy.get(titl).should("have.value", "{{ form.name }} Accepted");
cy.get(sub).type("{selectall}{backspace}");
cy.get("div")
.contains("Please enter a Subject line for the email")
.should("be.visible");
cy.get(titl).type("{selectall}{backspace}");
cy.get("div")
.contains("Please enter a Title for the email")
.should("be.visible");
cy.get("textarea").then(($el) => {
const body = $el[0];
cy.get(body).type("{selectall}{backspace}");
cy.get("div")
.contains("Please enter a Body for the email")
.should("be.visible");
cy.get(body).type("Thank you for submission, Click on this link");
});
cy.get(sub).type("CHEFS submission Subject");
cy.get(titl).type("CHEFS submission Title");
cy.get(".v-form > .v-btn").should("be.enabled");
cy.get(".v-form > .v-btn").click();
});
});

it("Checks team management after form publish", () => {
cy.viewport(1000, 1100);
cy.waitForLoad();
cy.get(".mdi-cog").click();
//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.wait(3000);
cy.get(":nth-child(3) > .v-chip__content").click();
cy.wait(3000);
cy.get(":nth-child(4) > .v-chip__content").click();
cy.wait(3000);
cy.get(":nth-child(5) > .v-chip__content").click();
cy.wait(3000);
cy.get(".v-btn--elevated > .v-btn__content > span").click();
cy.wait(3000);
/*
cy.get('[data-test="OwnerRoleCheckbox"]').then(($el) => {
const ownercheck = $el[0];
const ownercheck1 = $el[1];
cy.get(ownercheck).click();
cy.get(ownercheck1).click();
});
cy.get(".v-alert__content")
.contains("You can't update an owner's roles.")
.should("be.visible");
*/
cy.get(".mdi-cog").click();

cy.waitForLoad();
//Delete form after test run
cy.get(".mdi-delete").click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get("#logoutButton > .v-btn__content > span").click();
});
});
Loading

0 comments on commit 6d042d9

Please sign in to comment.