Skip to content

Commit

Permalink
Add contrib; update readme; add composer scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Mar 10, 2024
1 parent f9a541c commit 9bbdc27
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 24 deletions.
39 changes: 39 additions & 0 deletions .github/CONTRIBUTING.md
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
```
3 changes: 0 additions & 3 deletions CHANGELOG.md

This file was deleted.

2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MIT License

Copyright (c) 2023-present MinkPhp contributors

Permission is hereby granted, free of charge, to any person
Expand Down
23 changes: 2 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ composer require "behat/mink" "mink/webdriver-classic-driver"

## Standalone Usage Example

You'll need to set up Selenium. Refer to [Contributing \ Testing](.github/CONTRIBUTING.md#testing) to see how.
```php
<?php
Expand All @@ -65,24 +67,3 @@ $session->getPage()->findLink('Chat')->click();
```
Please refer to [MinkExtension-example](https://github.com/Behat/MinkExtension-example) for an executable example.

## Testing

1. Start WebDriver:
1. If you have Docker installed, run:
```shell
docker run -p 4444:4444 selenium/standalone-firefox:4.18.1
```
2. If you do not have Docker, but you have Java, run:
```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. Start WebServer by running
```shell
./vendor/bin/mink-test-server
```
3. Run PHPUnit
```shell
./vendor/bin/phpunit
```
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,15 @@
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"scripts": {
"lint": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpstan"
],
"test": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpunit"
]
}
}

0 comments on commit 9bbdc27

Please sign in to comment.