Skip to content

Commit

Permalink
Merge pull request #257 from lmc-eu/feature/github-actions
Browse files Browse the repository at this point in the history
Add GH Actions build for static analysis and markdown check
  • Loading branch information
OndraM authored Nov 28, 2020
2 parents 2628812 + da563e2 commit d32ff98
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 26 deletions.
7 changes: 7 additions & 0 deletions .github/mlc_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ignorePatterns": [
{
"pattern": "^https://github.com/lmc-eu/steward/pull/"
}
]
}
40 changes: 40 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests and linting

on:
push:
pull_request:
schedule:
- cron: '0 3 * * *'

jobs:
codestyle:
name: "Code style and static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
tools: composer:v2

- name: Install dependencies
run: composer update --no-progress

- name: Lint
run: composer lint

- name: Run checks
run: composer analyze

markdown-link-check:
name: "Markdown link check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
config-file: '.github/mlc_config.json'
11 changes: 0 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ matrix:
- name: 'Lowest dependencies'
php: 7.2
env: dependencies="--prefer-lowest --prefer-stable"
- name: 'Codestyle and static analysis'
php: 7.4
env: CHECK_CODESTYLE=1
before_install:
- phpenv config-rm xdebug.ini
before_script: ~
script:
- composer lint
- composer codestyle:check
- composer analyze
after_success: ~

