oleg-andreyev / minkphpwebdriver Goto Github PK
View Code? Open in Web Editor NEWWebdriver driver for Mink framework
License: MIT License
Webdriver driver for Mink framework
License: MIT License
Going to an experiment on a proprietary test suite where we have 4k unique scenarios.
Project is running Symfony 2.8 (upgrading to 3.4 now)
We'll see how it goes.
I think we should make all of the WebDriver methods protected instead of private to allow it to be extended and modified as required.
There are a couple of valid reasons to do this, but amongst them to there is sometimes a need to make changes which will not be accepted by the project.
As it stands the only ways to do this right now is to fork the project, and add it to the repositories list in composer.json, to use Reflection, or to copy large amounts of code. The fact that this project has had to completely rewrite the Selenium2 driver rather than just extend it and fix the relevant parts is a sign of that too.
So IMHO we should really update all methods to be protected instead of private.
When @OndraM moved the php-webdriver from facebook/php-webdriver
to php-webdriver/php-webdriver
there was some discussion about the naming of the project there in relation to other projects (php-webdriver/php-webdriver#730 (comment)_).
To improve the sustainability of this project I feel that it might be worth moving it to be under the php-webdriver
organisation. Ideally we should also update the namespace (sorry @oleg-andreyev).
Another alternative would be to move it under the MinkPHP project (@stof), but I feel that it makes more sense to link the Mink driver to the underlying Webdriver implementation than to the Mink project itself.
Any chance we can formally release on packagist to make use easier? We're about to go live with the driver with Moodle.
TBD
The current implementation of switchToIframe
is using name
instead of id
. This behavior is not abiding by the W3C specification, which requests for id
to be used.
Would you be open to adapt the behavior? I can whip a short PR to get this compliant.
The clickOnElement introduced by #6 leads to a Facebook\WebDriver\Exception\MoveTargetOutOfBoundsException
exception if the element to be clicked is visible but not in the current viewport.
Furthermore the specification states:
The Element Click command scrolls into view the element if it is not already pointer-interactable, and clicks its in-view center point.
https://w3c.github.io/webdriver/#element-click
I know that there are some conditions where Firefox does not do this properly in some situations, but the explicit call to moveToElement
do not solve this and for me breaks things entirely. That's because gthe moveToElement
action simply moves the mouse, it does not move the document within the viewport.
Given all methods in the WebDriver are private, I can't even fix this is my local extension of the driver.
I agree that it's correct to remove the Syn library. I did the same in my attempt to rewrite the Mink Driver, but I don't think that pressing TAB to trigger the change event is correct.
In a form this may cause something else to be focused which has unintended consequences.
In my early testing I've encountered two issues where this just doesn't work.
In our case, before each element, there is a "Help" icon which displays a Bootstrap popover on focus. In some cases this causes other elements in the DOM to be obscured. For example:
Likewise we have a field type, "Inplace editable", which transforms a string (i.e. section heading) into a Text input field. It saves the content on [RETURN], but a blur or [ESCAPE] cancels it.
Personally I think it wrong for the Mink driver to perform any attempt to blur the field, but the decision we have to make is:
a) do we break from the Mink specification and just set the value. Leave it up to the calling code and/or browser to decide when the Blur should trigger; or
b) fire a new CustomEvent('change', ...)
on the Element to mimic the documented behaviour for Mink Drivers; or
c) find a way to actually blur the field without changing the focus; or
d) keep it as is.
The rationale you've made for using TAB is that it prevents multiple change events, but I would argue that's really something that the application should be aware of regardless - I seem to recall that there are times where a browser can cause spammy change events (older versions of IE I think).
In many ways option (b) is the least evil as this is the least unnecessary change from the documented behaviour and is easily achieved:
$script = <<<EOF
{{ELEMENT}}.dispatchEvent(new Event("change", {
bubbles: true,
cancelable: false,
}));
EOF;
$this->executeJsOnXpath($xpath, $script);
In my mind the 'correct' option is (a), but I suspect that this will cause failures all over the place for people. The setValue()
function should only set a value. It should not make assumptions about the nature of page, or how interactions with that element are designed.
I'm happy to provide patches for options a or b. I don't really have any other solutions just yet for c.
We should disable the gpu for Chrome tests to improve stability. This has no relation to headless mode.
Unrelated to this: We can also run all but one test entirely headless (and the test that is failing is a bad assertion IMHO).
There is an existing Changelog file, but it hasn't been updated in some time.
I'd suggest that we scrap it and replace it with a new Changelog.md following the recommendations of https://keepachangelog.com/en/1.0.0/.
Error: Artifact path is not valid: /testKeyboardEvents_with_data_set_"alt-keyUp".png. Contains character: """. Invalid characters include: ",:,<,>,|,*,?.
This may or may not be an issue with mink-phpwebdriver, but I have to start somewhere.
When running behat tests with --format=junit, if a test fails, I'm getting the following exception:
Default exception handler: Exception - Call to a member function getPageSource() on null Debug:
Error code: generalexceptionmessage
* line 456 of /vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php: Error thrown
* line 80 of /vendor/behat/mink/src/Exception/ExpectationException.php: call to OAndreyev\Mink\Driver\WebDriver->getContent()
* line 64 of /vendor/behat/mink/src/Exception/ExpectationException.php: call to Behat\Mink\Exception\ExpectationException->getContext()
* line ? of unknownfile: call to Behat\Mink\Exception\ExpectationException->__toString()
* line 102 of /vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php: call to trim()
* line 57 of /vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php: call to Behat\Testwork\Exception\ExceptionPresenter->presentException()
* line 185 of /vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php: call to Behat\Behat\Output\Node\Printer\JUnit\JUnitStepPrinter->printStep()
* line 105 of /vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php: call to Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener->printFeatureOnAfterEvent()
* line 47 of /vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php: call to Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener->listenEvent()
* line 47 of /vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php: call to Behat\Testwork\Output\Node\EventListener\ChainEventListener->listenEvent()
* line 90 of /vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php: call to Behat\Testwork\Output\Node\EventListener\ChainEventListener->listenEvent()
* line 230 of /vendor/symfony/event-dispatcher/EventDispatcher.php: call to Behat\Testwork\Output\NodeEventListeningFormatter->listenEvent()
* line 59 of /vendor/symfony/event-dispatcher/EventDispatcher.php: call to Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
* line 64 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php: call to Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
* line 48 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php: call to Behat\Testwork\EventDispatcher\TestworkEventDispatcher->bcAwareDispatch()
* line 90 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php: call to Behat\Testwork\EventDispatcher\TestworkEventDispatcher->dispatch()
* line 64 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->tearDown()
* line 73 of /vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php: call to Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test()
* line 75 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php: call to Behat\Testwork\Hook\Tester\HookableSuiteTester->test()
* line 71 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test()
* line 73 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php: call to Behat\Testwork\Tester\Runtime\RuntimeExercise->test()
* line 80 of /vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test()
* line 149 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Ordering\OrderedExercise->test()
* line 108 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications()
* line 63 of /vendor/behat/behat/src/Behat/Testwork/Cli/Command.php: call to Behat\Testwork\Tester\Cli\ExerciseController->execute()
* line 298 of /vendor/symfony/console/Command/Command.php: call to Behat\Testwork\Cli\Command->execute()
* line 1040 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Command\Command->run()
* line 301 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Application->doRunCommand()
* line 124 of /vendor/behat/behat/src/Behat/Testwork/Cli/Application.php: call to Symfony\Component\Console\Application->doRun()
* line 171 of /vendor/symfony/console/Application.php: call to Behat\Testwork\Cli\Application->doRun()
* line 34 of /vendor/behat/behat/bin/behat: call to Symfony\Component\Console\Application->run()
* line 119 of /vendor/bin/behat: call to include()
If tests pass, everything runs smoothly. This is in Moodle, which uses v1.2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.