ToolJet/cypress-tests/cypress/support/utils/common.js
Midhun Kumar E cf31de35fc
Upgrade Cypres to V10.3.1 (#3651)
* Remove cypress and its dependencies from root dir

* Install cypress to cypress-tests  directory

* Move cypress specs and utils

* Remove older files

* Fix package.json
2022-07-25 10:15:28 +05:30

45 lines
1.4 KiB
JavaScript

import { path } from "Texts/common";
import { usersSelector } from "Selectors/manageUsers";
import { profileSelector } from "Selectors/profile";
import { commonSelectors } from "Selectors/common";
import moment from "moment";
export const navigateToProfile = () => {
cy.get(profileSelector.profileDropdown).invoke("show");
cy.contains("Profile").click();
cy.url().should("include", path.profilePath);
};
export const logout = () => {
cy.get(profileSelector.profileDropdown).invoke("show");
cy.contains("Logout").click();
cy.url().should("include", path.loginPath);
};
export const navigateToManageUsers = () => {
cy.get(usersSelector.dropdown).invoke("show");
cy.contains("Manage Users").click();
cy.url().should("include", path.manageUsers);
};
export const navigateToManageGroups = () => {
cy.get(commonSelectors.dropdown).invoke("show");
cy.contains("Manage Groups").click();
cy.url().should("include", path.manageGroups);
};
export const navigateToManageSSO = () => {
cy.get(commonSelectors.dropdown).invoke("show");
cy.contains("Manage SSO").click();
cy.url().should("include", path.manageSSO);
};
export const randomDateOrTime = (format = "DD/MM/YYYY") => {
let endDate = new Date();
let startDate = new Date(2018, 0, 1);
startDate = new Date(
startDate.getTime() +
Math.random() * (endDate.getTime() - startDate.getTime())
);
return moment(startDate).format(format);
};