Skip to content

Commit 1a4f7a1

Browse files
committed
Remove 'any' when present in W3C platformName capabilitites
1 parent f777ca1 commit 1a4f7a1

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

lib/Remote/DesiredCapabilities.php

+5
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ public function toW3cCompatibleArray()
229229
if (array_key_exists($capabilityKey, static::$ossToW3c)) {
230230
if ($capabilityKey === WebDriverCapabilityType::PLATFORM) {
231231
$w3cCapabilities[static::$ossToW3c[$capabilityKey]] = mb_strtolower($capabilityValue);
232+
233+
// Remove platformName if it is set to "any"
234+
if ($w3cCapabilities[static::$ossToW3c[$capabilityKey]] === 'any') {
235+
unset($w3cCapabilities[static::$ossToW3c[$capabilityKey]]);
236+
}
232237
} else {
233238
$w3cCapabilities[static::$ossToW3c[$capabilityKey]] = $capabilityValue;
234239
}

lib/WebDriverPlatform.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
class WebDriverPlatform
2424
{
2525
const ANDROID = 'ANDROID';
26+
/** @deprecated */
2627
const ANY = 'ANY';
2728
const LINUX = 'LINUX';
2829
const MAC = 'MAC';

tests/unit/Remote/DesiredCapabilitiesTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function provideW3cCapabilities()
187187
]),
188188
[],
189189
],
190-
'already W3C capabilitites' => [
190+
'already W3C capabilities' => [
191191
new DesiredCapabilities([
192192
'pageLoadStrategy' => 'eager',
193193
'strictFileInteractability' => false,
@@ -197,6 +197,12 @@ public function provideW3cCapabilities()
197197
'strictFileInteractability' => false,
198198
],
199199
],
200+
'"ANY" platform should be completely removed' => [
201+
new DesiredCapabilities([
202+
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
203+
]),
204+
[],
205+
],
200206
'custom vendor extension' => [
201207
new DesiredCapabilities([
202208
'vendor:prefix' => 'vendor extension should be kept',

0 commit comments

Comments
 (0)