예제 #1
0
 /**
  * @param AcceptanceTester $I
  */
 public function testDelete(AcceptanceTester $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]) . '"]');
     if (method_exists($I, 'acceptPopup') && method_exists($I, 'wait')) {
         $I->click('a[href="' . Url::to(['/media/delete', 'id' => 1]) . '"]');
         $I->acceptPopup();
         $I->wait(3);
         $I->dontSee('Test Media', '#media-grid-view');
         $this->loadFixtures();
     }
 }
예제 #2
0
 /**
  * @param AcceptanceTester $I
  */
 public function testCreate(AcceptanceTester $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');
     $I->amGoingTo('submit widget form without zip file');
     $I->click('Upload', '#widget-create-form');
     if (method_exists($I, 'wait')) {
         $I->wait(3);
     }
     $I->expectTo('see validation errors');
     $I->see('Widget (ZIP) cannot be blank.', '.help-block');
 }
예제 #3
0
 /**
  * @param AcceptanceTester $I
  */
 public function testCreate(AcceptanceTester $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');
     $I->amGoingTo('submit widget form without zip file');
     $I->click('Upload', '#widget-create-form');
     if (method_exists($I, 'wait')) {
         $I->wait(3);
     }
     $I->expect('the widget not successfully uploaded');
     $I->dontSee('Widgets', 'h1');
 }
예제 #4
0
 public function testGroup(AcceptanceTester $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][value]"]', 'My New Website');
     $I->fillField('input[name="Option[tagline][value]"]', 'My New Website Tagline');
     $I->click('Save');
     if (method_exists($I, 'wait')) {
         $I->wait(3);
     }
     $I->expectTo('see success message');
     $I->see('Settings successfully saved.');
     Option::up('sitetitle', 'WritesDown');
     Option::up('tagline', 'CMS Built with Yii Framework');
 }
예제 #5
0
 /**
  * @param AcceptanceTester $I
  */
 public function testDetail(AcceptanceTester $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');
 }
예제 #6
0
 /**
  * @param AcceptanceTester $I
  */
 public function testDeleteTerm(AcceptanceTester $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]) . '"]');
     if (method_exists($I, 'acceptPopup') && method_exists($I, 'wait')) {
         $I->click('a[href="' . Url::to(['/taxonomy/delete-term', 'id' => 2, 'term' => 2]) . '"]');
         $I->acceptPopup();
         $I->wait(3);
         $I->dontSee('Sample Tag', '#term-grid-view');
         $this->loadFixtures();
     }
 }
예제 #7
0
 /**
  * @param AcceptanceTester $I
  */
 public function testResetPassword(AcceptanceTester $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']);
 }
예제 #8
0
<?php

use tests\codeception\backend\AcceptanceTester;
use tests\codeception\common\_pages\LoginPage;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure login page works');
$loginPage = LoginPage::openBy($I);
$I->amGoingTo('submit login form with no data');
$loginPage->login('', '');
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$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');
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$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');
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
예제 #9
0
 /**
  * @param AcceptanceTester $I
  */
 public function testReply(AcceptanceTester $I)
 {
     $I->wantTo('ensure that reply media-comment works');
     $replyPage = ReplyPage::openBy($I);
     $I->amGoingTo('reply media-comment with no content');
     $replyPage->submit('');
     $I->expectTo('see validation error');
     $I->see('Content cannot be blank.', '.help-block');
     $I->amGoingTo('reply media-comment with no empty content');
     $replyPage->submit('Test reply media-comment');
     $I->expect('the reply saved');
     $I->see('Update Media Comment 2', 'h1');
     MediaComment::deleteAll(['content' => 'Test reply media-comment']);
 }
예제 #10
0
파일: UserCest.php 프로젝트: ochiem/app-cms
 /**
  * @param AcceptanceTester $I
  */
 public function testResetPassword(AcceptanceTester $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.']);
 }
예제 #11
0
 /**
  * @param AcceptanceTester $I
  */
 public function testCreateMenuItem(AcceptanceTester $I)
 {
     $I->wantTo('ensure that create menu item works');
     $indexPage = IndexPage::openBy($I);
     $I->see('Menus', 'h1');
     $I->see('Menu Primary', 'h2');
     if (method_exists($I, 'wait')) {
         $I->amGoingTo('submit menu form with correct data');
         $indexPage->submitMenuItem(['label' => 'New Menu Item', 'url' => 'http://writesdown.com']);
         $I->expectTo('see new menu item');
         $I->see('New Menu Item', '.dd-handle');
     }
     MenuItem::deleteAll(['label' => 'Test Menu Item']);
 }
예제 #12
0
 /**
  * @param AcceptanceTester $I
  */
 public function testUpdate(AcceptanceTester $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-module_status');
     $updatePage->submit(['module_name' => 'test', 'module_title' => 'Test']);
     $I->expect('module updated');
     $I->see('Modules', 'h1');
     $I->see('Test', '#module-grid-view');
     Module::findOne(2)->updateAttributes(['module_name' => 'sitemap', 'module_title' => 'Sitemap', 'module_status' => '0']);
 }