コード例 #1
0
ファイル: FormCest.php プロジェクト: Barathi07/Netopeer-GUI
 public function _submitEmptyModuleForm(TestGuy $I)
 {
     $I->wantTo('submit empty module form test');
     $I->amOnPage('/sections/create-empty-module/0/');
     // remove root element
     $data['form'] = array('name' => 'notification', 'namespace' => 'urn:ietf:params:xml:ns:netconf:notification:1.0');
     $I->submitForm('form.create-empty-module', $data);
     // check what is in answer
     $I->see('block--state');
     $I->dontSee('500 Internal Server Error');
 }
コード例 #2
0
ファイル: HomeCept.php プロジェクト: pathman/yii-basic
<?php

$I = new TestGuy($scenario);
$I->wantTo('ensure that home page works');
$I->amOnPage('');
$I->see('My Company');
$I->seeLink('About');
$I->click('About');
$I->see('This is the About page.');
コード例 #3
0
ファイル: HomeCept.php プロジェクト: NikDevPHP/yii2-blog
<?php

$I = new TestGuy($scenario);
$I->wantTo('保证site/index页面正常工作');
$I->amOnPage(Yii::$app->homeUrl);
$I->seeLink('Yii2 Blog');
$I->seeLink('首页');
$I->seeLink('yii2-blog说明');
$I->click('yii2-blog说明');
$I->see('yii2-blog说明');
コード例 #4
0
<?php

