From 3c33f65ecb69fb11ce6a682d9934977ceff8a1d5 Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Tue, 15 Jan 2019 23:53:28 +0200 Subject: [PATCH 1/4] implementing pressKey, behat/mink to 1.8@dev --- composer.json | 2 +- src/Selenium2Driver.php | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f130a130..e1e4c9d7 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "require": { "php": ">=5.4", - "behat/mink": "~1.7@dev", + "behat/mink": "~1.8@dev", "instaclick/php-webdriver": "~1.1" }, "require-dev": { diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 0f99a9e6..89610d59 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -881,6 +881,49 @@ public function keyUp($xpath, $char, $modifier = null) $this->trigger($xpath, 'keyup', $options); } + /** + * {@inheritdoc} + */ + public function pressKey($xpath, $char, $modifier = null) + { + $keys = array(); + + $modifier = $this->keyModifier($modifier); + if ($modifier) { + $keys[] = $modifier; + } + + $keys[] = $char; + + if ($modifier) { + $keys[] = Key::NULL_KEY; + } + + $this->findElement($xpath)->postValue(array('value' => array_map('strval', $keys))); + } + + /** + * Converts alt/ctrl/shift/meta to corresponded Key::* constant + * + * @param string $modifier + * + * @return string + */ + private function keyModifier($modifier) + { + if ($modifier === 'alt') { + $modifier = Key::ALT; + } else if ($modifier === 'ctrl') { + $modifier = Key::CONTROL; + } else if ($modifier === 'shift') { + $modifier = Key::SHIFT; + } else if ($modifier === 'meta') { + $modifier = Key::META; + } + + return $modifier; + } + /** * {@inheritdoc} */ From bcbd2d24bc4977be3653a116593b19582a4b4714 Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Mon, 2 Sep 2019 21:21:21 +0300 Subject: [PATCH 2/4] TO BE REVERTED - added custom repo for testing --- composer.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index e1e4c9d7..4b2f9710 100644 --- a/composer.json +++ b/composer.json @@ -18,15 +18,24 @@ "homepage": "http://everzet.com" } ], + "repositories": [ + { + "type": "github", + "url": "https://github.com/oleg-andreyev/Mink.git" + }, + { + "type": "github", + "url": "https://github.com/oleg-andreyev/driver-testsuite.git" + } + ], "require": { "php": ">=5.4", - "behat/mink": "~1.8@dev", + "behat/mink": "dev-deprecate-keyup-keypress-keydown", "instaclick/php-webdriver": "~1.1" }, "require-dev": { - "mink/driver-testsuite": "dev-master" + "mink/driver-testsuite": "dev-mink-772" }, - "autoload": { "psr-4": { "Behat\\Mink\\Driver\\": "src/" From cba6bca4eb105a27c0e4d36d41107382740b4eca Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Mon, 2 Sep 2019 21:28:30 +0300 Subject: [PATCH 3/4] TO BE REVERTED - added custom repo for testing --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4b2f9710..c2247ecd 100644 --- a/composer.json +++ b/composer.json @@ -20,11 +20,11 @@ ], "repositories": [ { - "type": "github", + "type": "vcs", "url": "https://github.com/oleg-andreyev/Mink.git" }, { - "type": "github", + "type": "vcs", "url": "https://github.com/oleg-andreyev/driver-testsuite.git" } ], From 82e9cd044bf931aa4c6a016048245b38da7e2fcb Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Mon, 2 Sep 2019 21:31:02 +0300 Subject: [PATCH 4/4] TO BE REVERTED - added custom repo for testing --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c2247ecd..f5f6338f 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,13 @@ "repositories": [ { "type": "vcs", - "url": "https://github.com/oleg-andreyev/Mink.git" + "url": "https://github.com/oleg-andreyev/Mink.git", + "no-api": true }, { "type": "vcs", - "url": "https://github.com/oleg-andreyev/driver-testsuite.git" + "url": "https://github.com/oleg-andreyev/driver-testsuite.git", + "no-api": true } ], "require": {