Exemplo n.º 1
0
 public function testGroup(FunctionalTester $I)
 {
     $I->wantTo('ensure that setting works');
     $I->amOnPage(Url::to(['/setting/group', 'id' => 'general']));
     $I->see('General Settings', 'h1');
     $I->amGoingTo('update site title and tag line');
     $I->fillField('input[name="Option[sitetitle][option_value]"]', 'My New Website');
     $I->fillField('input[name="Option[tagline][option_value]"]', 'My New Website Tagline');
     $I->click('Save');
     $I->expectTo('see success message');
     $I->see('Settings successfully saved.');
     Option::up('sitetitle', 'WritesDown');
     Option::up('tagline', 'CMS Built with Yii Framework');
 }
Exemplo n.º 2
0
 /**
  * @param FunctionalTester $I
  */
 public function testSelectMenu(FunctionalTester $I)
 {
     $I->wantTo('ensure that select menu works');
     IndexPage::openBy($I);
     $I->see('Menus', 'h1');
     $I->see('Menu Primary', 'h2');
     $I->amGoingTo('submit select menu to Menu Secondary');
     $I->selectOption('#select-menu-list', 'Menu Secondary');
     $I->click('Select', '#select-menu-form');
     $I->expectTo('see Menu Secondary');
     $I->see('Menu Secondary', 'h2');
     $I->click('Save');
     $I->see('Menu successfully saved.', '.alert');
 }
Exemplo n.º 3
0
 /**
  * @param FunctionalTester $I
  */
 public function testDetail(FunctionalTester $I)
 {
     $I->wantTo('ensure that detail theme works');
     $I->amOnPage(Url::to(['/theme/detail', 'theme' => 'writesdown']));
     $I->see('Detail Theme', 'h1');
     $I->see('Name');
     $I->see('Author');
 }
Exemplo n.º 4
0
 /**
  * @param FunctionalTester $I
  */
 public function testCreate(FunctionalTester $I)
 {
     $I->wantTo('ensure that create widget works');
     $I->amOnPage(Url::to(['/widget/create']));
     $I->see('Add New Widget', 'h1');
     $I->see('Upload New Widget');
     $I->see('Upload', '#widget-create-form');
 }
Exemplo n.º 5
0
 /**
  * @param FunctionalTester $I
  */
 public function testUpdate(FunctionalTester $I)
 {
     $I->wantTo('ensure that update page works');
     $updatePage = UpdatePage::openBy($I);
     $I->see('Update Module: sitemap', 'h1');
     $I->seeLink('Basic', '#');
     $I->seeLink('Frontend', '#');
     $I->seeLink('Backend', '#');
     $I->amGoingTo('submit update module form with correct data');
     $I->checkOption('#module-status');
     $updatePage->submit(['name' => 'test', 'title' => 'Test']);
     $I->expect('module updated');
     $I->see('Modules', 'h1');
     $I->see('Test', '#module-grid-view');
     Module::findOne(2)->updateAttributes(['name' => 'sitemap', 'title' => 'Sitemap', 'status' => '0']);
 }
Exemplo n.º 6
0
<?php

use tests\codeception\backend\FunctionalTester;
use tests\codeception\backend\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('确保后台用户管理功能正常');
$loginPage = LoginPage::openBy($I);
$I->amGoingTo('使用正确的用户信息登录表单');
$loginPage->login('admin', 'admin');
$I->amOnPage(Yii::$app->getUrlManager()->createUrl('admin/index'));
$I->expectTo('看见用户管理界面');
$I->seeInTitle('用户管理');
Exemplo n.º 7
0
 /**
  * @param FunctionalTester $I
  */
 public function testResetPassword(FunctionalTester $I)
 {
     $I->wantTo('ensure that reset password works');
     $resetPasswordPage = ResetPasswordPage::openBy($I);
     $I->see('Please choose your new password:'******'p');
     $I->amGoingTo('submit password form with no data');
     $resetPasswordPage->submit([]);
     $I->expectTo('see validation error');
     $I->see('Password cannot be blank', '.help-block');
     $I->amGoingTo('submit password form with no correct data');
     $resetPasswordPage->submit(['password' => '1234x']);
     $I->expectTo('see that password is not valid');
     $I->see('Password should contain at least 6 characters.', '.help-block');
     $I->amGoingTo('submit password form with valid data');
     $resetPasswordPage->submit(['password' => 'my.new.password']);
     $I->expect('new password saved');
     $I->see('New password was saved.');
     User::findOne(6)->updateAttributes(['auth_key' => '89jQUg-3NpEgvmXgzs1OWXoILe4sJwi1', 'password_hash' => '$2y$13$NdYAATL.ACEqOmAX6cL1B.ZBZ2pUstB.xMjqFcLrR1ldbHG9yXgwa']);
 }
Exemplo n.º 8
0
<?php

