Skip to content

Commit

Permalink
Merge pull request #198 from SCADA-LTS/develop
Browse files Browse the repository at this point in the history
- added WebsiteTest.groovy;
  • Loading branch information
Limraj authored Jan 10, 2024
2 parents 5262fb7 + 15dc606 commit 67545eb
Show file tree
Hide file tree
Showing 47 changed files with 201 additions and 52 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.scadalts</groupId>
<artifactId>scada-lts-e2e</artifactId>
<name>Scada-LTS-E2E</name>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down Expand Up @@ -813,6 +813,7 @@
<test.e2e.run-app.unblock-send-fail-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-fail-email-cron>
<test.e2e.run-app.unblock-send-success-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-success-email-cron>
<test.e2e.run-app.unblock-send-email-by-cron>false</test.e2e.run-app.unblock-send-email-by-cron>
<test.e2e.login-disabled>false</test.e2e.login-disabled>
</properties>
</profile>
<profile>
Expand Down Expand Up @@ -876,6 +877,7 @@
<test.e2e.run-app.unblock-send-fail-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-fail-email-cron>
<test.e2e.run-app.unblock-send-success-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-success-email-cron>
<test.e2e.run-app.unblock-send-email-by-cron>false</test.e2e.run-app.unblock-send-email-by-cron>
<test.e2e.login-disabled>false</test.e2e.login-disabled>
</properties>
</profile>
<profile>
Expand Down Expand Up @@ -939,6 +941,7 @@
<test.e2e.run-app.unblock-send-fail-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-fail-email-cron>
<test.e2e.run-app.unblock-send-success-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-success-email-cron>
<test.e2e.run-app.unblock-send-email-by-cron>false</test.e2e.run-app.unblock-send-email-by-cron>
<test.e2e.login-disabled>false</test.e2e.login-disabled>
</properties>
</profile>
<profile>
Expand Down Expand Up @@ -1005,6 +1008,7 @@
<test.e2e.run-app.unblock-send-fail-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-fail-email-cron>
<test.e2e.run-app.unblock-send-success-email-cron>0 5 4 * * ?</test.e2e.run-app.unblock-send-success-email-cron>
<test.e2e.run-app.unblock-send-email-by-cron>false</test.e2e.run-app.unblock-send-email-by-cron>
<test.e2e.login-disabled>false</test.e2e.login-disabled>
</properties>
</profile>
</profiles>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scadalts</groupId>
<artifactId>scada-lts-e2e</artifactId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scadalts</groupId>
<artifactId>scada-lts-e2e</artifactId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.logging.log4j.Level;
import org.scadalts.e2e.cli.commands.E2eCommand;
import org.scadalts.e2e.cli.commands.RunAppCommand;
Expand Down Expand Up @@ -280,6 +279,11 @@ public String getUnblockSendFailEmailCron() {
return fromRunApp.getUnblockSendFailEmailCron();
}

@Override
public boolean isLoginDisabled() {
return fromE2e.isLoginDisabled();
}