install:
- travis_retry composer self-update && composer --version
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- `RunTestsProcessEvent` (dispatched from `run` command when initializing PHPUnit processes) now contains array of environment variables instead of ProcessBuilder. Use `setEnvironmentVars()` method to change the variables passed to the process.
- Default browser size is now defined using class constants instead of class variables. To override the default, instead of `public static $browserWidth = ...;` use `public const BROWSER_WIDTH = ...;`.
- When test class constants defining default browser width (`BROWSER_WIDTH`) or height (`BROWSER_HEIGHT`) is set to `null`, no default browser window size will be set on test startup.
- Don't hardcode timezone to `Europe/Prague`. Timezone is now used based on your PHP settings ([date.timezone](http://php.net/manual/en/datetime.configuration.php#ini.date.timezone)).
- Don't hardcode timezone to `Europe/Prague`. Timezone is now used based on your PHP settings ([date.timezone](https://php.net/manual/en/datetime.configuration.php#ini.date.timezone)).
- Server URL now must be provided including URL prefix (if it has one, like `/wd/hub`) - eg. `http://foo.bar:4444/wd/hub`. This means the `/wd/hub` part is now never auto-amended.
- Package `symfony/polyfill-mbstring` now provides mbstring functions even if PHP mbstring extension is not installed.

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Total Downloads](https://img.shields.io/packagist/dt/lmc/steward.svg?style=flat-square)](https://packagist.org/packages/lmc/steward)

Steward is a set of libraries made to simplify writing and running robust functional system tests in
[PHPUnit](https://phpunit.de/) using [Selenium WebDriver](http://www.seleniumhq.org/).
[PHPUnit](https://phpunit.de/) using [Selenium WebDriver](https://www.selenium.dev/).

## What's great about Steward?
- It allows you to start writing complex test cases in a minute.
Expand All @@ -26,17 +26,17 @@ Steward is a set of libraries made to simplify writing and running robust functi
- You can extend Steward easily by registering custom events to EventDispatcher.
- For example if you can add custom configuration options or change parameters passed to child PHPUnit processes.
- Cloud services like [Sauce Labs](https://saucelabs.com/), [BrowserStack](https://www.browserstack.com/) or [TestingBot](https://testingbot.com/) are fully integrated giving you a chance to run tests with less setup and without your own infrastructure.
- Steward is field tested - we use it daily in [our company](https://www.lmc.eu/english) to maintain the quality of our products thanks to hundreds of test-cases. The library itself is also extensively covered by unit tests.
- Steward is built on solid foundations: [WebDriver](http://www.w3.org/TR/webdriver/) is W3C draft standard for browser automation,
- Steward is field tested - we use it daily in [our company](https://www.lmc.eu/en/) to maintain the quality of our products thanks to hundreds of test-cases. The library itself is also extensively covered by unit tests.
- Steward is built on solid foundations: [WebDriver](https://www.w3.org/TR/webdriver/) is W3C draft standard for browser automation,
[php-webdriver](https://github.com/php-webdriver/php-webdriver) is the most used and developed Selenium language binding for PHP,
[PHPUnit](https://phpunit.de/) is a well known and widely used testing framework, and
[Symfony Console](http://symfony.com/doc/current/components/console.html) is industry standard for PHP CLI applications.
[Symfony Console](https://symfony.com/doc/current/components/console.html) is industry standard for PHP CLI applications.

## Example usage
To see how to use and extend Steward, have a look at our [example project](https://github.com/lmc-eu/steward-example).

## Changelog
For the latest changes see the [CHANGELOG.md](CHANGELOG.md) file. We follow [Semantic Versioning](http://semver.org/).
For the latest changes see the [CHANGELOG.md](./CHANGELOG.md) file. We follow [Semantic Versioning](https://semver.org/).

## Getting started
### 1. Install Steward
Expand Down Expand Up @@ -77,7 +77,7 @@ in our wiki for more information.
### 3. Write the first test
To provide you with Steward functionality, your tests have to extend the `Lmc\Steward\Test\AbstractTestCase` class.

You must also configure [PSR-4 autoloading](http://www.php-fig.org/psr/psr-4/) so that your tests could be found by
You must also configure [PSR-4 autoloading](https://www.php-fig.org/psr/psr-4/) so that your tests could be found by
Steward. It is as easy as adding the following to your `composer.json` file:

```json
Expand Down Expand Up @@ -105,7 +105,7 @@ class TitlePageTest extends AbstractTestCase
public function testShouldContainSearchInput()
{
// Load the URL (will wait until page is loaded)
$this->wd->get('http://www.w3.org/'); // $this->wd holds instance of \RemoteWebDriver
$this->wd->get('https://www.w3.org/'); // $this->wd holds instance of \RemoteWebDriver

// Do some assertion
$this->assertContains('W3C', $this->wd->getTitle());
Expand Down Expand Up @@ -146,7 +146,7 @@ Now that Selenium Server is listening, let's launch your test! Use the `run` co
./vendor/bin/steward run staging firefox
```

In a few moments you should see a Firefox window appear, then the http://www.w3.org/ site (as defined in the example tests)
In a few moments you should see a Firefox window appear, then the https://www.w3.org/ site (as defined in the example tests)
should be loaded before the window instantly closes. See the output of the command to check the test result.

The `run` command has two required arguments: the name of the environment and the browser:
Expand Down Expand Up @@ -195,7 +195,7 @@ File `timeline.html` will then be generated into the `logs/` directory.
![Example timeline visualization](https://lmc-eu.github.io/steward/images/timeline.png)

## License
Steward is open source software licensed under the [MIT license](LICENCE.md).
Steward is open source software licensed under the [MIT license](./LICENCE.md).

[wiki-docker]: https://github.com/lmc-eu/steward/wiki/Selenium-server-&-browser-drivers#option-2-start-selenium-server--browser-inside-docker-
[wiki-debugging]: https://github.com/lmc-eu/steward/wiki/Debugging-Selenium-tests-with-Steward
Expand Down
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,13 @@
"all": [
"@lint",
"@analyze",
"@codestyle:check",
"@test"
],
"analyze": [
"vendor/bin/ecs check src/ src-tests/ --ansi",
"vendor/bin/phpstan analyze -c phpstan.neon --ansi"
],
"codestyle:check": [
"vendor/bin/ecs check src/ src-tests/ --ansi"
],
"codestyle:fix": [
"fix": [
"@composer normalize",
"vendor/bin/ecs check src/ src-tests/ --ansi --fix"
],
Expand Down

0 comments on commit d32ff98

Please sign in to comment.