Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit ee14c43

Browse files
committed
Use W3C protocol on some Saucelabs builds
1 parent e9f4ec8 commit ee14c43

File tree

3 files changed

+41
-15
lines changed

3 files changed

+41
-15
lines changed

.travis.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ matrix:
8585
chrome: stable
8686

8787
# Saucelabs builds
88-
- php: '7.3'
89-
env: SAUCELABS=1 BROWSER_NAME="firefox" VERSION="47.0" PLATFORM="Windows 10"
88+
- name: 'Sauce Labs, Firefox 47, OSS protocol'
89+
php: '7.3'
90+
env: SAUCELABS=1 BROWSER_NAME="firefox" VERSION="47.0" PLATFORM="Windows 10" DISABLE_W3C_PROTOCOL="1"
9091
before_script:
9192
- php -S 127.0.0.1:8000 -t tests/functional/web/ &>>./logs/php-server.log &
9293
- until $(echo | nc localhost 8000); do sleep 1; echo waiting for PHP server on port 8000...; done; echo "PHP server started"
@@ -95,8 +96,9 @@ matrix:
9596
jwt:
9697
secure: HPq5xFhosa1eSGnaRdJzeyEuaE0mhRlG1gf3G7+dKS0VniF30husSyrxZhbGCCKBGxmIySoAQzd43BCwL69EkUEVKDN87Cpid1Ce9KrSfU3cnN8XIb+4QINyy7x1a47RUAfaaOEx53TrW0ShalvjD+ZwDE8LrgagSox6KQ+nQLE=
9798

98-
- php: '7.3'
99-
env: SAUCELABS=1 BROWSER_NAME="chrome" VERSION="74.0" PLATFORM="Windows 10" # 74 is the last version which don't use W3C WebDriver by default
99+
- name: 'Sauce Labs, Chrome 74, OSS protocol'
100+
php: '7.3'
101+
env: SAUCELABS=1 BROWSER_NAME="chrome" VERSION="74.0" PLATFORM="Windows 10" DISABLE_W3C_PROTOCOL="1" # 74 is the last version which don't use W3C WebDriver by default
100102
before_script:
101103
- php -S 127.0.0.1:8000 -t tests/functional/web/ &>>./logs/php-server.log &
102104
- until $(echo | nc localhost 8000); do sleep 1; echo waiting for PHP server on port 8000...; done; echo "PHP server started"
@@ -105,8 +107,9 @@ matrix:
105107
jwt:
106108
secure: HPq5xFhosa1eSGnaRdJzeyEuaE0mhRlG1gf3G7+dKS0VniF30husSyrxZhbGCCKBGxmIySoAQzd43BCwL69EkUEVKDN87Cpid1Ce9KrSfU3cnN8XIb+4QINyy7x1a47RUAfaaOEx53TrW0ShalvjD+ZwDE8LrgagSox6KQ+nQLE=
107109

108-
- php: '7.3'
109-
env: SAUCELABS=1 BROWSER_NAME="chrome" VERSION="75.0" PLATFORM="Windows 10"
110+
- name: 'Sauce Labs, Chrome latest, W3C protocol'
111+
php: '7.3'
112+
env: SAUCELABS=1 BROWSER_NAME="chrome" VERSION="latest" PLATFORM="Windows 10"
110113
before_script:
111114
- php -S 127.0.0.1:8000 -t tests/functional/web/ &>>./logs/php-server.log &
112115
- until $(echo | nc localhost 8000); do sleep 1; echo waiting for PHP server on port 8000...; done; echo "PHP server started"
@@ -115,8 +118,9 @@ matrix:
115118
jwt:
116119
secure: HPq5xFhosa1eSGnaRdJzeyEuaE0mhRlG1gf3G7+dKS0VniF30husSyrxZhbGCCKBGxmIySoAQzd43BCwL69EkUEVKDN87Cpid1Ce9KrSfU3cnN8XIb+4QINyy7x1a47RUAfaaOEx53TrW0ShalvjD+ZwDE8LrgagSox6KQ+nQLE=
117120