use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('front', 'user-management');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->wantTo('Delete my account');
$I->expectTo('Lose ability to sign in under my regular account and all my posts');
$login = Fixtures::get('data:users[0]:login');
$password = Fixtures::get('data:users[0]:password');
$I->amOnPage(\AuthorFeedPage::route(1));
// confirming that test landed on required page
$I->see($login, \AuthorFeedPage::$postSelector);
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => $login, \LoginPage::$passwordField => $password));
$I->amOnPage(\SuicideBoothPage::$url);
$I->click(\SuicideBoothPage::$benderButtonXPath);
$I->seeCurrentUrlEquals('/');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => $login, \LoginPage::$passwordField => $password));
$I->see('auth.login.fail');
$I->amOnPage(\AuthorFeedPage::route(1));
$I->see('pageTitle.site.error', \AuthorFeedPage::$pageHeaderSelector);
$I->seeResponseCodeIs(404);
$h = fopen(\Yii::getPathOfAlias('application.runtime.login'), 'a');
fwrite($h, $login . PHP_EOL);
fclose($h);
$I->assertNull(\User::findByUsername($login, false));
$I->assertEmpty(\Post::model()->with(array('author' => array('condition' => 'author.username = :login', 'params' => array(':login' => $login))))->findAll());
コード例 #5
0
ファイル: PedanticCept.php プロジェクト: DavBfr/BlogMVC
// Most idiotic cept ever
// Checks that every page has correct translation and correct access control
// That means that it has to be updated nearly on every sneeze
use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('front');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->am('A superpedantic person');
$I->wantTo('Find translation error or improper "back to" link');
$I->expectTo('Fail in my quest');
$languages = array('en', 'ru');
$basePath = \Yii::getPathOfAlias('application.tests._data.pageData');
$privatePages = (require $basePath . '/pages-auth.php');
$publicPages = (require $basePath . '/pages-public.php');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => Fixtures::get('data:users[0]:login'), \LoginPage::$passwordField => Fixtures::get('data:users[0]:password')));
foreach ($languages as $language) {
    \Yii::app()->language = $language;
    $I->setCookie('language', $language);
    $path = $basePath . '/language-' . $language . '.php';
    $data = (require $path);
    foreach ($data as $url => $details) {
        $I->amOnPage($url);
        if (isset($details['title'])) {
            $I->seeInTitle($details['title']);
        }
        if (isset($details['nav'])) {
            foreach ($details['nav'] as $navItem) {
                $I->see($navItem, \GeneralPage::$pageHeaderNavigationSelector);
            }
コード例 #6
0
ファイル: RedirectCept.php プロジェクト: pklink/hahns
<?php

/* @var \Codeception\Scenario $scenario */
$I = new TestGuy($scenario);
$I->wantTo('check redirections');
$I->sendGET('/redirect');
$I->seeResponseCodeIs(404);
$I->amOnPage('/redirected');
コード例 #7
0
ファイル: NicknameUpdateCept.php プロジェクト: DavBfr/BlogMVC
<?php

use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('internals', 'content', 'update');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->am('Dr. Jan Itor');
$I->wantTo('Update my nickname and see fancy cascade of nickname update in ' . 'previous comments');
$login = Fixtures::get('data:users[0]:login');
$password = Fixtures::get('data:users[0]:password');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => $login, \LoginPage::$passwordField => $password));
$I->amOnPage(\BlogFeedPage::$url);
$I->click(\BlogFeedPage::$postTitleSelector);
$url = $I->grabFromCurrentUrl();
$I->submitForm(\PostPage::$commentForm, array(\PostPage::$commentTextArea => 'sample comment'));
$newUsername = md5(microtime());
$I->amOnPage(\ProfilePage::$url);
$I->submitForm(\ProfilePage::$usernameUpdateFormSelector, array(\ProfilePage::$usernameField => $newUsername));
$I->see('profile.usernameUpdate.success');
$I->amOnPage($url);
$I->seeLink('@' . $newUsername);
\Yii::app()->fixtureManager->prepare();
コード例 #8
0
<?php

$I = new TestGuy($scenario);
$I->wantTo('Verify that the home page wellcome me');
$I->amOnPage('/');
$I->see('Log In with Github');
$I->click('Log In with Github');
$I->see('Profile');
コード例 #9
0
<?php

$I = new TestGuy($scenario);
$I->wantTo('test index page is working');
$I->amOnPage('/');
$I->canSee('Congratulations!');
$I->amOnPage('/index/foo');
$I->canSee('Session: bar');
$I->canSee('Cookies: bar');
コード例 #10
0
<?php

use yii\helpers\Url;
use hipstercreative\user\models\User;
$I = new TestGuy($scenario);
$I->wantTo('ensure that confirmation works');
$I->amGoingTo('check that error is showed when token expired');
$user = $I->getFixture('user')->getModel('unconfirmed_with_expired_token');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $user->id, 'token' => $user->confirmation_token]));
$I->see('Confirmation token is invalid');
$I->amGoingTo('check that user get confirmed');
$user = $I->getFixture('user')->getModel('unconfirmed');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $user->id, 'token' => $user->confirmation_token]));
$I->see('Your account has been confirmed');
$I->seeRecord(User::className(), ['id' => $user->id, 'confirmation_token' => null, 'confirmation_sent_at' => null]);
コード例 #11
0
ファイル: AboutCept.php プロジェクト: pathman/yii-basic
<?php

$I = new TestGuy($scenario);
$I->wantTo('ensure that about works');
$I->amOnPage('?r=site/about');
$I->see('About', 'h1');
コード例 #12
0
ファイル: CacheCept.php プロジェクト: EhteshamMehmood/BlogMVC
<?php

/** @type \Codeception\Scenario $scenario */
$scenario->groups('cache', 'front');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->wantTo('Verify that sidebar is updated correctly');
$sidebarVariations = array('ru' => array('Категории', 'Последние записи'), 'en' => array('Categories', 'Last posts'));
foreach ($sidebarVariations as $language => $headings) {
    \Yii::app()->cacheHelper->invalidatePostsCache();
    $I->amOnPage(\BlogFeedPage::$url . '?language=' . $language);
    foreach ($headings as $heading) {
        $I->see($heading, \BlogFeedPage::$sidebarSelector);
    }
}
コード例 #13
0
ファイル: ContactCept.php プロジェクト: pathman/yii-basic
<?php

$I = new TestGuy($scenario);
$I->wantTo('ensure that contact works');
$I->amOnPage('?r=site/contact');
$I->see('Contact', 'h1');
$I->submitForm('#contact-form', []);
$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->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => 'tester.email', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']);
$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->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => '*****@*****.**', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']);
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');