<?php /** @type Codeception\Scenario $scenario */ $scenario->groups(array('nonauthenticated', 'blog')); $I = new WebGuy\MemberSteps($scenario); $I->wantTo('Play with comments'); $I->amGoingTo('Be very stupid and leave comment several times until blog ' . 'will consider it correct'); $I->logout(); $I->amOnPage(\BlogFeedPage::$url); $I->click(\BlogFeedPage::$postTitleSelector); $I->see('text.commentThisPost'); $currentUrl = $I->grabFromCurrentUrl('~(.*)~'); $I->submitCommentForm(); $I->seeCurrentUrlMatches('~^' . $currentUrl . '~'); \PostPage::of($I)->hasErrors(); $I->submitCommentForm('tralalal'); $I->seeCurrentUrlMatches('~^' . $currentUrl . '~'); \PostPage::of($I)->hasErrors(); $I->submitCommentForm('Hey, look at my local email address!', 'marabou', 'marabou@localhost'); $I->seeCurrentUrlMatches('~^' . $currentUrl . '~'); \PostPage::of($I)->hasErrors(); // checking form saving $I->seeInField(\PostPage::$commentTextArea, 'Hey, look at my local email address!'); $I->seeInField(\PostPage::$commentUsernameField, 'marabou'); $I->seeInField(\PostPage::$commentEmailField, 'marabou@localhost'); $I->submitCommentForm('This is first correct comment', 'marabou', ''); $I->seeCurrentUrlMatches('~^' . $currentUrl . '~'); \PostPage::of($I)->hasNoErrors(); $I->see('This is first correct comment'); $I->submitCommentForm('Second correct comment, now using gravatar', 'marabou', '*****@*****.**'); $I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
<?php use Codeception\Util\Fixtures; /** @type \Codeception\Scenario $scenario */ $scenario->groups('auth', 'front'); $i = new \WebGuy\MemberSteps($scenario); $i->am('admin'); $i->wantTo('check auth mechanism'); $i->expect('login failure on invalid data and login success on valid data'); $i->logout(); $i->seeCurrentUrlEquals(\BlogFeedPage::$url); $i->seeAlert('auth.logout.guestAttempt'); $i->seeElement(\FeedPage::$loginLink); $i->click('link.login'); $i->seeCurrentUrlEquals(\LoginPage::$url); $i->login(null, null); $i->seeAlert('auth.login.fail'); $i->login('missing username', 'nonexisting password'); $i->seeAlert('auth.login.fail'); $i->autoLogin(); $i->see('auth.login.greeting'); $i->seeCurrentUrlEquals(\AdminPanelPage::$url); $i->amOnPage(\LoginPage::$url); $i->seeCurrentUrlEquals(\AdminPanelPage::$url); $i->seeAlert('auth.login.alreadyAuthorized'); $i->seeLink('link.logout'); $i->click('link.logout'); $i->seeCurrentUrlEquals(\BlogFeedPage::$url); //$i->canSee('You have successfully logged out');