118-
- php: '7.3'
119-
env: SAUCELABS=1 BROWSER_NAME="MicrosoftEdge" VERSION="16.16299" PLATFORM="Windows 10"
121+
- name: 'Sauce Labs, Edge latest, W3C protocol'
122+
php: '7.3'
123+
env: SAUCELABS=1 BROWSER_NAME="MicrosoftEdge" VERSION="latest" PLATFORM="Windows 10"
120124
before_script:
121125
- php -S 127.0.0.1:8000 -t tests/functional/web/ &>>./logs/php-server.log &
122126
- until $(echo | nc localhost 8000); do sleep 1; echo waiting for PHP server on port 8000...; done; echo "PHP server started"

tests/functional/WebDriverTestCase.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ public static function isSauceLabsBuild()
112112
public static function isW3cProtocolBuild()
113113
{
114114
return getenv('GECKODRIVER') === '1'
115-
|| (getenv('BROWSER_NAME') === 'chrome'
116-
&& getenv('DISABLE_W3C_PROTOCOL') !== '1'
117-
&& !self::isSauceLabsBuild());
115+
|| (getenv('BROWSER_NAME') === 'chrome' && getenv('DISABLE_W3C_PROTOCOL') !== '1')
116+
|| getenv('BROWSER_NAME') === 'MicrosoftEdge';
118117
}
119118

120119
public static function skipForW3cProtocol($message = 'Not supported by W3C specification')
@@ -153,12 +152,32 @@ protected function setUpSauceLabs()
153152
$this->desiredCapabilities->setBrowserName(getenv('BROWSER_NAME'));
154153
$this->desiredCapabilities->setVersion(getenv('VERSION'));
155154
$this->desiredCapabilities->setPlatform(getenv('PLATFORM'));
156-
$this->desiredCapabilities->setCapability('name', get_class($this) . '::' . $this->getName());
157-
$this->desiredCapabilities->setCapability('tags', [get_class($this)]);
155+
$name = get_class($this) . '::' . $this->getName();
156+
$tags = [get_class($this)];
158157

159158
if (getenv('TRAVIS_JOB_NUMBER')) {
160-
$this->desiredCapabilities->setCapability('tunnel-identifier', getenv('TRAVIS_JOB_NUMBER'));
161-
$this->desiredCapabilities->setCapability('build', getenv('TRAVIS_JOB_NUMBER'));
159+
$tunnelIdentifier = getenv('TRAVIS_JOB_NUMBER');
160+
$build = getenv('TRAVIS_JOB_NUMBER');
161+
}
162+
163+
if (!getenv('DISABLE_W3C_PROTOCOL')) {
164+
$sauceOptions = [
165+
'name' => $name,
166+
'tags' => $tags,
167+
];
168+
if (isset($tunnelIdentifier, $build)) {
169+
$sauceOptions['tunnelIdentifier'] = $tunnelIdentifier;
170+
$sauceOptions['build'] = $build;
171+
}
172+
$this->desiredCapabilities->setCapability('sauce:options', (object) $sauceOptions);
173+
} else {
174+
$this->desiredCapabilities->setCapability('name', $name);
175+
$this->desiredCapabilities->setCapability('tags', $tags);
176+
177+
if (isset($tunnelIdentifier, $build)) {
178+
$this->desiredCapabilities->setCapability('tunnel-identifier', $tunnelIdentifier);
179+
$this->desiredCapabilities->setCapability('build', $build);
180+
}
162181
}
163182
}
164183
}

tests/functional/WebDriverTimeoutsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class WebDriverTimeoutsTest extends WebDriverTestCase
2828
{
29+
/**
30+
* @group exclude-saucelabs
31+
*/
2932
public function testShouldFailGettingDelayedElementWithoutWait()
3033
{
3134
$this->driver->get($this->getTestPageUrl('delayed_element.html'));

0 commit comments

Comments
 (0)