From fbc81395d1baadb75854e96652614496ce0dd4b8 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 2 Mar 2021 10:12:40 +0100 Subject: [PATCH] added wait for backend request --- cypress/integration/group_test.spec.ts | 2 +- cypress/support/pages/admin_console/ListingPage.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cypress/integration/group_test.spec.ts b/cypress/integration/group_test.spec.ts index 6a62c90651..05015eae1b 100644 --- a/cypress/integration/group_test.spec.ts +++ b/cypress/integration/group_test.spec.ts @@ -34,7 +34,7 @@ describe("Group test", () => { masthead.checkNotificationMessage("Group created"); sidebarPage.goToGroups(); - listingPage.searchItem(groupName).itemExist(groupName); + listingPage.searchItem(groupName, false).itemExist(groupName); // Delete listingPage.deleteItem(groupName); diff --git a/cypress/support/pages/admin_console/ListingPage.ts b/cypress/support/pages/admin_console/ListingPage.ts index 61b1291466..6c9cb580e5 100644 --- a/cypress/support/pages/admin_console/ListingPage.ts +++ b/cypress/support/pages/admin_console/ListingPage.ts @@ -34,10 +34,16 @@ export default class ListingPage { return this; } - searchItem(searchValue: string) { + searchItem(searchValue: string, wait = true) { + if (wait) { + const searchUrl = `/admin/realms/master/*${searchValue}*`; + cy.intercept(searchUrl).as("searchClients"); + } cy.get(this.searchInput).type(searchValue); cy.get(this.searchBtn).click(); - + if (wait) { + cy.wait(["@searchClients"]); + } return this; }