package.cypress-utils.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
// selectors ------------------------------------------------
type CommonSelectors = {
alertTitle: string;
alertModalSubmitButton: string;
checkbox: string;
checkboxLabel: string;
dropdownContainer: string;
dropdownIcon: string;
heading: string;
paneBody: string;
paneHeader: string;
selectOption: string;
toastMessage: string;
toastCloseButton: string;
windowAlert: string;
body: string;
paneModalCrossIcon: string;
inputField: string;
alertConfirmationText: string;
alertCancelButton: string;
alertModalCrossIcon: string;
saveChangesButton: string;
cancelButton: string;
inputFieldError: string;
selectDropDownError: string;
subTitleHeading: (index: number) => string;
noDataTitle: string;
noDataDescription: string;
backdrop: string;
menuBarHeading: string;
tabItem: string;
dropdownWrapper: (index: number) => string;
toggleButton: string;
tooltip: string;
articlePageTitle: string;
labelInputError: string;
urlInputError: string;
noDataPrimaryButton: string;
modalHeader: string;
nameInputError: string;
selectContainer: string;
dropdownMenu: string;
nthDropdownIcon: (index: number) => string;
sidebarToggle: string;
customDataCy: (name: string) => string;
leftSubHeader: string;
subheader: string;
settingsLink: string;
nthInputField: (index: number) => string;
nthTabItem: (index: number) => string;
ticketFieldTextInput: (label: string) => string;
};
type MemberSelectors = {
activatedMembersButton: string;
activateOrDeactivateMember: string;
columnCheckBox: string;
continueButton: string;
deactivatedAgentsButton: string;
dropDownIcon: string;
editButton: string;
email: string;
menuBarHeading: string;
membersTab: string;
name: string;
newButton: string;
role: string;
roleLabel: (role: string) => string;
searchTextField: string;
submitButton: string;
columnsButton: string;
columnsDropdownContainer: string;
emailDropdownItemLabel: string;
roleDropdownItemLabel: string;
inviteStatusDropdownItemLabel: string;
heading: string;
activateButton: string;
deactivateButton: string;
rolesButton: string;
statusTag: string;
};
type MemberFormSelectors = {
emailTextField: string;
firstNameTextField: string;
lastNameTextField: string;
emailInput: string;
emailErrorField: string;
cancelButton: string;
};
type LoginSelectors = {
appleAuthenticationButton: string;
emailTextField: string;
googleAuthenticationButton: string;
githubAuthenticationButton: string;
loginViaEmailButton: string;
otpField: string;
passwordTextField: string;
rememberMeCheckBox: string;
submitButton: string;
twitterAuthenticationButton: string;
};
type ProfileSelectors = {
tab: string;
logoutLink: string;
profileOptionsContainer: string;
myProfileButton: string;
organizationSettingsButton: string;
appSwitcherBody: string;
sidebarInfo: string;
appSwitcherBackButton: string;
};
interface TableSelectors {
nthColumn: (n: number) => string;
tableBody: string;
tableHeader: string;
tableRow: string;
spinner: string;
nthHeading: (n: number) => string;
}
type SignUpSelectors = {
emailTextField: string;
firstNameTextField: string;
lastNameTextField: string;
organizationNameTextField: string;
organizationSubmitButton: string;
otpTextBox: string;
profileSubmitButton: string;
signupViaEmailButton: string;
submitButton: string;
subdomainNameTextField: string;
subdomainError: string;
};
type HelpIconSelectors = {
helpButton: string;
documentationButton: string;
keyboardShortcutButton: string;
chatButton: string;
whatsNewButton: string;
whatsNewWidgetInfo: string;
whatsNewWidgetCloseButton: string;
keyboardShortcutPaneHeading: string;
keyboardShortcutPaneCrossIcon: string;
};
type ChatWidgetSelectors = {
chatWidgetHomeCard: string;
widgetSubmitButton: string;
chatBubbleMessage: string;
chatCloseButton: string;
widgetIframe: string;
};
type NeetoEditorSelectors = {
boldOption: string;
italicOption: string;
underlineOption: string;
strikeOption: string;
codeBlockOption: string;
highlightOption: string;
linkInput: string;
linkSubmitButton: string;
commandList: (index: number) => string;
imageUploadUrlSubmitButton: string;
imageUploadUrlInputTextField: string;
uploadInput: string;
editorMenuBarWrapper: string;
undoOption: string;
redoOption: string;
imageWrapper: string;
};
type IpRestrictionSelectors = {
addButton: string;
ipStartTextField: (index: number) => string;
ipEndTextField: string;
cancelButton: string;
ipRangeRow: string;
enableIpRestrictionCheckbox: string;
};
type RolesSelectors = {
newButton: string;
proceedButton: string;
cancelButton: string;
tableHeaderRoleName: string;
nameTextField: string;
searchTextField: string;
updateRolePaneHeading: string;
updateRoleCancelButton: string;
descriptionTextField: string;
permissionCategoryTitle: string;
headerColumn: string;
dropDownIcon: string;
tableHeaderRoleTitle: string;
};
type TagsSelectors = {
newTagButton: string;
tagNameTextField: string;
editButton: string;
deleteButton: string;
cancelButton: string;
submitButton: string;
searchTextField: string;
descriptionTextArea: string;
};
type MergeTagsSelectors = {
mergeTagsButton: string;
mergeButton: string;
sourceSearchTextField: string;
sourceTagsList: string;
destinationTagsList: string;
destinationSearchTextField: string;
cancelButton: string;
proceedButton: string;
disabledTag: string;
};
type NeetoFiltersSelectors = {
emailSelectContainer: string;
filterPaneHeading: string;
neetoFiltersEmailBlock: string;
neetoFiltersRoleBlock: string;
neetoFiltersBarClearButton: string;
neetoFiltersNameFilterField: string;
neetoFilterNameBlock: string;
roleSelectContainer: string;
filterButton: string;
filtersClearButton: string;
filterDoneButton: string;
filteredMembersCount: string;
allMenubarBlock: string;
filtersEmailFilter: string;
paneModalCrossIcon: string;
};
// texts ------------------------------------------------
type CommonTexts = {
activate: string;
block: string;
copiedToClipboard: string;
crossSiteScript: string;
deactivate: string;
delete: string;
delete1: string;
edit: string;
invalidEmailMessage: string;
invalidSearchInput: string;
logout: string;
new: string;
takeAction: string;
unblock: string;
emailRequiredError: string;
emailTakenMessage: string;
nameTakenMessage: string;
all: string;
proceed: string;
settings: string;
unsavedChangesAlertTitle: string;
unsavedChangesAlertMessage: string;
clearFilters: string;
filters: string;
descriptionRequiredMessage: string;
deactivated: string;
nameExistsMsg: string;
cancel: string;
continue: string;
};
type MemberText = {
addMember: string;
admin: string;
agent: string;
agents: string;
activeMembersHeading: string;
accountActivatedToastMessage: string;
activateMember: string;
activateMemberAlertMessage: string;
addMemberToProducts: string;
deactivateAccountToastMessage: string;
deactivateMember: string;
deactivateMemberAlertMessage: string;
editMember: string;
inviteMessage: string;
memberAddedMessage: string;
members: string;
newHeading: string;
updatedMemberRole: string;
searchMembers: string;
noDataTitle: string;
editor: string;
changeRole: string;
changeRoleAlertMsg: string;
collaborator: string;
};
type MemberTableTexts = {
created: string;
email: string;
name: string;
role: string;
teams: string;
};
type MemberFormErrorTexts = {
emailRequired: string;
emailInvalid: string;
removeInvalidEmail: string;
};
type SignUpTexts = {
email: string;
profile: string;
tryItFree: string;
};
type Environment = {
development: string;
staging: string;
};
type HelpIconTexts = {
documentation: string;
welcome: string;
keyboardShortcuts: string;
liveChat: string;
newConversation: string;
chatMessage: string;
whatsNew: string;
whatsNewHeading: string;
};
type ProfileTexts = {
logout: string;
productSwitcher: string;
chooseYourNeetoProduct: string;
myProfile: string;
profileSettings: string;
myOrganization: string;
};
type RolesTexts = {
newRole: string;
editRole: string;
nameRequiredErrorMessage: string;
deleteRole: string;
alertMessage: (roleName: string) => string;
adminPermissionsNotBeChangeMessage: string;
manageRoles: string;
manageRolesAndPermissions: string;
roles: string;
noRolesText: string;
searchRoles: string;
namePlaceholder: string;
descriptionPlaceholder: string;
};
type TagsTexts = {
articleTags: string;
addNewTag: string;
createTag: string;
editTag: string;
alertMessage: (tagName: string) => string;
tagNameRequiredMessage: string;
alertTitle: string;
noTagsFoundText: string;
manageTags: string;
createAndManageTags: string;
searchPlaceHolder: string;
noTagsText: string;
mergeTags: string;
mergeTagsAlertMessage: (sourceTag: string, destinationTag: string) => string;
};
// fixtures ---------------------------------------------
type Fake = {
firstName: string;
middleName: string;
lastName: string;
companyName: string;
fullName: string;
email: string;
streetAddress: string;
streetName: string;
city: string;
zipCode: string;
country: string;
sentence: string;
number: number;
amount: number;
projectName: string;
department: string;
word: string;
words: string;
randomString: string;
state: string;
quantity: number;
randomDay: number;
percentage: number;
uniqueName: string;
uniqueDepartment: string;
phoneNumber: (format: string) => string;
url: string;
secureUrl: string;
domain: string;
otp: number;
longNumber: number;
decimalNumber: number;
};
// utils ------------------------------------------------
// Utils: common
export function initCustomCommands(): void;
export function dataCy(dataCyId: string): string;
export function getTestTitle(): string;
export function getUrl(path: string): string;
export function initializeCredentials(props: {
businessName: string;
currentUserName: string;
email: string;
firstName: string;
lastName: string;
domain: string;
subdomainName: string;
skipSetup: boolean;
}): string;
/**
*
* The joinHyphenCase function joins an array of strings using hyphens as the
*
* delimiter and returns the resulting string.
*
* Any number of string arguments.
*
* @example
*
* joinHyphenCase("hello", "world"); // output: "hello-world"
* @endexample
*/
export function joinHyphenCase(string: string | string[]): string;
export function setListCount(countSelector: string, alias: string): void;
export function verifyListCount(countSelector: string, count: number): string;
// Utils: organization
export function createOrganization(props: {
appName: string;
businessName: string;
email: string;
firstName: string;
lastName: string;
subdomainName: string;
}): void;
// Utils: validation
export function verifyCrossSiteScript(inputSelector: string, submitSelector: string): void;
// exporting all utils
export const authUtils: {
verifySSOLoginPage: () => void;
logout: (homeUrl: string) => void;
};
/**
*
* Utils related to the date
*
* Import statement
*
* @example
*
* import { dateUtils } from "@bigbinary/neeto-commons-frontend/cypress-utils";
* @endexample
* Function to get the current date in YYYY-MM-DD format.
*
* @example
*
* dateUtils.currentDate();
* @endexample
* Function to return the date after n days from the current date.
*
* @example
*
* // Current date is 2023-02-07
* dateUtils.futureDate(2); // return 2023-02-09
* @endexample
* Function to return the date before n days from the current date.
*
* @example
*
* // Current date is 2023-02-07
* dateUtils.pastDate(2); // return 2023-02-05
* @endexample
* @example
*
* env.isDevelopment; // return true if the environment is development
* env.isReview; // return true if the environment is review
* env.isStaging; // return true if the environment is staging
* env.isProduction; // return true if the environment is production
* env.isNightly; // return true if it is a nightly run
* env.tld; // return the top level domain
* @endexample
*/
export const dateUtils: {
currentDate: () => string;
futureDate: (numberOfDays: number) => string;
pastDate: (numberOfDays: number) => string;
};
type AddMemberViaUIPropsType = {
email: string;
role: string;
appName: string;
};
type AddMemberViaRequestPropsType = {
email: string;
role: string;
requestCount: number;
appName: string;
};
type ActivateMembersPropsType = {
email: string;
name: string;
skipSearchRequest: boolean;
};
type UpdateMembersPropsType = {
email: string;
role: string;
skipSearchRequest: boolean;
};
type VerifyMembersPropsType = {
email: string;
role: string;
skipSearchRequest: boolean;
};
type DeactivateMembersPropsType = {
email: string;
name: string;
skipSearchRequest: boolean;
};
type EditMemberPropsType = {
email: string;
newRole: string;
firstName: string;
lastName: string;
skipSearchRequest: boolean;
updateCount: number;
};
type EditMemberViaRequestPropsType = {
email: string;
newRole: string;
firstName: string;
lastName: string;
requestCount: number;
};
type VerifyTabMenuPropsType = {
tabSelector: string;
toolTiptext: string;
alias: string;
requestCount: number;
};
type VerifyHelpDocumentationLinkPropsType = {
url: string;
articleTitle: string;
alias: string;
requestCount: number;
};
interface VerifyMyProfileTabPropTypes {
alias: string;
requestCount?: number;
}
type Environments = {
isDevelopment: boolean;
isReview: boolean;
isStaging: boolean;
isProduction: boolean;
isNightly: boolean;
tld: string;
};
type SendEmailPropsType = {
to: string;
subject: string;
body: string;
senderName: string;
};
export const memberUtils: {
addMemberViaRequest: (props: AddMemberViaRequestPropsType) => void;
addMemberViaUI: (props: AddMemberViaUIPropsType) => void;
activateMember: (props: ActivateMembersPropsType) => void;
editMemberViaUI: (props: EditMemberPropsType) => void;
editMemberViaRequest: (props: EditMemberViaRequestPropsType) => void;
deactivateMember: (props: DeactivateMembersPropsType) => void;
checkColumnAndVerifyTableHeader: (fieldSelector: string) => void;
deactivateMemberViaRequest: (email: string, requestCount: number) => void;
updateMemberRole: (props: UpdateMembersPropsType) => void;
interceptMemberApi: (alias: string, times: number) => void;
navigateToMembersPage: (waitForRequest: boolean) => void;
unCheckColumnAndVerifyTableHeader: (fieldSelector: string) => void;
verifyMemberDetails: (props: VerifyMembersPropsType) => void;
clickOnColumnIcon: (props: clickOnColumnIcon) => void;
};
export const navigationUtils: {
verifyTabMenu: (props: VerifyTabMenuPropsType) => void;
clickOnHelpSubTab: (tabSelector: string, tabText: string) => void;
verifyHelpDocumentationLink: (props: VerifyHelpDocumentationLinkPropsType) => void;
verifyKeyboardShortcutsPane: () => void;
verifyWhatsNewTab: (whatsNewHeading: string) => void;
verifyChatWithUsTab: () => void;
verifyMyProfileTab: (props: VerifyMyProfileTabPropTypes) => void;
verifyOrganizationTab: () => void;
openProfileOrHelpCenter: (props: OpenProfileOrHelpCenterPropTypes) => void;
openWhatsNewPane: (props: OpenWhatsNewPanePropTypes) => void;
};
export const emailUtils: {
sendEmail: (props: SendEmailPropsType) => void;
};
// exporting all selectors
export const commonSelectors: CommonSelectors;
export const memberSelectors: MemberSelectors;
export const loginSelectors: LoginSelectors;
export const profileSelectors: ProfileSelectors;
export const tableSelectors: TableSelectors;
export const signUpSelectors: SignUpSelectors;
export const memberFormSelectors: MemberFormSelectors;
export const helpIconSelectors: HelpIconSelectors;
export const chatWidgetSelectors: ChatWidgetSelectors;
export const mergeTagsSelectors: MergeTagsSelectors;
export const tagsSelectors: TagsSelectors;
export const rolesSelectors: RolesSelectors;
export const ipRestrictionSelectors: IpRestrictionSelectors;
export const neetoEditorSelectors: NeetoEditorSelectors;
export const neetoFiltersSelectors: NeetoFiltersSelectors;
// exporting all texts
export const commonTexts: CommonTexts;
export const memberTexts: MemberText;
export const memberTableTexts: MemberTableTexts;
export const memberFormErrorTexts: MemberFormErrorTexts;
export const signUpTexts: SignUpTexts;
export const environment: Environment;
export const isStagingEnv: boolean;
export const helpIconTexts: HelpIconTexts;
export const profileTexts: ProfileTexts;
export const rolesTexts: RolesTexts;
export const tagsTexts: TagsTexts;
export const env: Environments;
//exporting fixtures
export const fake: Fake;