use tests\codeception\backend\FunctionalTester;
use tests\codeception\common\_pages\common\LoginPage;
/* @var $scenario Codeception\Scenario */
$I = new FunctionalTester($scenario);
$I->wantTo('ensure login page works');
$loginPage = LoginPage::openBy($I);
$I->amGoingTo('submit login form with no data');
$loginPage->login('', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');
$I->amGoingTo('try to login with wrong credentials');
$I->expectTo('see validations errors');
$loginPage->login('admin', 'wrong');
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.', '.help-block');
$I->amGoingTo('try to login with correct credentials');
$loginPage->login('erau', 'password_0');
$I->expectTo('see that user is logged');
$I->seeLink('Logout (erau)');
$I->dontSeeLink('Login');
$I->dontSeeLink('Signup');
Exemplo n.º 9
0
 /**
  * @param FunctionalTester $I
  */
 public function testDelete(FunctionalTester $I)
 {
     $I->wantTo('ensure that delete media works');
     IndexPage::openBy($I);
     $I->see('Media', 'h1');
     $I->seeElement('a[href="' . Url::to(['/media/delete', 'id' => 1]) . '"]');
     // Delete only work for acceptance JS
 }
Exemplo n.º 10
0
 /**
  * @param FunctionalTester $I
  */
 public function testReply(FunctionalTester $I)
 {
     $I->wantTo('ensure that reply post-comment works');
     $replyPage = ReplyPage::openBy($I);
     $I->amGoingTo('reply post-comment with no content');
     $replyPage->submit();
     $I->expectTo('see validation error');
     $I->see('Content cannot be blank.', '.help-block');
     // Reply only work for acceptance $_POST['REMOTE_ADDR']
 }
Exemplo n.º 11
0
 /**
  * @param FunctionalTester $I
  */
 public function testDelete(FunctionalTester $I)
 {
     $I->wantTo('ensure that delete post-type works');
     IndexPage::openBy($I);
     $I->see('Post Types', 'h1');
     $I->seeElement('a[href="' . Url::to(['/post-type/delete', 'id' => 1]) . '"]');
     // Delete only works on acceptance test [JS]
 }
Exemplo n.º 12
0
 /**
  * @param FunctionalTester $I
  */
 public function testDeleteTerm(FunctionalTester $I)
 {
     $I->wantTo('ensure that delete term works');
     ViewPage::openBy($I);
     $I->see('View Taxonomy', 'h1');
     $I->seeElement('a[href="' . Url::to(['/taxonomy/delete-term', 'id' => 2, 'term' => 2]) . '"]');
     // Delete only work on acceptance [JS]
 }
Exemplo n.º 13
0
 /**
  * @param FunctionalTester $I
  */
 public function testResetPassword(FunctionalTester $I)
 {
     $I->wantTo('ensure that reset password works');
     $resetPassword = ResetPasswordPage::openBy($I);
     $I->see('Reset Password', 'h1');
     $I->amGoingTo('submit reset password form with empty data');
     $resetPassword->submit([]);
     $I->expectTo('see validation errors');
     $I->see('Old Password cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->see('Repeat Password cannot be blank.', '.help-block');
     $I->amGoingTo('submit reset password form with no correct old password');
     $resetPassword->submit(['password_old' => 'wrong_password', 'password' => 'my.new.password', 'password_repeat' => 'my.new.password']);
     $I->expectTo('see validations error');
     $I->see('The old password is not correct.', '.help-block');
     $I->amGoingTo('submit reset password form with correct data');
     $resetPassword->submit(['password_old' => 'administrator', 'password' => 'my.new.password', 'password_repeat' => 'my.new.password']);
     $I->expect('new password saved');
     $I->see('View User: administrator');
     User::findOne(2)->updateAttributes(['auth_key' => '0fQDfzYWWt_W4tHLv34YTEjP1Pk5zzRe', 'password_hash' => '$2y$13$lf03M5DAWI7qwJ3UWKq6ruAYdxRZj9RnNWqRhORY1xuFCTvbFFWv.']);
 }
Exemplo n.º 14
0
<?php

use tests\codeception\backend\FunctionalTester;
use tests\codeception\backend\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('确保后台登录正常工作');
$loginPage = LoginPage::openBy($I);
$I->amGoingTo('不输入信息直接提交登录表单');
$loginPage->login('', '');
$I->expectTo('看见验证错误信息');
$I->see('用户名不能为空', '.help-block');
$I->see('密码不能为空', '.help-block');
$I->amGoingTo('使用错误的密码提交登录表单');
$I->expectTo('看见验证错误信息');
$loginPage->login('admin', 'wrong');
$I->expectTo('看见验证错误信息');
$I->see('用户名或者密码错误', '.help-block');
$I->amGoingTo('使用正确的用户信息登录表单');
$loginPage->login('admin', 'admin');
$I->expectTo('用户登录成功');
$I->seeLink('[注销]');
$I->dontSeeInTitle('登录');