-
Notifications
You must be signed in to change notification settings - Fork 5
Improve readme #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Improve readme #19
Changes from 7 commits
70734f1
a8ce926
f9a541c
9bbdc27
9768932
bd97269
3466441
418f5e3
4b888e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Contributing to Mink WebDriver Classic Driver | ||
|
|
||
| At the moment, contributions can be in the form of: | ||
|
|
||
| 1. [Reporting Bugs or Requesting Features](https://github.com/minkphp/webdriver-classic-driver/issues) | ||
| 2. [Contributing Code (as Pull Requests)](https://github.com/minkphp/webdriver-classic-driver/pulls) | ||
|
|
||
| ## Licensing | ||
|
|
||
| The changes you contribute (as Pull Requests) will be under the | ||
| same [MIT License](https://github.com/minkphp/webdriver-classic-driver/blob/main/LICENSE) used by this project. | ||
| Needless to say, it is your responsibility that your contribution is either your original work or that it has been | ||
| allowed by the original author. | ||
|
|
||
| ## Code Quality | ||
|
|
||
| We use automated tools to have a general and consistent level of code quality. Simply run the following before each | ||
| commit (or at least before sending a Pull Request): | ||
|
|
||
| ```shell | ||
| composer run lint | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| 1. Firstly, you will need to run Selenium and a Web Browser (and/or perhaps a driver in between): | ||
| 1. **With Docker** - A `docker-compose.yml` file with sensible defaults is already provided , so you can just run: | ||
| ```shell | ||
| docker compose up | ||
| ``` | ||
| 2. **With Java (Native)** - This would take more work, but performs better. Get started by running: | ||
| ```shell | ||
| curl -L https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.18.0/selenium-server-4.18.1.jar > selenium-server-4.18.1.jar | ||
| java -jar selenium-server-4.18.1.jar standalone | ||
| ``` | ||
| 2. Finally, you can simply run the tests with: | ||
| ```shell | ||
| composer run test | ||
| ``` | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,39 @@ | ||
| # Mink WebDriver Classic Driver | ||
|
|
||
| [](https://packagist.org/packages/mink/webdriver-classic-driver) | ||
|
aik099 marked this conversation as resolved.
|
||
| [](https://packagist.org/packages/mink/webdriver-classic-driver) | ||
| [](https://packagist.org/packages/mink/webdriver-classic-driver) | ||
| [](https://packagist.org/packages/mink/webdriver-classic-driver) | ||
| [](https://github.com/minkphp/webdriver-classic-driver/actions/workflows/ci.yml) | ||
| [](https://github.com/minkphp/webdriver-classic-driver/blob/main/LICENSE) | ||
| [](https://codecov.io/gh/minkphp/webdriver-classic-driver) | ||
|
|
||
| ## Usage Example | ||
| A [php-webdriver](https://github.com/php-webdriver/php-webdriver)-based driver | ||
| for [Mink](https://github.com/minkphp/Mink), supporting Selenium 2-4 and tested on Chrome, Firefox and Edge. | ||
|
|
||
| ``` php | ||
| ## Installation | ||
|
|
||
| ### For Mink/Standalone Usage | ||
|
|
||
| Simply install the package with composer and check the [Standalone Usage Example](#standalone-usage-example) below. | ||
|
|
||
| ```shell | ||
| composer require "behat/mink" "mink/webdriver-classic-driver" | ||
| ``` | ||
|
|
||
| ### For Behat/BDD Usage | ||
|
|
||
| 1. Add all the relevant packages - typically this will be for testing your application, so you'd want to use `--dev`. | ||
| ```shell | ||
| composer require --dev "behat/behat" "behat/mink" "friends-of-behat/mink-extension" "mink/webdriver-classic-driver" | ||
| ``` | ||
| 2. Configure Behat to enable the Mink Extension and set it to use this driver. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would posting a link on https://github.com/FriendsOfBehat/MinkExtension/blob/master/doc/index.rst page, that will explain how to connect this driver specifically to Behat hurt? // cc @stof .
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's a good idea. |
||
|
|
||
| ## Standalone Usage Example | ||
|
|
||
| You will need to run a WebDriver server, either using [Selenium](https://www.selenium.dev/) or the browser driver directly. | ||
|
|
||
| ```php | ||
| <?php | ||
|
|
||
| use Behat\Mink\Mink, | ||
|
|
@@ -19,11 +43,11 @@ use Behat\Mink\Mink, | |
| require_once __DIR__ . '/vendor/autoload.php'; | ||
|
|
||
| $browserName = 'firefox'; | ||
| $url = 'http://example.com'; | ||
| $url = 'https://example.com'; | ||
|
|
||
| $mink = new Mink(array( | ||
| $mink = new Mink([ | ||
| 'webdriver-classic' => new Session(new WebdriverClassicDriver($browserName)), | ||
| )); | ||
| ]); | ||
|
|
||
| $session = $mink->getSession('webdriver-classic'); | ||
| $session->visit($url); | ||
|
|
@@ -32,30 +56,3 @@ $session->getPage()->findLink('Chat')->click(); | |
| ``` | ||
|
|
||
| Please refer to [MinkExtension-example](https://github.com/Behat/MinkExtension-example) for an executable example. | ||
|
|
||
| ## Installation | ||
|
|
||
| ``` bash | ||
| composer require behat/mink mink/webdriver-classic-driver | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| 1. Start WebDriver | ||
| 1. If you have Docker installed, run | ||
| ```bash | ||
| docker run -p 4444:4444 selenium/standalone-firefox:4.18.1 | ||
| ``` | ||
| 2. If you do not have Docker, but you have Java | ||
| ```bash | ||
| curl -L https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.18.0/selenium-server-4.18.1.jar > selenium-server-4.18.1.jar | ||
| java -jar selenium-server-4.18.1.jar standalone | ||
| ``` | ||
| 2. Start WebServer by running | ||
| ``` bash | ||
| ./vendor/bin/mink-test-server | ||
| ``` | ||
| 3. Start PhpUnit | ||
| ```bash | ||
| ./vendor/bin/phpunit -v --coverage-clover=coverage.clover | ||
| ``` | ||
Uh oh!
There was an error while loading. Please reload this page.