@Override
public String toString() {
return "\nportApp=" + getPortApp() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class DefaultOptions {
@Option(names = {"-v", "--version"}, versionHelp = true)
private boolean version;

@Option(names = {"-h", "--help"}, usageHelp = true)
@Option(names = {"-h", "--help", "-?", "-help"}, usageHelp = true)
private boolean help;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ public class ScadaOptions extends TestOptions {
@CommandLine.Option(names = {"-J", "--data-point-source-xid"})
private String dataPointSourceXid;

@CommandLine.Option(names = {"-ld", "--login-disabled-"}, negatable = true)
private boolean loginDisabled;

}
2 changes: 1 addition & 1 deletion scada-lts-e2e-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>scada-lts-e2e</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>scada-lts-e2e-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-common/scada-lts-e2e-common-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-common</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-common/scada-lts-e2e-common-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-common</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public interface E2eConfig {
boolean isUnblockSendEmailByCron();
String getUnblockSendSuccessEmailCron();
String getUnblockSendFailEmailCron();
boolean isLoginDisabled();

static E2eConfig defaultConfig() {
return new E2eConfigDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.logging.log4j.Level;
import org.scadalts.e2e.common.core.types.AuthType;
import org.scadalts.e2e.common.core.types.BrowserRef;
Expand Down Expand Up @@ -84,6 +83,7 @@ class E2eConfigDefault implements E2eConfig {
private boolean unblockSendEmailByCron;
private String unblockSendSuccessEmailCron;
private String unblockSendFailEmailCron;
private boolean loginDisabled;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class E2eConfiguration {
public static URL baseUrl;
public static String sessionId;
public static boolean checkAuthentication = false;
public static boolean loginDisabled = true;

static {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void init(E2eConfig config) {
E2eConfiguration.username = config.getUserName();
E2eConfiguration.logLevel = config.getLogLevel();
E2eConfiguration.checkAuthentication = config.isCheckAuthentication();
E2eConfiguration.loginDisabled = config.isLoginDisabled();
org.apache.logging.log4j.core.config.Configurator.setRootLevel(config.getLogLevel());
org.apache.logging.log4j.core.config.Configurator.setAllLevels("org.apache.logging.log4j", config.getLogLevel());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public enum TestPlan {
SERVICE, PAGE, CHECK, PAGE_SERVICE, SERVICE_PAGE, ALL, ANY, LOGIN, LOGOUT,
AUTO_CONFIG, CONFIG_AUTO, EXPORT, IMPORT, CLEAN, PERFORMANCE, PERF,
ALARM_NOTIFICATION_AUTO_CONFIG, PROD, FROM_GROOVY_SCRIPT, ALARM_STORUNG,
GEN_BACKSTOP_CONFIG, EVENT_HANDLER_SERVICE, EVENT_DETECTOR_SERVICE, CONFIG_PROD_CHECKER
GEN_BACKSTOP_CONFIG, EVENT_HANDLER_SERVICE, EVENT_DETECTOR_SERVICE, CONFIG_PROD_CHECKER,
GROOVY_SCRIPT
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ test.e2e.data-point-name=${test.e2e.data-point-name}
test.e2e.data-point-source-xid=${test.e2e.data-point-source-xid}
test.e2e.data-point-target-xid=${test.e2e.data-point-target-xid}

test.e2e.login-disabled=${test.e2e.login-disabled}

2 changes: 1 addition & 1 deletion scada-lts-e2e-common/scada-lts-e2e-common-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-common</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-page/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>scada-lts-e2e</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-page/scada-lts-e2e-page-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-page</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>scada-lts-e2e-page-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-page/scada-lts-e2e-page-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-page</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.scadalts.e2e.page.core.config;

import org.openqa.selenium.Keys;
import org.scadalts.e2e.page.core.config.webdriver.GetConfigForSystem;
import org.scadalts.e2e.page.core.config.webdriver.SystemConfig;

import java.io.File;
Expand All @@ -14,5 +13,6 @@ public class PageConfiguration {
public static long timeout = 6001;
public static boolean headless = true;
public static String reportsUrl = "";
public static String baseUrl = "http://localhost:8080/";

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static void init(E2eConfig config) {
Configuration.proxyPort = config.getPortProxy();
PageConfiguration.timeout = config.getTimeoutMs();
PageConfiguration.headless = config.isHeadlessMode();
PageConfiguration.baseUrl = config.getUrlAppBeingTested().toString();
Configuration.pageLoadTimeout = PageConfiguration.timeout;

Configurator.setRootLevel(config.getLogLevel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default boolean containsText(String text) {

default T acceptAlertOnPageSlow() {
try {
switchTo().alert().accept();
AlertUtil.acceptAlertSlow();
} catch (Throwable ex) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public static void acceptAlert() {
executeJavaScript(JavascriptWindow.ACCEPT_ALERT.getScriptToExecute());
}

public static void acceptAlertSlow() {
try {
Selenide.switchTo().alert().accept();
} catch (Throwable th) {

}
}

public static void dismissAlert() {
executeJavaScript(JavascriptWindow.DISMISS_ALERT.getScriptToExecute());
}
Expand All @@ -26,11 +34,23 @@ public static void acceptAfterClick(SelenideElement selenideElement) {
selenideElement.click();
}

public static void acceptAfterClickSlow(SelenideElement selenideElement) {
//executeJavaScript(JavascriptWindow.ACCEPT_ALERT.getScriptToExecute());
selenideElement.click();
acceptAlertSlow();
}

public static void acceptAfterClick(E2eWebElement selenideElement) {
executeJavaScript(JavascriptWindow.ACCEPT_ALERT.getScriptToExecute());
selenideElement.click();
}

public static void acceptAfterClickSlow(E2eWebElement selenideElement) {
//executeJavaScript(JavascriptWindow.ACCEPT_ALERT.getScriptToExecute());
selenideElement.click();
acceptAlertSlow();
}

public static void acceptAlert(Procedure procedure) {
executeJavaScript(JavascriptWindow.ACCEPT_ALERT.getScriptToExecute());
procedure.invoke();
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-page/scada-lts-e2e-page-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-page</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>scada-lts-e2e-page-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package org.scadalts.e2e.page.impl.groovy;

import com.codeborne.selenide.Configuration;
import org.scadalts.e2e.common.core.config.E2eConfiguration;

import java.net.MalformedURLException;
import java.net.URL;

public final class ConfigurationUtil {

private static boolean PAGE_MODE = true;
Expand All @@ -23,4 +29,17 @@ public static void pageMode(boolean pageMode) {
public static boolean isPageMode() {
return PAGE_MODE;
}

public static void baseUrl(String baseUrl) {
Configuration.baseUrl = baseUrl;
try {
E2eConfiguration.baseUrl = new URL(baseUrl);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}

public static void loginDisabled(boolean disabledLogin) {
E2eConfiguration.loginDisabled = disabledLogin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import org.scadalts.e2e.page.impl.criterias.EventDetectorCriteria;
import org.scadalts.e2e.page.impl.criterias.EventHandlerCriteria;

import java.util.function.Predicate;

import static com.codeborne.selenide.Condition.not;
import static com.codeborne.selenide.Selenide.page;
import static org.scadalts.e2e.page.core.utils.AlertUtil.acceptAfterClick;
import static org.scadalts.e2e.page.core.utils.AlertUtil.acceptAfterClickSlow;
import static org.scadalts.e2e.page.core.utils.DynamicElementUtil.*;
import static org.scadalts.e2e.page.core.utils.PageStabilityUtil.reopenWhile;
import static org.scadalts.e2e.page.core.utils.PageStabilityUtil.waitWhile;
Expand All @@ -40,7 +40,7 @@ public EventHandlersPage() {
public EditEventHandlersPage openEventHandlerCreator(EventDetectorCriteria criteria) {
delay();
SelenideElement selenideElement = _findActionInTree(criteria);
acceptAfterClick(selenideElement);
acceptAfterClickSlow(selenideElement);
printCurrentUrl();
return page(new EditEventHandlersPage(this));
}
Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-service/scada-lts-e2e-service-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-service</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion scada-lts-e2e-service/scada-lts-e2e-service-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>scada-lts-e2e-service</artifactId>
<groupId>org.scadalts</groupId>
<version>23.0.9-SNAPSHOT</version>
<version>23.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit 67545eb

Please sign in to comment.