Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/ivyportal 17514 fix g UI tests le #988

Merged
merged 11 commits into from
Aug 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.openqa.selenium.support.ui.WebDriverWait;

import com.axonivy.ivy.webtest.engine.EngineUrl;
import com.axonivy.portal.selenium.page.NewDashboardPage;
import com.axonivy.portal.selenium.page.UserProfilePage;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.WebDriverRunner;

Expand Down Expand Up @@ -344,6 +346,13 @@ public void createJSonFile(String jsonFile, String key) {
}
redirectToRelativeLink(String.format(createJSonFileUrl, filepath, key));
}

public void resetFormattingLanguage() {
NewDashboardPage newDashboardPage = new NewDashboardPage();
UserProfilePage userProfilePage = newDashboardPage.openMyProfilePage();
userProfilePage.inputFormattingLanguage("English (United Kingdom)");
newDashboardPage = userProfilePage.save();
}

protected void showNewDashboard() {
redirectToRelativeLink(PORTAL_HOME_PAGE_URL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.axonivy.portal.selenium.test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -81,4 +83,9 @@ public void testDepulishNotification() {
announcementPage.dePublish();
assertTrue(newDashboardPage.isAnnouncementMessageNotDisplayed());
}

@AfterEach
public void resetDefaultFormattingLanguage() {
resetFormattingLanguage();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.axonivy.portal.selenium.test;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -45,7 +46,6 @@ public void testChangeLanguage() {
assertEquals("Prozesse", mainMenuPage.getProcessMenuItemText());
userProfilePage = newDashboardPage.openMyProfilePage();
userProfilePage.selectLanguage(1);
userProfilePage.inputFormattingLanguage("English");
userProfilePage.save();
mainMenuPage = userProfilePage.openMainMenu();
mainMenuPage.waitPageLoaded();
Expand All @@ -55,5 +55,9 @@ public void testChangeLanguage() {
private void createTestData() {
redirectToRelativeLink(createTestingTasksUrl);
}


@AfterEach
public void resetDefaultFormattingLanguage() {
resetFormattingLanguage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import java.time.LocalDateTime;

import java.time.format.DateTimeFormatter;
import java.util.Locale;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public void setup() {
grantAccessFullListPermissions();
newDashboardPage = new NewDashboardPage();
}


@Override
@AfterEach
public void tearDown() {
grantTaskActionsPermissions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,8 @@ public void testQuickSearchInProcessWidget() {
@Test
public void testSessionCacheInProcessWidget() {
login(TestAccount.ADMIN_USER);
ProcessWidgetNewDashBoardPage processWidget = newDashboardPage.selectProcessWidget("Your Processes");
assertTrue(processWidget.isQuickSearchInputShow());
ScreenshotUtils.maximizeBrowser();
ProcessWidgetNewDashBoardPage processWidget = newDashboardPage.selectProcessWidget("Your Processes");
processWidget.setQuickSearchKeyword("login");
var configurationPage = newDashboardPage.openDashboardConfigurationPage();
DashboardModificationPage modificationPage = configurationPage.openEditPublicDashboardsPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import com.axonivy.portal.selenium.page.TaskIFrameTemplatePage;
import com.axonivy.portal.selenium.page.TaskWidgetPage;

import ch.ivy.addon.portalkit.enums.PortalPermission;

@IvyWebTest
public class TaskActionTest extends BaseTest {

Expand Down Expand Up @@ -90,6 +92,7 @@ public void testVisibilityTaskActionForNormalUser() {
@Test
public void testVisibilityTaskActionForAdminUser() {
login(TestAccount.ADMIN_USER);
grantSpecificPortalPermission(PortalPermission.SYSTEM_TASK_READ_ALL);
redirectToRelativeLink(createTaskWithSystemState);
taskWidgetPage = NavigationHelper.navigateToTaskList();
// Ready for Join
Expand Down Expand Up @@ -134,6 +137,7 @@ public void testVisibilityTaskActionForAdminUser() {
@Test
public void testVisibleTaskActionsWhenTaskStatusIsDoneAndDestroyed() {
login(TestAccount.ADMIN_USER);
grantSpecificPortalPermission(PortalPermission.SYSTEM_TASK_READ_ALL);
redirectToRelativeLink(createTaskWithSystemState);
taskWidgetPage = NavigationHelper.navigateToTaskList();

Expand Down Expand Up @@ -162,6 +166,7 @@ public void testVisibleTaskActionsWhenTaskStatusIsDoneAndDestroyed() {
@Test
public void testVisibilityTaskActionForTechnicalStates() {
login(TestAccount.ADMIN_USER);
grantSpecificPortalPermission(PortalPermission.SYSTEM_TASK_READ_ALL);
redirectToRelativeLink(createTechnicalStateUrl);
taskWidgetPage = NavigationHelper.navigateToTaskList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void testShareTaskDetails() {
public void testShowTaskStatusBannerOnTaskDetails() {
redirectToRelativeLink(createTestingTasksUrl);
login(TestAccount.ADMIN_USER);
grantSpecificPortalPermission(PortalPermission.SYSTEM_TASK_READ_ALL);
redirectToNewDashBoard();
MainMenuPage mainMenuPage = new MainMenuPage();
mainMenuPage.openTaskList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;

import ch.ivy.addon.portalkit.enums.PortalPermission;

@IvyWebTest
public class TaskWidgetTest extends BaseTest {

Expand Down Expand Up @@ -113,6 +115,7 @@ public void testDisplayDelegateButton() {
@Test
public void testDestroyTask() {
login(TestAccount.ADMIN_USER);
grantSpecificPortalPermission(PortalPermission.SYSTEM_TASK_READ_ALL);
redirectToRelativeLink(GRANT_DESTROY_TASK_URL);

TaskWidgetPage taskWidgetPage = NavigationHelper.navigateToTaskList();
Expand Down
Loading