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

Conversation

btangmu
Copy link
Member

@btangmu btangmu commented May 23, 2025

-Add cldr-apps-webdriver as a module in tools/pom.xml, so it can be debugged in IntelliJ with right-click, Debug All Tests

-Fix comment for location of surveydriver.properties, now expected directly inside cldr-apps-webdriver directory

-Avoid some NullPointerExceptions in SurveyDriverCredentials.java if properties are not defined, by checking for null before calling toString

-Define PROPS_TIME_OUT_SECONDS_KEY consistently with other keys

-In pom.xml, change the name cldr-apps-webdriver to CLDR Apps Webdriver, for consistency with cldr-apps, cldr-code

-In pom.xml, add skipIfEmpty for maven-jar-plugin, maven-install-plugin, and maven-deploy-plugin

-In pom.xml, specify execution goal test-jar to prevent error: ... packaging for this project did not assign a file ...

CLDR-14409

  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

-Add cldr-apps-webdriver as a module in tools/pom.xml, so it can be debugged in IntelliJ with right-click, Debug All Tests

-Fix comment for location of surveydriver.properties, now expected directly inside cldr-apps-webdriver directory

-Avoid some NullPointerExceptions in SurveyDriverCredentials.java if properties are not defined, by checking for null before calling toString

-Define PROPS_TIME_OUT_SECONDS_KEY consistently with other keys
@btangmu btangmu self-assigned this May 23, 2025
-Change the name cldr-apps-webdriver to CLDR Apps Webdriver, for consistency with cldr-apps, cldr-code

-Add skipIfEmpty for maven-jar-plugin, maven-install-plugin, and maven-deploy-plugin

-Specify execution goal test-jar to prevent error: ... packaging for this project did not assign a file ...
@btangmu btangmu requested a review from srl295 May 23, 2025 21:03
srl295
srl295 previously approved these changes May 25, 2025
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

Looks great!

@btangmu
Copy link
Member Author

btangmu commented May 26, 2025

@srl295 Before merging this, I'm looking at the failures. "cldr-mvn / build (pull_request)Failing after 22m" links to a log including:

[INFO] Running org.unicode.cldr.surveydriver.AppTest
While reading surveydriver.properties java.io.FileNotFoundException: surveydriver.properties (No such file or directory)
java.io.FileNotFoundException: surveydriver.properties (No such file or directory)

Then, "cldr-mvn / Docker test cldr-apps ... Failing after 3m" links to a log including:

SurveyDriverDashboard.test i = 0
...
org.openqa.selenium.StaleElementReferenceException: 
stale element reference: stale element not found in the current frame

Looking at other PRs, there are different failures, so seemingly surveydriver.properties is found sometimes but not always. The inconsistencies are puzzling. For PR 4718, there is:

❌ Test failed, maybe timed out, waiting for id DashboardScroller to exist for http://cldr-apps:9080/cldr-apps/v#/cs//

-Added surveydriver.properties is identical to surveydriver-docker.properties
@btangmu
Copy link
Member Author

btangmu commented May 26, 2025

Actually the FileNotFoundException for surveydriver.properties was blocking this PR. That failure was in the required cldr-mvn / build, not in the currently optional cldr-mvn / Docker test.

The 3rd commit adds surveydriver.properties. It's not clear though whether that should be necessary. Dockerfile has:

COPY surveydriver-docker.properties /workarea/surveydriver.properties

Does SurveyDriverCredentials.java look for it in /workarea/?

InputStream stream = new FileInputStream(PROPS_FILENAME)

Testing without Docker that means it's looked for at tools/cldr-apps-webdriver/surveydriver.properties...

@btangmu
Copy link
Member Author

btangmu commented May 26, 2025

After the 3rd commit, the good news is we don't get "FileNotFoundException: surveydriver.properties"; the bad news is:

 org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'pkrvmf6wy0o8zjz', ip: '10.1.1.31'
Build info: version: '4.32.0', revision: 'd17c8aa950'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.11.0-1014-azure', java.version: '11.0.27'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, goog:loggingPrefs: org.openqa.selenium.logging...}]}]
Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, goog:loggingPrefs: org.openqa.selenium.logging...}
	at org.unicode.cldr.surveydriver.AppTest.shouldDrive(AppTest.java:8)
Caused by: java.io.UncheckedIOException: java.net.ConnectException
Caused by: java.net.ConnectException
Caused by: java.net.ConnectException
Caused by: java.nio.channels.UnresolvedAddressException
[INFO] 
[INFO] Results:
[INFO] 
Error:  Errors: 
Error:    AppTest.shouldDrive:8 » SessionNotCreated Could not start a new session. Possi...

@btangmu
Copy link
Member Author

btangmu commented May 27, 2025

I suspect that the webdriver test should be inhibited during the required cldr-mvn / build (pull_request) and only enabled in cldr-mvn / Docker test cldr-apps (pull_request); the latter is currently not required to pass.

Maybe making cldr-apps-webdriver a project module accounts for its test becoming part of cldr-mvn / build (pull_request)...

@srl295
Copy link
Member

srl295 commented May 27, 2025 via email

Copy link
Member

Choose a reason for hiding this comment

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

oh! I don't think we actually want this file. WE don't WANT the webdriver to run during mvn test - I would move this back to gitignore.

Copy link
Member

Choose a reason for hiding this comment

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

these values are inappropriate outside of the docker build.

@@ -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.

Comment on lines +18 to +19
* A file should exist: cldr-apps-webdriver/surveydriver.properties -- not in version control;
* contains WEBDRIVER_PASSWORD=..., etc.
Copy link
Member

Choose a reason for hiding this comment

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

i'd revert this

@srl295
Copy link
Member

srl295 commented May 27, 2025

public class AppTest {
    @Test
    public void shouldDrive() {
        SurveyDriver.runTests();
    }
}

it looks like AppTest.java has the only test hookage.

If we delete AppTest.java and change SurveyDriver to be a main() application then it could be build as a project module and just explicitly called ( move it out of src/test/java into src/main/java )

@srl295
Copy link
Member

srl295 commented May 28, 2025

Actually the FileNotFoundException for surveydriver.properties was blocking this PR. That failure was in the required cldr-mvn / build, not in the currently optional cldr-mvn / Docker test.

but we do not want to run the test in this situation.

The 3rd commit adds surveydriver.properties. It's not clear though whether that should be necessary. Dockerfile has:

COPY surveydriver-docker.properties /workarea/surveydriver.properties

Does SurveyDriverCredentials.java look for it in /workarea/?

looks for it in the current working directory

InputStream stream = new FileInputStream(PROPS_FILENAME)

Testing without Docker that means it's looked for at tools/cldr-apps-webdriver/surveydriver.properties...

right, the working diretory.

Another option is that we could throw an AssumptionViolatedException if the .properties file is missing - then the webdriver test will just get skipped. However, then the test will 'silently fail' in cases where we want to assert that the test passes.

but i think it might be best to make the webdriver not be a unit test and make it an explicitly run executable- what do you think? that will reach the goal of including it in the project hierarchy - which makes sense as a goal.

@srl295
Copy link
Member

srl295 commented May 29, 2025

@btangmu ok if i make changes to this PR as mentioned? maybe i can make a sub PR , i'll do that

@btangmu
Copy link
Member Author

btangmu commented May 29, 2025

ok if i make changes to this PR as mentioned? maybe i can make a sub PR , i'll do that

Yes, anything you'd like. I'm mostly out of office today. I agree webdriver probably doesn't need to be a "test"

@srl295
Copy link
Member

srl295 commented May 29, 2025

btangmu#179 work in progrss but welcome to merge. i'm not able to push for some reason

@btangmu
Copy link
Member Author

btangmu commented Jun 10, 2025

@srl295 I merged your sub-PR. That resulted in a "Commit message for 18c1d60 fails validation" which I guess could be fixed by squashing; I don't know if there's another way to fix it. Also there's a merge conflict on SurveyDriverDashboard.java which I'll look at now...

@srl295
Copy link
Member

srl295 commented Jun 10, 2025

@srl295 I merged your sub-PR. That resulted in a "Commit message for 18c1d60 fails validation" which I guess could be fixed by squashing; I don't know if there's another way to fix it. Also there's a merge conflict on SurveyDriverDashboard.java which I'll look at now...

It needed to be a rebase merge - you could check it out locally and run "git commit --amend" and then fix it and then force push.

@btangmu
Copy link
Member Author

btangmu commented Jun 10, 2025

See #4800

@btangmu btangmu closed this Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants