Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cypress/e2e/models/migration/applicationinventory/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import {
clickWithin,
clickWithinByText,
doesExistSelector,
doesExistText,
inputText,
matchText,
next,
selectAnalysisMode,
selectCheckBox,
Expand All @@ -37,6 +37,7 @@ import {
AnalysisStatuses,
analyzeAppButton,
analyzeButton,
appInventoryKebab,
button,
clearAllFilters,
Languages,
Expand Down Expand Up @@ -495,13 +496,13 @@ export class Analysis extends Application {
.within(() => {
clickWithin(kebabTopMenuButton, button);
});
doesExistText("Import", rbacRules["Top action menu"]["Import"]);
doesExistText(
"Manage application imports",
matchText(appInventoryKebab.import, rbacRules["Top action menu"]["Import"]);
matchText(
appInventoryKebab.manageImports,
rbacRules["Top action menu"]["Manage application imports"]
);
doesExistText("Manage credentials", rbacRules["Top action menu"]["Manage credentials"]);
doesExistText("Delete", rbacRules["Top action menu"]["Delete"]);
matchText("Manage credentials", rbacRules["Top action menu"]["Manage credentials"]);
matchText("Delete", rbacRules["Top action menu"]["Delete"]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case I would like to see exact match, not something matching regular expression. Even a typo can be missed in case of using REGEXP.

}
}

Expand Down
5 changes: 5 additions & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,11 @@ export function doesExistButton(str: string, toBePresent: boolean): void {
cy.contains(button, str).should(toBePresent ? "exist" : "not.exist");
}

export function matchText(str: string, toBePresent: boolean): void {
const escapedStr = str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
cy.contains(new RegExp(`^${escapedStr}$`)).should(toBePresent ? "exist" : "not.exist");
}

export function enableSwitch(selector: string): void {
cy.get(selector)
.parent("label")
Expand Down