Skip to content

Commit 4ef6972

Browse files
committed
Add a new fn to match strings
Signed-off-by: Nandini Chandra <[email protected]>
1 parent be88656 commit 4ef6972

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cypress/e2e/models/migration/applicationinventory/analysis.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import {
2323
clickWithin,
2424
clickWithinByText,
2525
doesExistSelector,
26-
doesExistText,
2726
inputText,
27+
matchText,
2828
next,
2929
selectAnalysisMode,
3030
selectCheckBox,
@@ -37,6 +37,7 @@ import {
3737
AnalysisStatuses,
3838
analyzeAppButton,
3939
analyzeButton,
40+
appInventoryKebab,
4041
button,
4142
clearAllFilters,
4243
Languages,
@@ -495,13 +496,13 @@ export class Analysis extends Application {
495496
.within(() => {
496497
clickWithin(kebabTopMenuButton, button);
497498
});
498-
doesExistText("Import", rbacRules["Top action menu"]["Import"]);
499-
doesExistText(
500-
"Manage application imports",
499+
matchText(appInventoryKebab.import, rbacRules["Top action menu"]["Import"]);
500+
matchText(
501+
appInventoryKebab.manageImports,
501502
rbacRules["Top action menu"]["Manage application imports"]
502503
);
503-
doesExistText("Manage credentials", rbacRules["Top action menu"]["Manage credentials"]);
504-
doesExistText("Delete", rbacRules["Top action menu"]["Delete"]);
504+
matchText("Manage credentials", rbacRules["Top action menu"]["Manage credentials"]);
505+
matchText("Delete", rbacRules["Top action menu"]["Delete"]);
505506
}
506507
}
507508

cypress/utils/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,10 @@ export function doesExistButton(str: string, toBePresent: boolean): void {
15991599
cy.contains(button, str).should(toBePresent ? "exist" : "not.exist");
16001600
}
16011601

1602+
export function matchText(str: string, toBePresent: boolean): void {
1603+
cy.contains(new RegExp(`^${str}$`)).should("exist");
1604+
}
1605+
16021606
export function enableSwitch(selector: string): void {
16031607
cy.get(selector)
16041608
.parent("label")

0 commit comments

Comments
 (0)