Skip to content

CLDR-14409 Make cldr-apps-webdriver a project module; minor fixes #4736

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/cldr-apps-webdriver/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.DS_Store
/target
surveydriver.properties
scripts/selenium-server.jar
2 changes: 1 addition & 1 deletion tools/cldr-apps-webdriver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM maven:3-eclipse-temurin-17-alpine
WORKDIR /workarea
COPY . /workarea
COPY surveydriver-docker.properties /workarea/surveydriver.properties
CMD ["mvn", "-B", "test"]
CMD ["mvn", "compile", "exec:java", "-Dexec.mainClass=org.unicode.cldr.surveydriver.SurveyDriver"]
5 changes: 5 additions & 0 deletions tools/cldr-apps-webdriver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

https://www.w3.org/TR/webdriver/ “WebDriver is a remote control interface that enables introspection and control of user agents”

to run the webdriver, execute:

mvn --file=tools/pom.xml -pl cldr-apps-webdriver exec:java -Dexec.mainClass=org.unicode.cldr.surveydriver.SurveyDriver


### Copyright & Licenses

Copyright © 2018-2024 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries.
Expand Down
44 changes: 37 additions & 7 deletions tools/cldr-apps-webdriver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.unicode.cldr.surveydriver</groupId>
<artifactId>cldr-apps-webdriver</artifactId>
<version>1.0-SNAPSHOT</version>
<name>cldr-apps-webdriver</name>
<name>CLDR Apps Webdriver</name>
<licenses>
<license>
<name>Unicode-3.0</name>
Expand All @@ -16,14 +16,9 @@
<maven.compiler.target>11</maven.compiler.target>
<spotless.version>2.35.0</spotless.version>
<google-java-style.version>1.15.0</google-java-style.version>
<mainClass>org.unicode.cldr.surveydriver.SurveyDriver</mainClass>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
Expand Down Expand Up @@ -91,14 +86,32 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- <plugin>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.1</version>
</plugin> -->
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
Expand All @@ -111,5 +124,22 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!--
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${mainClass}</mainClass>
</configuration>
</plugin>
-->
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.unicode.cldr.surveydriver;

import static org.junit.Assert.assertTrue;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
Expand Down Expand Up @@ -56,6 +54,9 @@
*/
public class SurveyDriver {

static void assertTrue(boolean b) {
if (!b) throw new RuntimeException("Expected true but got " + b);
}
/*
* Enable/disable specific tests using these booleans
*/
Expand Down Expand Up @@ -126,6 +127,10 @@ public static void runTests() {
}
}

public static void main(String args[]) {
runTests();
}

/** Set up the driver and its "wait" object. */
private void setUp() {
LoggingPreferences logPrefs = new LoggingPreferences();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public class SurveyDriverCredentials {
private static final String EMAIL_PREFIX = "driver-";

/**
* cldr-apps-webdriver/src/test/resources/org/unicode/cldr/surveydriver/surveydriver.properties
* -- not in version control; contains a line WEBDRIVER_PASSWORD=...
* A file should exist: cldr-apps-webdriver/surveydriver.properties -- not in version control;
* contains WEBDRIVER_PASSWORD=..., etc.
*/
private static final String PROPS_FILENAME = "surveydriver.properties";

private static final String PROPS_PASSWORD_KEY = "WEBDRIVER_PASSWORD";
private static final String PROPS_URL_KEY = "SURVEYTOOL_URL";

private static final Object PROPS_WEBDRIVER_KEY = "WEBDRIVER_URL";
private static final String PROPS_WEBDRIVER_KEY = "WEBDRIVER_URL";
private static final String PROPS_TIME_OUT_SECONDS_KEY = "TIME_OUT_SECONDS";
private static String webdriverPassword = null;

private final String email;
Expand Down Expand Up @@ -98,7 +98,8 @@ public String getPassword() {
}

public static String getUrl() {
String host = getProperties().get(PROPS_URL_KEY).toString();
Object prop = getProperties().get(PROPS_URL_KEY);
String host = prop == null ? null : prop.toString();
if (host == null || host.isEmpty()) {
host = "http://localhost:9080";
}
Expand All @@ -107,7 +108,8 @@ public static String getUrl() {
}

public static String getWebdriverUrl() {
String host = getProperties().get(PROPS_WEBDRIVER_KEY).toString();
Object prop = getProperties().get(PROPS_WEBDRIVER_KEY);
String host = prop == null ? null : prop.toString();
if (host == null || host.isEmpty()) {
host = "http://localhost:4444";
}
Expand All @@ -116,11 +118,12 @@ public static String getWebdriverUrl() {
}

public static int getTimeOut() {
String s = getProperties().get("TIME_OUT_SECONDS").toString();
Object prop = getProperties().get(PROPS_TIME_OUT_SECONDS_KEY);
String s = prop == null ? null : prop.toString();
if (s == null || s.isEmpty()) {
s = "60";
}
System.out.println("TIME_OUT_SECONDS=" + s);
System.out.println(PROPS_TIME_OUT_SECONDS_KEY + "=" + s);
return Integer.parseInt(s);
}
}

This file was deleted.

4 changes: 4 additions & 0 deletions tools/cldr-apps-webdriver/surveydriver.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WEBDRIVER_PASSWORD=pw-for-docker-webdriver
SURVEYTOOL_URL=http://cldr-apps:9080
WEBDRIVER_URL=http://selenium:4444
TIME_OUT_SECONDS=60
1 change: 1 addition & 0 deletions tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<modules>
<module>cldr-code</module>
<module>cldr-apps</module>
<module>cldr-apps-webdriver</module>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<module>cldr-apps-webdriver</module>
<!-- <module>cldr-apps-webdriver</module> -->

Maybe it's better to leave it detached for now.

<module>cldr-rdf</module>
<module>../docs/charts/keyboards</module>
</modules>
Expand Down