Skip to content

Commit

Permalink
CI: Run module-phpbrowser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed Dec 30, 2020
1 parent f1b9684 commit f180f92
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ jobs:
- name: Run tests without code coverage on PHP 7.3, 7.4
if: matrix.php == '7.3' || matrix.php == '7.4'
run: |
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &
php -S 127.0.0.1:8008 -t tests/data/app >/dev/null 2>&1 &
php codecept build
php codecept run cli,unit
- name: Run tests with code coverage on PHP 7.2, 8.0
if: matrix.php == '7.2' || matrix.php == '8.0'
run: |
php -S 127.0.0.1:8000 -t tests/data/app -d pcov.directory=$(pwd)/tests/data/app >/dev/null 2>&1 &
php -S 127.0.0.1:8008 -t tests/data/app -d pcov.directory=$(pwd)/tests/data/app >/dev/null 2>&1 &
php codecept build
php codecept run cli,unit,coverage --env COVERAGE=1
Expand All @@ -75,6 +75,13 @@ jobs:
- name: Run module-filesystem tests
run: php codecept run -c vendor/codeception/module-filesystem/

- name: Run module-phpbrowser tests
run: |
cd vendor/codeception/module-phpbrowser/
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &
php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 &
php ../../../codecept run tests/unit/Codeception/Module/PhpBrowserTest.php
windows-latest:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

Expand Down
6 changes: 3 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ There are 3 suites for testing
To run the web tests:
1. Start PHP's internal webserver in the project directory:
```
php -S 127.0.0.1:8000 -t tests/data/app
php -S 127.0.0.1:8008 -t tests/data/app
```
1. Start Selenium server
1. Run:
Expand Down Expand Up @@ -49,7 +49,7 @@ Requirements:
When a module requires a web server with the demo application running, you can find this app in `tests/data/app`. To execute tests for **PhpBrowser** or **WebDriver** you need to start a web server for this dir:

```
php -S 127.0.0.1:8000 -t tests/data/app
php -S 127.0.0.1:8008 -t tests/data/app
```

If you run `FrameworkTest` for various frameworks, you don't need a web server running.
Expand All @@ -60,7 +60,7 @@ It is a very basic PHP application developed with `glue` microframework. To add
1. Add a route in `tests/data/app/index.php`
1. Add a class in `tests/data/app/controllers.php`

To see the page in the browser, open `http://localhost:8000/your-route`
To see the page in the browser, open `http://localhost:8008/your-route`

Then create a test in `tests/web/WebDriverTest.php`, and run it with `php codecept run web WebDriverTest::yourTest --env chrome`

Expand Down
2 changes: 1 addition & 1 deletion tests/data/app/view/redirect2.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://localhost:8000/info" />
<meta http-equiv="refresh" content="0; url=http://localhost:8008/info" />
</head>
<body>
<h1>Redirecting...</h1>
Expand Down
2 changes: 1 addition & 1 deletion tests/data/app/view/redirect_interval.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="refresh" content="1800; url=http://localhost:8000/info" />
<meta http-equiv="refresh" content="1800; url=http://localhost:8008/info" />
</head>
<body>
<h1>Redirecting in 1800 seconds</h1>
Expand Down
2 changes: 1 addition & 1 deletion tests/data/app/view/redirect_params.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://localhost:8000/search?one=1&amp;two=2" />
<meta http-equiv="refresh" content="0; url=http://localhost:8008/search?one=1&amp;two=2" />
</head>
<body>
<h1>Redirecting...</h1>
Expand Down
2 changes: 1 addition & 1 deletion tests/data/app/view/register.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<base href="http://127.0.0.1:8000">
<base href="http://127.0.0.1:8008">
<meta charset="utf-8">
<title>Test submitting a form with a relative URL without a leading slash as its action from a URI in the root directory</title>
</head>
Expand Down
4 changes: 2 additions & 2 deletions tests/data/claypit/tests/remote.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ modules:
enabled: [PhpBrowser, Filesystem, OtherHelper]
config:
PhpBrowser:
url: http://127.0.0.1:8000
url: http://127.0.0.1:8008


env:
Expand All @@ -14,7 +14,7 @@ env:
enabled: [WebDriver, Filesystem, OtherHelper]
config:
WebDriver:
url: http://127.0.0.1:8000
url: http://127.0.0.1:8008
browser: firefox


Expand Down
4 changes: 2 additions & 2 deletions tests/data/claypit/tests/remote_server.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ modules:
enabled: [PhpBrowser, Filesystem, OtherHelper]
config:
PhpBrowser:
url: http://127.0.0.1:8000
url: http://127.0.0.1:8008

env:
default:
Expand All @@ -13,7 +13,7 @@ env:
enabled: [WebDriver, Filesystem, OtherHelper]
config:
WebDriver:
url: http://127.0.0.1:8000
url: http://127.0.0.1:8008
browser: firefox
work:
coverage:
Expand Down

0 comments on commit f180f92

Please sign in to comment.