Skip to content
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

[grid]: platformName is empty should be considered as enum ANY instead of WINDOWS #15036

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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
14 changes: 13 additions & 1 deletion java/src/org/openqa/selenium/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public enum Platform {

/** Never returned, but can be used to request a browser running on any version of Windows. */
WINDOWS("") {
WINDOWS("windows") {
@Override
public Platform family() {
return null;
Expand Down Expand Up @@ -302,6 +302,18 @@ public String toString() {
}
},

SEQUOIA("sequoia", "os x 15.0", "macos 15.0") {
@Override
public Platform family() {
return MAC;
}

@Override
public String toString() {
return "macOS 15.0";
}
},

/** Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD. */
UNIX("solaris", "bsd") {
@Override
Expand Down
32 changes: 32 additions & 0 deletions java/test/org/openqa/selenium/PlatformTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import static org.openqa.selenium.Platform.IOS;
import static org.openqa.selenium.Platform.LINUX;
import static org.openqa.selenium.Platform.MAC;
import static org.openqa.selenium.Platform.SEQUOIA;
import static org.openqa.selenium.Platform.UNIX;
import static org.openqa.selenium.Platform.VISTA;
import static org.openqa.selenium.Platform.WIN11;
import static org.openqa.selenium.Platform.WIN8;
import static org.openqa.selenium.Platform.WIN8_1;
import static org.openqa.selenium.Platform.WINDOWS;
Expand Down Expand Up @@ -57,6 +59,11 @@ void testWin81IsWindows() {
assertThat(WIN8_1.is(WINDOWS)).isTrue();
}

@Test
void testWindows11IsWindows() {
assertThat(WIN11.is(WINDOWS)).isTrue();
}

@Test
void testLinuxIsUnix() {
assertThat(LINUX.is(UNIX)).isTrue();
Expand Down Expand Up @@ -165,16 +172,41 @@ void testWindowsIsWindows() {
assertThat(WINDOWS).isEqualTo(Platform.fromString("windows"));
}

@Test
void testWindowsIsNotEmpty() {
assertThat(WINDOWS).isNotEqualTo(Platform.fromString(""));
}

@Test
void canParseMacOsXCorrectly() {
assertThat(Platform.fromString("Mac OS X")).isEqualTo(MAC);
}

@Test
void testAnyIsFromStringEmpty() {
assertThat(ANY).isEqualTo(Platform.fromString(""));
}

@Test
void testAnyIsFromStringAny() {
assertThat(ANY).isEqualTo(Platform.fromString("any"));
}

@Test
void testAnyIsNotFromStringWindows() {
assertThat(ANY).isNotEqualTo(Platform.fromString("windows"));
}

@Test
void catalinaIsMac() {
assertThat(CATALINA.is(MAC)).isTrue();
}

@Test
void sequoiaIsMac() {
assertThat(SEQUOIA.is(MAC)).isTrue();
}

@Test
void canParseCatalinaFromOSName() {
assertThat(Platform.fromString("macOS 10.15")).isEqualTo(CATALINA);
Expand Down
Loading