コード例 #1
0
 public function submitFormSuccessfully(\FunctionalTester $I)
 {
     $I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => '*****@*****.**', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']);
     $I->seeEmailIsSent();
     $I->dontSeeElement('#contact-form');
     $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
 }
コード例 #2
0
ファイル: LoginCest.php プロジェクト: vovancho/yii2test
 public function loginSuccessfully(\FunctionalTester $I)
 {
     $I->amOnRoute('site/login');
     $I->submitForm('#login-form', ['LoginForm[username]' => 'admin', 'LoginForm[password]' => 'admin']);
     $I->see('Главное меню');
     $I->see('Система "Фрегат"');
     $I->see('Регистр глаукомных пациентов');
     $I->see('Настройки портала');
     $I->see('Сменить пароль');
     $I->dontSeeElement('form#login-form');
     $I->canSeeCookie('_identity');
     $I->canSeeCookie('PHPSESSID');
     $this->cookie_identity = $I->grabCookie('_identity');
     $this->cookie_session = $I->grabCookie('PHPSESSID');
 }
コード例 #3
0
ファイル: ReplyDeletionCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 *          Reply deletion
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Delete a reply as a visitor, normal member and admin.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
$reply = $I->have('Reply', ['topic_id' => $topic->id]);
// Testing as a visitor
$I->am('as a visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#reply-delete-' . $reply->id);
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('as a member');
$I->signIn();
$I->dontSeeElement('#reply-delete-' . $reply->id);
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#reply-delete-' . $reply->id);
$I->click('#reply-delete-' . $reply->id);
$I->dontSeeRecord('replies', ['id' => $reply->id]);
コード例 #4
0
ファイル: TopicPinCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 *          Pin a topic to top
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Pin a topic on Top of the topic default list');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
// Testing as a visitor
$I->am('a Phphub visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-pin-button');
$I->amOnRoute('topics.pin', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('a Phphub member');
$I->signIn();
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-pin-button');
$I->amOnRoute('topics.pin', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#topic-pin-button');
$I->click('#topic-pin-button');
// check the list
コード例 #5
0
ファイル: UserEditCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 *          User editing
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Editing user profile as a Visitor and the Owner.');
$user = $I->have('User');
// --------------- As a visitor --------------
$I->am('as a Visitor');
$I->amOnRoute('users.show', $user->id);
$I->dontSeeElement('#user-edit-button');
$I->amOnRoute('users.edit', $user->id);
$I->seeCurrentRouteIs('login-required');
// --------------- As a member --------------
$user = $I->signIn();
$I->am('as the Owner');
$I->amOnRoute('users.show', $user->id);
$I->seeElement('#user-edit-button');
$I->click('#user-edit-button');
$I->seeCurrentRouteIs('users.edit', $user->id);
$I->fillField(['name' => 'city'], 'My city');
$I->fillField(['name' => 'company'], 'My company');
$I->fillField(['name' => 'twitter_account'], 'My twitter_account');
$I->fillField(['name' => 'personal_website'], 'My personal_website');
$I->fillField(['name' => 'signature'], 'My signature');
$I->fillField(['name' => 'introduction'], 'My introduction');
$I->click('#user-edit-submit');
コード例 #6
0
$I->seeResponseCodeIs(200);
$I->see('Messages');
$I->see('Search', 'div.panel form button.btn-info');
$I->see('Status overview');
$I->seeLink('ID');
$I->seeLink('Created');
$I->seeLink('Type');
$I->seeLink('Status');
$I->see('Action');
$I->seeLink('Details');
$I->see('1.502', 'table tfoot');
# buttons
$I->seeLink('', '/message/set-status');
// for status buttons
# buttons: item with "Ready" status
$I->dontSeeElement('table#results tr.status-new a.btn-success span.glyphicon-check');
$I->seeElement('table#results tr.status-new a.btn-primary span.glyphicon-play');
$I->seeElement('table#results tr.status-new a.btn-warning span.glyphicon-pause');
$I->seeElement('table#results tr.status-new a.btn-danger span.glyphicon-remove');
$I->seeElement('table#results tr.status-new div.icon-button-placeholder-xs');
# buttons: item with "Halted" status
$I->seeElement('table#results tr.status-halted a.btn-primary span.glyphicon-play');
$I->seeElement('table#results tr.status-halted a.btn-success span.glyphicon-check');
$I->dontSeeElement('table#results tr.status-halted a.btn-warning span.glyphicon-pause');
$I->seeElement('table#results tr.status-halted a.btn-danger span.glyphicon-remove');
$I->seeElement('table#results tr.status-halted div.icon-button-placeholder-xs');
// coloured statuses on list
$I->see('New', 'td span[class="label label-default"]');
$I->see('Error', 'td span[class="label label-danger"]');
$I->see('In progress', 'td span[class="label label-primary"]');
$I->see('Halted', 'td span[class="label label-warning"]');
コード例 #7
0
ファイル: TopicsEditingCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 *          Topic editing function
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Editing a topic as a Visitor, Member and Author.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
// --------------- As a visitor --------------
$I->am('as a Visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-edit-button');
$I->amOnRoute('topics.edit', $topic->id);
$I->seeCurrentUrlEquals('/login-required');
// --------------- As a member --------------
$user = $I->signIn();
$I->am('as the author');
$topic = $I->postATopic(['title' => 'My Awsome Topic.', 'user_id' => $user->id]);
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#topic-edit-button');
$I->click('#topic-edit-button');
$I->selectOption('form select[name=node_id]', 'php');
$I->fillField(['name' => 'title'], 'My first post!');
$I->fillField(['name' => 'body'], 'My first post body.');
$I->click('#topic-create-submit');
$I->see('My first post!');
コード例 #8
0
<?php

$I = new FunctionalTester($scenario);
// Prep
$sentry = $I->grabService('sentry');
$user = $sentry->findUserByLogin('*****@*****.**');
$admin = $sentry->findUserByLogin('*****@*****.**');
// Test
$I->amActingAs('*****@*****.**');
$I->wantTo('edit another users profile');
$I->amOnPage('/users/' . $admin->id . '/edit');
$I->dontSeeElement('form', ['class' => 'form-horizontal']);
コード例 #9
0
ファイル: RegPrestamoCept.php プロジェクト: Evhanz/S_Trogue
<?php
/**
 * Created by PhpStorm.
 * User: Evhanz
 * Date: 2/11/2015
 * Time: 7:28 PM
 */


$I = new FunctionalTester($scenario);

//when
$I->wantTo('Probar el registro de prestamos');
$I->amOnPage('prestamos/getViewNewPrestamo');
$I->see('Formulario de Registro','h3');
$I->fillField('dniProveedor','qw');
$I->dontSeeElement('#dniProveedor', ['value' => 'qw']);
$I->click(':::');
$I->see('Exito');
$I->selectOption('#selRecuso','1');
$I->fillField('#descripcion','prestamo rapido');
$I->fillField('#cantidad','a');
$I->dontSeeElement('#cantidad', ['value' => 'a']);
$I->click('#btnGuardar');

コード例 #10
0
ファイル: TopicDeletionCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 * 			Topic deletion
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Delete a topic as a visitor, normal member and admin.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
// Testing as a visitor
$I->am('a Phphub visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-delete-button');
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('a Phphub member');
$I->signIn();
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-delete-button');
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#topic-delete-button');
$I->click('#topic-delete-button');
$I->seeCurrentRouteIs('topics');
コード例 #11
0
 public function loginSuccessfully(\FunctionalTester $I)
 {
     $I->submitForm('#login-form', ['LoginForm[username]' => 'admin', 'LoginForm[password]' => 'admin']);
     $I->see('Logout (admin)');
     $I->dontSeeElement('form#login-form');
 }
コード例 #12
0
ファイル: TopicRecomendCept.php プロジェクト: adminrt/phphub
<?php

/**
 * ------------------------------------
 * 			Mark a topic as exellent
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Recomend a topic to the home page as a visitor, normal member and admin.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
// Testing as a visitor
$I->am('a Phphub visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-recomend-button');
$I->amOnRoute('topics.recomend', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('a Phphub member');
$I->signIn();
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-recomend-button');
$I->amOnRoute('topics.recomend', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#topic-recomend-button');
$I->click('#topic-recomend-button');
// Succeed
コード例 #13
0
<?php

/**
 * ------------------------------------
 * 			Mark a topic as Wiki
 * ------------------------------------
 */
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Mark a topic as Community Wiki being a visitor, normal member and admin.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
// Testing as a visitor
$I->am('a Phphub visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-wiki-button');
$I->amOnRoute('topics.wiki', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('a Phphub member');
$I->signIn();
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#topic-wiki-button');
$I->amOnRoute('topics.wiki', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#topic-wiki-button');
$I->click('#topic-wiki-button');
// Succeed
コード例 #14
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function removeAttachment(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->wantTo('remove an attachment from a project issue comments');
     $fileName = 'upload1.txt';
     $manager = $I->createUser(1, 3);
     $I->amLoggedAs($manager);
     $issue = $I->createIssue(1, $manager);
     $project = $issue->project;
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $uploadToken = $I->grabValueFrom('//form/input[@name="upload_token"]');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postUploadAttachment', ['project' => $project]);
     $I->submitFormWithFileToUri('.new-comment form', $uri, ['upload' => $fileName], ['comment' => 'Comment 1']);
     $attachment = $issue->comments->first()->attachments->first();
     $I->amOnAction('Project\\IssueController@getDownloadAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeElement('.attachments a', ['title' => $fileName]);
     $uri = $I->getApplication()->url->action('Project\\IssueController@postRemoveAttachment', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['_token' => csrf_token(), 'upload_token' => $uploadToken, 'filename' => $fileName]);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSeeElement('.attachments a', ['title' => $fileName]);
     $I->amOnAction('Project\\IssueController@getDisplayAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(404);
 }