diff --git a/src/main/java/io/meeds/qa/ui/pages/HomePage.java b/src/main/java/io/meeds/qa/ui/pages/HomePage.java index f5f53304..8bcc7d65 100644 --- a/src/main/java/io/meeds/qa/ui/pages/HomePage.java +++ b/src/main/java/io/meeds/qa/ui/pages/HomePage.java @@ -254,7 +254,7 @@ public void goToAddUser() { } public void goToMainSettings() { - goToAdministrationPage("General/Main Customization", true); + goToAdministrationPage("General/Appearance", true); } public void goToNotificationAdminPage() { diff --git a/src/main/java/io/meeds/qa/ui/pages/UserProfilePage.java b/src/main/java/io/meeds/qa/ui/pages/UserProfilePage.java index 14281b19..7927d913 100644 --- a/src/main/java/io/meeds/qa/ui/pages/UserProfilePage.java +++ b/src/main/java/io/meeds/qa/ui/pages/UserProfilePage.java @@ -130,11 +130,13 @@ public void checkWorkExperiencesSection(String jobTitle, String organization, St } public void clickOnSendKudosBtn() { - ElementFacade uiIconKudosElement = uiIconKudosElement(); - uiIconKudosElement.assertVisible(); - uiIconKudosElement.click(); - waitForDrawerToOpen(); - waitCKEditorLoading(); + retryOnCondition(() -> { + ElementFacade uiIconKudosElement = uiIconKudosElement(); + uiIconKudosElement.checkVisible(); + uiIconKudosElement.click(); + waitForDrawerToOpen(true); + waitCKEditorLoading(); + }); } public int getMyWeeklyPoint() { diff --git a/src/test/java/io/meeds/qa/ui/hook/TestInitHook.java b/src/test/java/io/meeds/qa/ui/hook/TestInitHook.java index dc2418a2..6bcbb7af 100644 --- a/src/test/java/io/meeds/qa/ui/hook/TestInitHook.java +++ b/src/test/java/io/meeds/qa/ui/hook/TestInitHook.java @@ -206,6 +206,7 @@ private void loginAsAdmin() { if (!loginSteps.authenticate(ADMIN_USERNAME, ADMIN_PASSWORD, false)) { throw new IllegalStateException("Couldn't login with admin"); } + genericSteps.disableTermsAndConditions(); } private void loginAsRandomAdmin() { diff --git a/src/test/java/io/meeds/qa/ui/steps/GenericSteps.java b/src/test/java/io/meeds/qa/ui/steps/GenericSteps.java index ce517fda..45b9f9fb 100644 --- a/src/test/java/io/meeds/qa/ui/steps/GenericSteps.java +++ b/src/test/java/io/meeds/qa/ui/steps/GenericSteps.java @@ -30,7 +30,7 @@ import net.serenitybdd.core.Serenity; public class GenericSteps { - private static final String DISABLE_PWA_SCRIPT = + private static final String DISABLE_PWA_SCRIPT = """ const callback = arguments[arguments.length - 1]; fetch("/pwa/rest/manifest", { @@ -43,13 +43,32 @@ public class GenericSteps { }) .then(resp => { if (!resp || !resp.ok) { - throw new Error("Error changing space creation permissions"); + throw new Error("Error when switching Off PWA"); } }) .then(() => callback(true)) .catch(() => callback(false)); """; + private static final String DISABLE_TERMS_SCRIPT = + """ + const callback = arguments[arguments.length - 1]; + fetch("/notes/rest/terms/settings?published=false&lang=en", { + "headers": { + "content-type": "application/json", + }, + "method": "PUT", + "credentials": "include" + }) + .then(resp => { + if (!resp || !resp.ok) { + throw new Error("Error when switching Off Terms and Conditions"); + } + }) + .then(() => callback(true)) + .catch(() => callback(false)); + """; + private GenericPage genericPage; public void checkConfirmMessageIsDisplayed(String message) { @@ -245,6 +264,15 @@ public void disablePwa() { .equals("true")); } + public void disableTermsAndConditions() { + WebDriverWait wait = new WebDriverWait(Serenity.getDriver(), + Duration.ofSeconds(10), + Duration.ofMillis(SHORT_WAIT_DURATION_MILLIS)); + wait.until(driver -> ((JavascriptExecutor) driver).executeAsyncScript(DISABLE_TERMS_SCRIPT) + .toString() + .equals("true")); + } + public void goToPage(String link) { genericPage.goToPage(link); }