Commit 909dbdec authored by Christian Keuerleber's avatar Christian Keuerleber
Browse files

TASK: add database steps to registration test

parent 2ebce832
Pipeline #7800 failed with stages
in 18 seconds
......@@ -13,4 +13,85 @@ typo3.org frontend users.
## Service Documentation
Accountdata are documentated in a restricted project:
https://git-t3o.typo3.org/services/my.typo3.org/blob/master/README.md
\ No newline at end of file
https://git-t3o.typo3.org/services/my.typo3.org/blob/master/README.md
## Acceptance Tests
### Concepts
The acceptance tests run in their own environment. In this environment we import a basic database via codeception
to have a working site and add new data per test via yaml files and steps provided by the
`punktde/codeception-database` package. When a yaml file is imported via the gherkin step, every database table
found in the yaml file is truncated before the new data is imported.
In `extensions/t3omy_test/Tests/acceptance.suite.yml` the config for the database module can be found. We have set
`populate` and `reset` to true, so before running any test and between every test the command given as the config
option `populator` is run. If no `populator` is given, the `dumpFile` is imported.
### Dependencies
* composer
* chrome/chromium
* chromedriver/chromiumdriver (e.g. `brew cask install chromedriver`)
At the moment (Nov 4th 2019) GeckoDriver and FireFox testing is only possible by using the detour via selenium,
and even then it's not really reliable.
### Run codeception tests
#### Start chromedriver
In one terminal window, start the chromedriver and leave it running. Port 4444 and url-base `/wd/hub` are taken from
old selenium standards and are default in codeception.
```
chromedriver --url-base=/wd/hub --port=4444
```
#### Run the tests
```
vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance
```
With `--steps`, all run steps are outputted to the command line. All errors are reported even if you don't use the
flag. You can also add `--xml` as a flag to get JUnit compatible output.
If you get errors, you can find the output in the directory `extensions/t3omy_test/Tests/_output`. In there is a list of failed tests and
a screenshot and the html output of the page the moment a test failed.
##### Single feature
To run a single feature just add the path to the feature file to your command, e.g.
```
vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance extensions/t3omy_test/Tests/acceptance/Features/Login.feature
```
You can also run single scenarios by providing line numbers, e.g.
```
vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance extensions/t3omy_test/Tests/acceptance/Features/Login.feature:10
```
### Writing tests
The acceptance tests are put into the directory `extensions/t3omy_test/Tests/acceptance/Feature`. You can use any folder structure to
group your tests.
To get all the available step definitions just run the command
```
vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml gherkin:steps acceptance
```
which outputs the steps added to the project.
To add new steps, just write the new step in your `.feature` file and run
```
vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml gherkin:snippets acceptance
```
This will output a function stub with the proper step definition phpdoc. Put this in a appropriate `ActorTrait`
and (if needed) add the `ActorTrait` to the `AcceptanceTester` (`Tests/_support/AcceptanceTester.php`). Example
traits can be found in the directory `Classes/ActorTraits/` of the `punktde/codeception-*` packages.
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d5effc11ad84428f887e32a2c57353ca",
"content-hash": "a219d1a8b9f09d4fa0158e440f40e29d",
"packages": [
{
"name": "adoy/fastcgi-client",
......@@ -5920,6 +5920,40 @@
],
"time": "2019-08-09T12:45:53+00:00"
},
{
"name": "neos/error-messages",
"version": "6.0.3",
"source": {
"type": "git",
"url": "https://github.com/neos/error-messages.git",
"reference": "0376f1bb3faaf799964e9bfa309e616297411ed4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/neos/error-messages/zipball/0376f1bb3faaf799964e9bfa309e616297411ed4",
"reference": "0376f1bb3faaf799964e9bfa309e616297411ed4",
"shasum": ""
},
"require": {
"php": "^7.2"
},
"require-dev": {
"phpunit/phpunit": "~8.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Neos\\Error\\Messages\\": "Classes"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Flow error messages",
"homepage": "http://flow.neos.io",
"time": "2019-08-23T12:59:25+00:00"
},
{
"name": "neos/utility-arrays",
"version": "6.0.3",
......@@ -5961,6 +5995,47 @@
"homepage": "http://flow.neos.io",
"time": "2019-08-08T08:09:04+00:00"
},
{
"name": "neos/utility-files",
"version": "6.0.3",
"source": {
"type": "git",
"url": "https://github.com/neos/utility-files.git",
"reference": "bee92ab32faa855f18ffa6bcbcb9ab0775d2773a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/neos/utility-files/zipball/bee92ab32faa855f18ffa6bcbcb9ab0775d2773a",
"reference": "bee92ab32faa855f18ffa6bcbcb9ab0775d2773a",
"shasum": ""
},
"require": {
"neos/error-messages": "*",
"php": "^7.2"
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
"phpunit/phpunit": "~8.1"
},
"type": "library",
"extra": {
"neos": {
"package-key": "Neos.Utility.Files"
}
},
"autoload": {
"psr-4": {
"Neos\\Utility\\": "Classes"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Flow Files Utilities",
"homepage": "http://flow.neos.io",
"time": "2019-08-08T08:09:04+00:00"
},
{
"name": "neos/utility-objecthandling",
"version": "6.0.3",
......@@ -6684,16 +6759,16 @@
},
{
"name": "punktde/codeception-database",
"version": "1.1.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/punktDe/codeception-database.git",
"reference": "e0cec6b321aa4d4509e479250516efe0ec324034"
"reference": "45ee7683252bf073b80fc869ade0f83063e85a69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/punktDe/codeception-database/zipball/e0cec6b321aa4d4509e479250516efe0ec324034",
"reference": "e0cec6b321aa4d4509e479250516efe0ec324034",
"url": "https://api.github.com/repos/punktDe/codeception-database/zipball/45ee7683252bf073b80fc869ade0f83063e85a69",
"reference": "45ee7683252bf073b80fc869ade0f83063e85a69",
"shasum": ""
},
"require-dev": {
......@@ -6712,7 +6787,7 @@
"GPL-3.0-or-later"
],
"description": "Provides a module and gherkin steps to use databases for codeception testing",
"time": "2019-11-03T18:52:10+00:00"
"time": "2019-11-04T15:34:55+00:00"
},
{
"name": "punktde/codeception-filesystem",
......
This diff is collapsed.
<?php
use PunktDe\Codeception\Database\ActorTraits\Database;
use PunktDe\Codeception\Mailhog\ActorTraits\Mailhog;
use PunktDe\Codeception\Webdriver\ActorTraits\Webdriver;
......@@ -25,4 +26,5 @@ class AcceptanceTester extends \Codeception\Actor
use Webdriver;
use Mailhog;
use Database;
}
......@@ -17,9 +17,16 @@ modules:
capabilities:
chromeOptions:
args:
# - '--headless'
# - '--disable-gpu'
- '--headless'
- '--disable-gpu'
- '--disable-dev-shm-usage'
- '--no-sandbox'
- PunktDe\Codeception\Database\Module\Database:
dsn: 'mysql:host=127.0.0.1;dbname=db;port=32771;charset=UTF8'
user: 'db'
password: 'db'
dump: '../Resources/Private/Dumps/Fixture.sql'
populate: true
cleanup: true
- \Helper\Acceptance
step_decorators: ~
......@@ -5,6 +5,7 @@ Feature:
Background:
Given I clear my inbox
And dataset "../Tests/acceptance/Features/Registration/EmptyFeUsers.yaml" is imported
Scenario: Registration workflow
Given I am on "/"
......@@ -27,4 +28,8 @@ Feature:
And the inbox contains 1 mails
When I follow "sign-up" in the email
Then I should see "Double confirmation needed"
And the database table "fe_users" should contain
| pid | username | usergroup | disable | name | email | tx_femanager_confirmedbyuser | tx_femanager_confirmedbyadmin |
| 5 | my_testuser | 1 | 1 | Little Miss Sunshine | test@localhost.localdomain | 1 | 0 |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment