Commit 054e65fb authored by Tobias Munk's avatar Tobias Munk

updated tests & added tests target

parent 0cf98f5a
Pipeline #6248 failed with stages
......@@ -20,7 +20,7 @@ else
DOCKER_HOST_IP ?= 127.0.0.1
endif
.PHONY: help default all open bash build setup clean update run-tests TEST STAGE
.PHONY: help default all open bash build setup clean update tests clean-tests run-tests TEST STAGE
default: help
......@@ -58,6 +58,10 @@ clean: ##@docker remove application containers
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) rm -fv
tests:
$(MAKE) build
$(MAKE) TEST setup up clean-tests run-tests
clean-tests:
$(DOCKER_COMPOSE) run --rm $(PHP_SERVICE) sh -c 'codecept clean'
......
<?php
use tests\codeception\_pages\AboutPage;
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that about works');
AboutPage::openBy($I);
$I->see('About', 'h1');
<?php
use tests\codeception\_pages\ContactPage;
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that contact works');
$contactPage = ContactPage::openBy($I);
$I->see('Contact', 'h1');
$I->amGoingTo('submit contact form with no data');
$contactPage->submit([]);
$I->expectTo('see validations errors');
$I->wait(1);
$I->see('Contact', 'h1');
$I->see('Name cannot be blank');
$I->see('Email cannot be blank');
$I->see('Subject cannot be blank');
$I->see('Body cannot be blank');
$I->see('The verification code is incorrect');
$I->amGoingTo('submit contact form with not correct email');
$contactPage->submit([
'name' => 'tester',
'email' => 'tester.email',
'subject' => 'test subject',
'body' => 'test content',
'verifyCode' => 'testme',
]);
$I->expectTo('see that email adress is wrong');
$I->wait(1);
$I->dontSee('Name cannot be blank', '.help-inline');
$I->see('Email is not a valid email address.');
$I->dontSee('Subject cannot be blank', '.help-inline');
$I->dontSee('Body cannot be blank', '.help-inline');
$I->dontSee('The verification code is incorrect', '.help-inline');
$I->amGoingTo('submit contact form with correct data');
$contactPage->submit([
'name' => 'tester',
'email' => 'tester@example.com',
'subject' => 'test subject',
'body' => 'test content',
'verifyCode' => 'testme',
]);
$I->wait(3);
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
......@@ -2,10 +2,8 @@
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that home page works');
$I->wantTo('ensure that home page is not visible without login');
$I->amOnPage(Yii::$app->homeUrl);
$I->see(getenv('APP_NAME'));
$I->seeLink('About');
$I->click('About');
$I->see('This is the About page.');
$I->dontSee(getenv('APP_NAME'));
$I->seeLink('Login');
$I->makeScreenshot('home');
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