Add mailhog to infrastructure for testing

This commit is contained in:
Daniel Siepmann 2019-08-27 08:58:34 +02:00
parent e88fcf02b1
commit 814fb2a0d1
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
8 changed files with 121 additions and 2 deletions

View file

@ -24,6 +24,7 @@ test:acceptance:
stage: test stage: test
services: services:
- mysql:5.7 - mysql:5.7
- mailhog/mailhog:v1.0.0
- selenium/standalone-chrome - selenium/standalone-chrome
variables: variables:
MYSQL_ROOT_PASSWORD: "dev" MYSQL_ROOT_PASSWORD: "dev"

View file

@ -12,6 +12,10 @@ if ((string) $appContext === 'Testing/Acceptance') {
'SYS' => [ 'SYS' => [
'trustedHostsPattern' => 'localhost:8080', 'trustedHostsPattern' => 'localhost:8080',
], ],
'MAIL' => [
'transport' => 'smtp',
'transport_smtp_server' => '127.0.0.1:1025',
],
'DB' => [ 'DB' => [
'Connections' => [ 'Connections' => [
'Default' => [ 'Default' => [
@ -29,6 +33,10 @@ if ((string) $appContext === 'Testing/Acceptance' && getenv('CI') === 'true') {
'SYS' => [ 'SYS' => [
'trustedHostsPattern' => getenv('TESTING_DOMAIN'), 'trustedHostsPattern' => getenv('TESTING_DOMAIN'),
], ],
'MAIL' => [
'transport' => 'smtp',
'transport_smtp_server' => 'mailhog__mailhog:1025',
],
'DB' => [ 'DB' => [
'Connections' => [ 'Connections' => [
'Default' => [ 'Default' => [

View file

@ -11,6 +11,10 @@ suites:
dump: tests/_data/typo3.sql dump: tests/_data/typo3.sql
populate: true populate: true
cleanup: true cleanup: true
- MailHog:
url: http://127.0.0.1
port: 8025
deleteEmailsAfterScenario: true
- \Helper\Acceptance - \Helper\Acceptance
step_decorators: step_decorators:
- Codeception\Step\ConditionalAssertion - Codeception\Step\ConditionalAssertion

View file

@ -32,7 +32,8 @@
"require-dev": { "require-dev": {
"typo3/cms-lowlevel": "*", "typo3/cms-lowlevel": "*",
"codeception/codeception": "^3.1.0", "codeception/codeception": "^3.1.0",
"typo3/testing-framework": "^4.11" "typo3/testing-framework": "^4.11",
"ericmartel/codeception-email-mailhog": "^1.0"
}, },
"config": { "config": {
"platform": { "platform": {

72
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5770c0e541ee89e208e3aa77b5eeabb7", "content-hash": "b11be7cdad4ce0e81c2f13a90d3a32e5",
"packages": [ "packages": [
{ {
"name": "algo26-matthias/idna-convert", "name": "algo26-matthias/idna-convert",
@ -4203,6 +4203,76 @@
"description": "Flexible Stub wrapper for PHPUnit's Mock Builder", "description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
"time": "2019-08-10T16:20:53+00:00" "time": "2019-08-10T16:20:53+00:00"
}, },
{
"name": "ericmartel/codeception-email",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/ericmartel/codeception-email.git",
"reference": "a53370c349467af06a245110014667c3a432e6b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ericmartel/codeception-email/zipball/a53370c349467af06a245110014667c3a432e6b8",
"reference": "a53370c349467af06a245110014667c3a432e6b8",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Codeception\\Email\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric Martel",
"email": "emartel@gmail.com"
}
],
"description": "Provides test helpers for Codeception when testing email functionality",
"time": "2017-09-05T17:02:06+00:00"
},
{
"name": "ericmartel/codeception-email-mailhog",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/ericmartel/codeception-email-mailhog.git",
"reference": "5aa917bf97c5a228ef5cba90741cf3b7ff373ea7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ericmartel/codeception-email-mailhog/zipball/5aa917bf97c5a228ef5cba90741cf3b7ff373ea7",
"reference": "5aa917bf97c5a228ef5cba90741cf3b7ff373ea7",
"shasum": ""
},
"require": {
"ericmartel/codeception-email": "^1.0",
"guzzlehttp/guzzle": "^6.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Codeception\\Module\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric Martel",
"email": "emartel@gmail.com"
}
],
"description": "Provides test helpers for Codeception when testing email functionality with MailHog",
"time": "2017-11-25T04:16:18+00:00"
},
{ {
"name": "facebook/webdriver", "name": "facebook/webdriver",
"version": "1.7.1", "version": "1.7.1",

View file

@ -8,6 +8,9 @@ class AddressCest
$I->see('Codappix GmbH'); $I->see('Codappix GmbH');
} }
/**
* @depends listsExistingRecords
*/
public function canEditRecord(AcceptanceTester $I) public function canEditRecord(AcceptanceTester $I)
{ {
$I->amOnPage('/plugin'); $I->amOnPage('/plugin');
@ -22,6 +25,32 @@ class AddressCest
$I->see('TYPO3 Camp Rhein Ruhr'); $I->see('TYPO3 Camp Rhein Ruhr');
} }
/**
* @depends canEditRecord
*/
public function sendsMailOnUpdate(AcceptanceTester $I)
{
$I->amOnPage('/plugin');
$I->see('Edit');
$I->click('Edit');
$I->see('Editing: Codappix GmbH');
$I->fillField(['id' => 'companyName'], 'TYPO3 Camp Rhein Ruhr');
$I->click('Update');
$I->fetchEmails();
$I->haveUnreadEmails();
$I->openNextUnreadEmail();
$I->dontHaveUnreadEmails();
$I->seeInOpenedEmailSubject('Address TYPO3 Camp Rhein Ruhr was updated');
$I->seeInOpenedEmailBody('The address TYPO3 Camp Rhein Ruhr was successfully updated.');
$I->seeInOpenedEmailRecipients('coding@daniel-siepmann.de');
}
/**
* @depends listsExistingRecords
*/
public function zipValidatesAgainst5Digits(AcceptanceTester $I) public function zipValidatesAgainst5Digits(AcceptanceTester $I)
{ {
$I->amOnPage('/plugin'); $I->amOnPage('/plugin');

View file

@ -7,3 +7,6 @@ modules:
dsn: 'mysql:host=mysql;dbname=dev' dsn: 'mysql:host=mysql;dbname=dev'
user: 'dev' user: 'dev'
password: 'dev' password: 'dev'
MailHog:
url: http://mailhog__mailhog
port: 8025

View file

@ -6,3 +6,6 @@ modules:
dsn: 'mysql:host=localhost;dbname=own_workshopgitlabacceptance_testing' dsn: 'mysql:host=localhost;dbname=own_workshopgitlabacceptance_testing'
user: 'dev' user: 'dev'
password: 'dev' password: 'dev'
MailHog:
url: http://127.0.0.1
port: 8025