-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Java] Add Locale.ROOT to avoid port formatting issues for all drivers #15121
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
Changes from 2 commits
fe86936
b7b05d2
6685d7b
7169a27
eef4b73
6072c95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,22 +147,14 @@ void testPersistentHoverCanBeTurnedOff() throws Exception { | |
|
|
||
| @Test | ||
| @NoDriverBeforeTest | ||
| void shouldThrowNumberFormatException() { | ||
| void shouldLaunchSuccessfullyWithArabicDate() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I this this test is not needed at all.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As disccussed earlier this test is using arabic as a unit test for port formatting logic
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MustafaAgamy This test only checks that Actually, we need to check that the whole Selenium Webdriver works with Arabic locale. For example, in Selenide we run all tests with Turkish locale for the same reason: tasks.withType(Test).configureEach {
useJUnitPlatform()
systemProperties['user.country'] = 'TR'
systemProperties['user.language'] = 'tr'
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what's the suggestion here? You see, the thing is you don't actually need to run all tests against arabic. You just need to test if the builder will be able to build the driver instance successfully while the System language is arabic, that's pretty much it (That's the AOI - Area of Impact - for this unit test)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't even need any environment variables. We can just add these parameters to Bazel script to always run tests with Arabic locale. (There is a more complex option - run tests with multiple "special" locales: Arabic, Turkish etc. But it's probably overkill.) P.S. Yes, I see this is AOI of this test. And this is the wrong AOI. |
||
| Locale arabicLocale = new Locale("ar", "EG"); | ||
| Locale.setDefault(arabicLocale); | ||
|
|
||
| int port = PortProber.findFreePort(); | ||
| InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); | ||
| builder.usingPort(port); | ||
|
|
||
| assertThatExceptionOfType(NumberFormatException.class) | ||
| .isThrownBy(builder::build) | ||
| .withMessage( | ||
| "Couldn't format the port numbers because the System Language is arabic: \"" | ||
| + String.format("--port=%d", port) | ||
| + "\", please make sure to add the required arguments \"-Duser.language=en" | ||
| + " -Duser.region=US\" to your JVM, for more info please visit :\n" | ||
| + " https://www.selenium.dev/documentation/webdriver/browsers/"); | ||
| builder.build(); | ||
|
|
||
| Locale.setDefault(Locale.US); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.