Skip to content

Commit

Permalink
Preparing 1.0 release (#30)
Browse files Browse the repository at this point in the history
- added changelog
- added license
- updated composer
- updated shell-scripts
- updated WebDriverFactory
  • Loading branch information
oleg-andreyev authored Jan 16, 2021
1 parent 8bac9c5 commit 8d93021
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 129 deletions.
88 changes: 23 additions & 65 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,24 @@
1.3.1 / 2016-03-05
==================
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2021-01-16
### Added
- Initial implementation as a hard fork from https://github.com/minkphp/MinkSelenium2Driver
- Using .editorconfig
- Using GitHub Action instead of Travis CI
- Using Dependabot
- Using own fork of driver-testsuite
- Added Screenshot listener (for unit tests)
- Added LICENCE file
- Prompt support
- Workaround for https://github.com/mozilla/geckodriver/issues/149
- Workaround for https://github.com/mozilla/geckodriver/issues/653
- Workaround for https://github.com/mozilla/geckodriver/issues/1816
- Handling `input[type=time]`, `input[type=date]` and `input[type=color]`

[Unreleased]: https://github.com/oleg-andreyev/MinkPhpWebDriver/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/oleg-andreyev/MinkPhpWebDriver/compare/07b0f6be5c4ec82b041b62b99bd48786a4373ad0...v1.0.0

Bug fixes:

* Fixed the handling of cookies with semicolon in the value

Testsuite:

* Add testing on PHP 7

1.3.0 / 2015-09-21
==================

New features:

* Updated the driver to use findElementsXpaths for Mink 1.7 and forward compatibility with Mink 2

Testsuite:

* Fixed the window name test for the chrome driver
* Add testing on PhantomJS 2

Misc:

* Updated the repository structure to PSR-4

1.2.0 / 2014-09-29
==================

BC break:

* Changed the behavior of `getValue` for checkboxes according to the BC break in Mink 1.6

New features:

* Added the support of the `chromeOptions` argument in capabilities
* Added the support of select elements in `setValue`
* Added the support of checbox and radio elements in `setValue`
* Added the support of HTML5 input types in `setValue` (for those supported by WebDriver itself)
* Added `getWebDriverSessionId` to get the WebDriver session id
* Added a way to configure the webdriver timeouts
* Implemented `getOuterHtml`
* Implemented `getWindowNames` and `getWindowName`
* Implemented `maximizeWindow`
* Implemented `submitForm`
* Implemented `isSelected`

Bug fixes:

* Fixed the selection of options for radio groups
* Fixed `getValue` for radio groups
* Fixed the selection of options for multiple selects to ensure the change event is triggered only once
* Fixed mouse interactions to use the webDriver API rather than using JS and emulating events
* Fixed duplicate change events being triggered when setting the value
* Fixed the code to throw exceptions for invalid usages of the driver
* Fixed the implementation of `mouseOver`
* Fixed `evaluateScript` and `executeScript` to support all syntaxes required by the Mink API
* Fixed the retrieval of HTML attributes in `getAttribute`
* Fixed form interactions to use the webDriver API rather than using JS and emulating change events
* Fixed the clearing of the value when the caret is at the beginning of the field in `setValue`

Testing:

* Updated the testsuite to use the new Mink 1.6 driver testsuite
* Added testing on HHVM
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Oleg Andreyev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
MinkFacebookWebDriver
MinkPhpWebDriver
=================================

Initially it's started as [PR](https://github.com/minkphp/MinkSelenium2Driver/pull/304) to MinkSelenium2Driver

Major updates include:
- Switch to using `facebook/webdriver`
- Update minimum php version to 7.0
- Tested against latest Google Chrome and Mozilla Firefox both in GUI and Headless modes
- Update minimum php version to 7.2
- Tested against the latest Google Chrome and Mozilla Firefox both in GUI and Headless modes

## Using the MinkFacebookWebDriver with Behat
## Using the MinkPhpWebDriver with Behat

Subclass `Behat\MinkExtension\ServiceContainer\MinkExtension` and add the new driver factory.

Expand All @@ -32,19 +32,6 @@ class MinkExtension extends BaseMinkExtension

Add this extension to your `behat.yml` (see below)

## Running chromedriver or geckodriver

- Google Chrome
- Go to https://chromedriver.chromium.org/downloads and download required version
- Start driver `./chromedriver --port=4444 --verbose --whitelisted-ips=`

- Mozilla Firefox
- Go to https://github.com/mozilla/geckodriver/releases and download required version
- Start driver `./geckodriver --host 127.0.0.1 -vv --port 4444`
- Docker
- `docker run --rm --network=host -p 4444:4444 selenium/standalone-chrome`
- `docker run --rm --network=host -p 4444:4444 selenium/standalone-firefox`

- Set the wd_host to this server instead
```yaml
default:
Expand All @@ -60,12 +47,13 @@ extensions:
## Testing
```bash
# BROWSER_NAME=firefox GECKODRIVER_VERSION=latest ./.build/before_script.sh
$ BROWSER_NAME=chrome CHROMEDRIVER_VERSION=latest ./.build/before_script.sh
$ ./vendor/bin/simple-phpunit
$ ./bin/start_webdriver.sh &
#./bin/start_driver.sh <browser> <version>
$ ./bin/start_driver.sh chrome latest &
$ BROWSER_NAME=chrome ./vendor/bin/simple-phpunit
```

This will download latest driver for specified browser and will execute phpunit
This will download the latest driver for specified browser and will execute phpunit

## Copyright

Expand Down
8 changes: 3 additions & 5 deletions bin/start_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ if [[ "$BROWSER_NAME" == "firefox" ]]; then
fi

if [[ "$BROWSER_NAME" == "msedge" ]]; then
./msedgedriver/msedgedriver --port=4444 --verbose --enable-chrome-logs --whitelisted-ips= &>./logs/webdriver.log &
./msedgedriver/msedgedriver --port=4444 --verbose --enable-chrome-logs --whitelisted-ips=
elif [[ "$BROWSER_NAME" == "chrome" ]]; then
./chromedriver/chromedriver --port=4444 --verbose --enable-chrome-logs --whitelisted-ips= &>./logs/webdriver.log &
./chromedriver/chromedriver --port=4444 --verbose --enable-chrome-logs --whitelisted-ips=
elif [[ "$BROWSER_NAME" == "firefox" ]]; then
./geckodriver/geckodriver --host 127.0.0.1 -vv --port 4444 &>./logs/webdriver.log &
else
docker run --rm --network=host -p 4444:4444 "selenium/standalone-firefox:$SELENIUM_DRIVER" &>./logs/selenium.log &
./geckodriver/geckodriver --host 127.0.0.1 -vv --port 4444
fi
15 changes: 1 addition & 14 deletions bin/start_webserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,9 @@

set -ex

ATTEMPT=0
until $(echo | nc localhost 4444); do
if [ $ATTEMPT -gt 5 ]; then
echo "Failed to start $BROWSER_NAME driver"
cat ./logs/webdriver.log
exit 1;
fi;
sleep 1;
echo "Waiting for $BROWSER_NAME driver on port 4444...";
ATTEMPT=$((ATTEMPT + 1))
done;
echo "$BROWSER_NAME driver started"

# see https://github.com/minkphp/driver-testsuite/pull/28
export USE_ZEND_ALLOC=0
php -S localhost:8002 -t ./vendor/mink/driver-testsuite/web-fixtures &> ./logs/mink-test-server.log &
php -S localhost:8002 -t ./vendor/mink/driver-testsuite/web-fixtures

WEBSERVER_PID=$!

Expand Down
29 changes: 19 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{
"name": "oleg-andreyev/mink-facebook-web-driver",
"description": "MinkFacebookWebDriver driver for Mink framework",
"keywords": ["webdriver", "w3c", "jsonwire", "javascript", "ajax", "testing", "browser"],
"type": "mink-driver",
"license": "MIT",

"name": "oleg-andreyev/mink-php-web-driver",
"description": "MinkPhpWebDriver driver for Mink framework",
"keywords": [
"webdriver",
"w3c",
"jsonwire",
"javascript",
"ajax",
"testing",
"browser"
],
"type": "mink-driver",
"license": "MIT",
"authors": [
{
"name": "Oleg Andreyev",
"email": "[email protected]"
"name": "Oleg Andreyev",
"email": "[email protected]",
"role": "Main Developer"
}
],
"repositories": [
Expand All @@ -19,12 +27,13 @@
}
],
"require": {
"php": ">=7.2",
"behat/mink": "^1.8",
"php": ">=7.2",
"behat/mink": "^1.8",
"php-webdriver/webdriver": "^1.8"
},
"require-dev": {
"ext-json": "*",
"roave/security-advisories": "dev-master",
"mink/driver-testsuite": "dev-integration-branch",
"behat/mink-extension": "^2.3",
"symfony/phpunit-bridge": "^5.2"
Expand Down
20 changes: 6 additions & 14 deletions src/WebDriverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,16 @@ public function buildDriver(array $config)
*/
protected function guessCapabilities()
{
if (getenv('TRAVIS_JOB_NUMBER')) {
if (getenv('CI')) {
return [
'tunnel-identifier' => getenv('TRAVIS_JOB_NUMBER'),
'build' => getenv('TRAVIS_BUILD_NUMBER'),
'tags' => ['Travis-CI', 'PHP ' . phpversion()],
];
}

if (getenv('JENKINS_HOME')) {
return [
'tunnel-identifier' => getenv('JOB_NAME'),
'build' => getenv('BUILD_NUMBER'),
'tags' => ['Jenkins', 'PHP ' . phpversion(), getenv('BUILD_TAG')],
'tunnel-identifier' => getenv('GITHUB_RUN_ID'),
'build' => getenv('GITHUB_RUN_NUMBER'),
'tags' => ['GitHub Actions', 'PHP ' . PHP_VERSION],
];
}

return [
'tags' => [php_uname('n'), 'PHP ' . phpversion()],
'tags' => [php_uname('n'), 'PHP ' . PHP_VERSION],
];
}
}
}

0 comments on commit 8d93021

Please sign in to comment.