ToolJet/cypress-tests/cypress/e2e/authentication/signUp.cy.js
Ajith KV 142d54bc50
Fixed failing profile cypress spec (#6245)
* Fix failed profile spec

* Modify data-cy of the dashboard section header

* Fix manage users spec

* Fix user permission spec

* Remove single workspace cypress test cases

* Add indentation changes

* Update self host signup spec

* Update cypress config file

* adding changes to capture downloads

* fix cypress tests for actions

* fecth invitation url from the database

* database test commit

* test commit

* test commit

* test commit

* test commit for pg host

* test commit

* commit for screenshot

* revert test commits

* Update sql task name

* Add changes for actions

* Fix manage groups spec

* Update folder structure

* Fix user permission spec

---------

Co-authored-by: Adish M <[email protected]>
2023-05-09 19:33:37 +05:30

70 lines
2.3 KiB
JavaScript

import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { SignUpPageElements } from "Support/utils/manageSSO";
import { fake } from "Fixtures/fake";
import {
verifyConfirmEmailPage,
verifyConfirmPageElements,
verifyOnboardingQuestions,
verifyInvalidInvitationLink,
} from "Support/utils/onboarding";
import { dashboardText } from "Texts/dashboard";
describe("User signup", () => {
const data = {};
data.fullName = fake.fullName;
data.email = fake.email.toLowerCase().replaceAll("[^A-Za-z]", "");
data.workspaceName = fake.companyName;
let invitationLink = "";
before(() => {
cy.visit("/");
});
it("Verify sign up page elements", () => {
cy.wait(500);
cy.reload();
cy.get(commonSelectors.createAnAccountLink).realClick();
SignUpPageElements();
cy.clearAndType(commonSelectors.nameInputField, data.fullName);
cy.clearAndType(commonSelectors.emailInputField, data.email);
cy.clearAndType(commonSelectors.passwordInputField, commonText.password);
cy.get(commonSelectors.signUpButton).click();
cy.wait(500);
cy.task("updateId", {
dbconfig: Cypress.env("app_db"),
sql: `select invitation_token from users where email='${data.email}';`,
}).then((resp) => {
invitationLink = `/invitations/${resp.rows[0].invitation_token}`;
});
verifyConfirmEmailPage(data.email);
});
it("Verify the singup invitation and onboarding flow", () => {
cy.visit(invitationLink);
verifyConfirmPageElements();
cy.get(commonSelectors.setUpToolJetButton).click();
cy.wait(4000);
cy.get("body").then(($el) => {
if (!$el.text().includes(dashboardText.emptyPageHeader)) {
verifyOnboardingQuestions(data.fullName, data.workspaceName);
cy.get(commonSelectors.workspaceName).verifyVisibleElement(
"have.text",
data.workspaceName
);
} else {
cy.get(commonSelectors.workspaceName).verifyVisibleElement(
"have.text",
"Untitled workspace"
);
}
});
});
it("Verify invalid invitation link", () => {
cy.visit(invitationLink);
verifyInvalidInvitationLink();
cy.get(commonSelectors.backtoSignUpButton).click();
cy.get(commonSelectors.SignUpSectionHeader).should("be.visible");
});
});