Skip to content

Commit 86e86a8

Browse files
VietND96sandeepsuryaprasad
authored andcommitted
[grid]: platformName is empty should be considered as enum ANY instead of WINDOWS (SeleniumHQ#15036)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 682d49b commit 86e86a8

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

java/src/org/openqa/selenium/Platform.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public enum Platform {
3333

3434
/** Never returned, but can be used to request a browser running on any version of Windows. */
35-
WINDOWS("") {
35+
WINDOWS("windows") {
3636
@Override
3737
public Platform family() {
3838
return null;
@@ -302,6 +302,18 @@ public String toString() {
302302
}
303303
},
304304

305+
SEQUOIA("sequoia", "os x 15.0", "macos 15.0") {
306+
@Override
307+
public Platform family() {
308+
return MAC;
309+
}
310+
311+
@Override
312+
public String toString() {
313+
return "macOS 15.0";
314+
}
315+
},
316+
305317
/** Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD. */
306318
UNIX("solaris", "bsd") {
307319
@Override

java/test/org/openqa/selenium/PlatformTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import static org.openqa.selenium.Platform.IOS;
2525
import static org.openqa.selenium.Platform.LINUX;
2626
import static org.openqa.selenium.Platform.MAC;
27+
import static org.openqa.selenium.Platform.SEQUOIA;
2728
import static org.openqa.selenium.Platform.UNIX;
2829
import static org.openqa.selenium.Platform.VISTA;
30+
import static org.openqa.selenium.Platform.WIN11;
2931
import static org.openqa.selenium.Platform.WIN8;
3032
import static org.openqa.selenium.Platform.WIN8_1;
3133
import static org.openqa.selenium.Platform.WINDOWS;
@@ -57,6 +59,11 @@ void testWin81IsWindows() {
5759
assertThat(WIN8_1.is(WINDOWS)).isTrue();
5860
}
5961

62+
@Test
63+
void testWindows11IsWindows() {
64+
assertThat(WIN11.is(WINDOWS)).isTrue();
65+
}
66+
6067
@Test
6168
void testLinuxIsUnix() {
6269
assertThat(LINUX.is(UNIX)).isTrue();
@@ -165,16 +172,41 @@ void testWindowsIsWindows() {
165172
assertThat(WINDOWS).isEqualTo(Platform.fromString("windows"));
166173
}
167174

175+
@Test
176+
void testWindowsIsNotEmpty() {
177+
assertThat(WINDOWS).isNotEqualTo(Platform.fromString(""));
178+
}
179+
168180
@Test
169181
void canParseMacOsXCorrectly() {
170182
assertThat(Platform.fromString("Mac OS X")).isEqualTo(MAC);
171183
}
172184

185+
@Test
186+
void testAnyIsFromStringEmpty() {
187+
assertThat(ANY).isEqualTo(Platform.fromString(""));
188+
}
189+
190+
@Test
191+
void testAnyIsFromStringAny() {
192+
assertThat(ANY).isEqualTo(Platform.fromString("any"));
193+
}
194+
195+
@Test
196+
void testAnyIsNotFromStringWindows() {
197+
assertThat(ANY).isNotEqualTo(Platform.fromString("windows"));
198+
}
199+
173200
@Test
174201
void catalinaIsMac() {
175202
assertThat(CATALINA.is(MAC)).isTrue();
176203
}
177204

205+
@Test
206+
void sequoiaIsMac() {
207+
assertThat(SEQUOIA.is(MAC)).isTrue();
208+
}
209+
178210
@Test
179211
void canParseCatalinaFromOSName() {
180212
assertThat(Platform.fromString("macOS 10.15")).isEqualTo(CATALINA);

0 commit comments

Comments
 (0)