Relax checking of messages

Related to: #28873
Fixes: #28911

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
This commit is contained in:
Hynek Mlnarik 2024-04-19 11:08:04 +02:00 committed by Hynek Mlnařík
parent 2b8c895f71
commit 4f30400e07
2 changed files with 21 additions and 10 deletions

View file

@ -94,16 +94,27 @@ export default class Masthead extends CommonElements {
cy.get("#manage-account").click();
}
checkNotificationMessage(message: string, closeNotification = true) {
this.#getAlertsContainer()
.find(this.#alertMessage)
.should("contain.text", message);
if (closeNotification) {
checkNotificationMessage(message: string | RegExp, closeNotification = true) {
if (typeof message === "string") {
this.#getAlertsContainer()
.find(`button[title="` + message.replaceAll('"', '\\"') + `"]`)
.last()
.click({ force: true });
.find(this.#alertMessage)
.should("contain.text", message);
if (closeNotification) {
this.#getAlertsContainer()
.find(`button[title="` + message.replaceAll('"', '\\"') + `"]`)
.last()
.click({ force: true });
}
} else {
this.#getAlertsContainer()
.find(this.#alertMessage)
.invoke("text")
.should("match", message);
if (closeNotification) {
this.#getAlertsContainer().find("button").last().click({ force: true });
}
}
return this;
}

View file

@ -223,7 +223,7 @@ export default class SettingsTab extends PageObject {
public assertAccessSettings() {
const redirectUriError =
"Client could not be updated: A redirect URI is not a valid URI";
/Client could not be updated:.*(Master SAML Processing URL is not a valid URL|A redirect URI is not a valid URI).*/i;
cy.findByTestId(this.#idpInitiatedSsoUrlName).click().type("a");
cy.findByTestId(this.#idpInitiatedSsoRelayState).click().type("b");