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

Commit a419816

Browse files
committed
Skip file upload tests on Saucelabs, because W3C protocol does not support remote file upload
See w3c/webdriver#1355
1 parent b54d503 commit a419816

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

lib/Remote/RemoteWebElement.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ public function isSelected()
358358
public function sendKeys($value)
359359
{
360360
$local_file = $this->fileDetector->getLocalFile($value);
361+
361362
if ($local_file === null) {
362363
if ($this->isW3cCompliant) {
363364
$params = [
@@ -370,22 +371,18 @@ public function sendKeys($value)
370371
':id' => $this->id,
371372
];
372373
}
373-
374-
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ELEMENT, $params);
375-
376-
return $this;
377-
}
378-
379-
if ($this->isW3cCompliant) {
380-
$params = [
381-
'text' => $local_file,
382-
':id' => $this->id,
383-
];
384374
} else {
385-
$params = [
386-
'value' => WebDriverKeys::encode($this->upload($local_file)),
387-
':id' => $this->id,
388-
];
375+
if ($this->isW3cCompliant) {
376+
$params = [
377+
'text' => $local_file,
378+
':id' => $this->id,
379+
];
380+
} else {
381+
$params = [
382+
'value' => WebDriverKeys::encode($this->upload($local_file)),
383+
':id' => $this->id,
384+
];
385+
}
389386
}
390387

391388
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ELEMENT, $params);

tests/functional/FileUploadTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class FileUploadTest extends WebDriverTestCase
2626
/**
2727
* @group exclude-edge
2828
* https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6052385/
29+
* @group exclude-saucelabs
30+
* W3C protocol does not support remote file upload: https://github.com/w3c/webdriver/issues/1355
2931
*/
3032
public function testShouldUploadAFile()
3133
{

0 commit comments

Comments
 (0)