예제 #1
0
 public function doFindTable(\AcceptanceTester $I)
 {
     $I->amGoingTo('find a table in the selected restaurant');
     $I->lookForwardTo('reserve a reservation time slot');
     $I->amOnPage('/reservation');
     $I->seeElement('.panel-find-table');
     $I->selectOption('location', 'Lewisham');
     $I->selectOption('guest_num', '4');
     $I->fillField('reserve_date', date('d-m-Y', strtotime('+ 1 month', time())));
     $I->fillField('reserve_time', '2:45 PM');
     $I->click('Find Table', '#find-table-form');
     $I->expect('success with available reservation times slot displayed');
     $I->seeElement('.panel-time-slots');
     $I->seeNumberOfElements('#time-slots .btn-group > .btn', 5);
     // 5 elements
     $I->click('#time-slots .btn-group > .btn:nth-child(4)');
     $I->click('Select Time', '#find-table-form');
     $I->expectTo('see the reservation summary');
     $I->seeElement('.panel-summary');
 }
예제 #2
0
 /**
  * @param \AcceptanceTester $I
  */
 public function submitASession(AcceptanceTester $I)
 {
     $I->am('an attendee');
     $I->wantTo('submit a session');
     $I->expect('to be able a submit a new session');
     // Login user.
     $I->amOnPage('/user/login');
     $I->submitForm('#user-login-form', ['name' => 'user1', 'pass' => '123456']);
     $I->seeElement('body.user-logged-in');
     // Fill session submission.
     $I->amOnPage('/node/add/session');
     $node_title = $this->faker->text(30);
     $I->fillField('title[0][value]', $node_title);
     $I->fillCkEditorByName('body[0][value]', $this->faker->text(100));
     $I->fillField('field_author[0][target_id]', 'user1 (2)');
     $I->selectOption('field_exp_level', 0);
     $I->selectOption('field_session_track', 'development');
     $I->makeScreenshot('session_form');
     $I->submitForm('#node-session-form', [], 'op');
     $I->makeScreenshot('session_view');
     $I->see($node_title, '.l-content');
 }
예제 #3
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('login a valid user');
// Test user
$I->haveInDatabase('users', ['id' => 1, 'email' => '*****@*****.**', 'username' => 'tester', 'password_hash' => '$2y$10$wEzfeu4AdmR4mQSit3TCH.je1THv/Z8XqzDI4AOCov4lssqeA/gwS', 'created_on' => date('Y-m-d H:i:s', strtotime('-1 month')), 'active' => 1, 'deleted' => 0, 'force_pass_reset' => 0]);
// First - ensure that we are logged out
$I->amOnPage('/logout');
$I->amOnPage('/login');
//--------------------------------------------------------------------
// Error without info
//--------------------------------------------------------------------
$I->expect('the form is not submitted');
$I->seeElement('#submit');
$I->submitForm('form', [], '#submit');
$I->seeElement('.alert-danger');
//--------------------------------------------------------------------
// Error without bad password
//--------------------------------------------------------------------
$I->expect('error returned due to bad password');
$I->seeElement('#submit');
$I->submitForm('#login_form', ['email' => '*****@*****.**', 'password' => 'badstuff'], '#submit');
$I->seeElement('.alert-danger');
$I->expect('login attempt was logged');
$I->seeInDatabase('auth_login_attempts', ['email' => '*****@*****.**']);
//--------------------------------------------------------------------
// Error without bad email
//--------------------------------------------------------------------
$I->expect('error returned due to bad email');
$I->seeElement('#submit');
$I->submitForm('#login_form', ['email' => '*****@*****.**', 'password' => 'mylittlepony'], '#submit');
예제 #4
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo("change a post slug");
$I->loginAs("*****@*****.**", "secret");
$I->OpenAnArticle("foo-test");
$I->amGoingTo("change the article slug");
$I->seeInField("#slug_input", "foo-test");
$I->fillField("#slug_input", "bar-test");
$I->click("Save");
$I->expect("the article slug to have changed");
$I->OpenAnArticle("bar-test");
$I->seeInField("#slug_input", "bar-test");
예제 #5
0
<?php

use yii\helpers\Url;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('vérifier que la page cms/web-texts/index fonctionne bien');
$pageUrl = Url::to(['/cms/web-texts/index']);
$wait = 1;
// secondes
$I->checkAccessFiltersAndLog($pageUrl, '*****@*****.**', 'ew0oVQQkaCvCGwmIxK7a', 'Liste des textes');
$I->expect('le lien de création fonctionne');
$I->seeLink('Ajouter un texte');
$I->click('Ajouter un texte');
$I->see('Ajouter un texte', 'h1');
$I->expect('le lien de mise à jour fonctionne');
$I->amOnPage(Url::to(['/cms/web-texts/index']));
$url = Url::to(['/cms/web-texts/update', 'id' => 2], true);
$I->seeElement(['css' => 'a[href="' . $url . '"]']);
$I->click(['css' => 'a[href="' . $url . '"]']);
$I->wait($wait);
$I->see('Modifier un texte', 'h1');
$I->expect('le lien vers la fiche fonctionne');
$I->amOnPage(Url::to(['/cms/web-texts/index']));
$url = Url::to(['/cms/web-texts/view', 'id' => 2], true);
$I->seeElement(['css' => 'a[href="' . $url . '"]']);
$I->click(['css' => 'a[href="' . $url . '"]']);
$I->wait($wait);
$I->see('Fiche d\'un texte', 'h1');
$I->expect('la suppression fonctionne');
$I->amOnPage(Url::to(['/cms/web-texts/index']));
$url = Url::to(['/cms/web-texts/delete', 'id' => 2], true);
예제 #6
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantToTest('force password reset redirects properly');
// Test user
$I->haveInDatabase('users', ['id' => 1, 'email' => '*****@*****.**', 'username' => 'tester', 'password_hash' => '$2y$10$wEzfeu4AdmR4mQSit3TCH.je1THv/Z8XqzDI4AOCov4lssqeA/gwS', 'created_on' => date('Y-m-d H:i:s', strtotime('-1 month')), 'active' => 1, 'deleted' => 0, 'force_pass_reset' => 1]);
// First - ensure that we are logged out
$I->amOnPage('/logout');
$I->amOnPage('/login');
//--------------------------------------------------------------------
// Successfully login
//--------------------------------------------------------------------
$I->expect('am sent to change password page');
$I->seeElement('#submit');
$I->submitForm('#login_form', ['email' => '*****@*****.**', 'password' => 'mylittlepony'], '#submit');
$I->dontSeeElement('.alert-danger');
$I->see('Change Password');
$I->seeInCurrentUrl('password');
예제 #7
0
<?php

// @group optional
use dmstr\modules\pages\tests\_pages\LoginPage;
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Pages works');
$I->expect('no access with guest user');
$I->amOnPage('/pages');
$I->see('Sign in', 'h3');
$I->makeScreenshot('pages-login');
$I->amGoingTo('try to login with correct credentials');
$loginPage = LoginPage::openBy($I);
$I->see('Sign in', 'h3');
$loginPage->login('admin', 'admin');
$I->dontSee('Sign in', 'h3');
$I->makeScreenshot('pages-after-login');
$I->amGoingTo('try to view and create pages');
$I->amOnPage('/pages');
$I->see('Pages', 'h1');
$I->makeScreenshot('success-pages-index');
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->haveHttpHeader('Content-Type', 'application/xml; charset=utf-8');
$I->seeResponseContains('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"');
$I->dontSee('<b>Notice</b>');
// error sometimes thrown if Wordpress timezone not set
$I->dontSee('error');
$I->expectTo('see a paginated XML sitemap');
$I->sendGET('/sitemap.xml?page=1');
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->haveHttpHeader('Content-Type', 'application/xml; charset=utf-8');
$I->seeResponseContains('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"');
$I->dontSee('<b>Notice</b>');
$I->dontSee('error');
$page_1 = $I->grabResponse();
$I->expect('that page 2 will be different than page 1');
$I->sendGET('/sitemap.xml?page=2');
$I->assertNotEquals($page_1, $I->grabResponse());
$I->expectTo('see a full XML sitemap');
$I->sendGET('/sitemap-all.xml');
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->haveHttpHeader('Content-Type', 'application/xml; charset=utf-8');
$I->seeResponseContains('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"');
$I->dontSee('<b>Notice</b>');
// error sometimes thrown if Wordpress timezone not set
$I->dontSee('error');
$I->expect('sitemap link tag in HTML HEAD');
$I->amOnPage('/');
$I->seeElement('link', array('rel' => 'sitemap'));
예제 #9
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('TOPページが正常に見られているかを確認する。');
$I->amOnPage('/');
$I->see('EC-CUBE発!世界中を旅して見つけた立方体グルメを立方隊長が直送!');
$I->seeElement('#site_description');
$I->seeElement('#main_image');
$I->expect('システムエラーが出ていない');
$I->dontSeeElement('.error');
$I->expect('TOPページはパンくずを表示しない');
$I->dontSeeElement('.breadcrumb');
예제 #10
0
<?php

/**
 * @package     Joomla
 * @subpackage  Tests
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
$I = new \AcceptanceTester($scenario);
$I->wantTo('Install Joomla CMS');
$I->expect('no configuration.php is in the Joomla CMS folder');
$I->dontSeeFileFound('configuration.php', $I->getConfiguration('Joomla folder'));
$I->amOnPage('/installation/index.php');
// I Wait for the text Main Configuration, meaning that the page is loaded
$I->waitForText('Main Configuration', 10, 'h3');
// I instantiate the Installation Configuration Page Elements:
$configurationPage = \JoomlaInstallationConfigurationPage::$elements;
$I->click($configurationPage['Language Selector']);
$I->click($configurationPage[$I->getConfiguration('Language')]);
$I->fillField('Site Name', 'Joomla CMS test');
$I->fillField('Description', 'Site for testing Joomla CMS');
// I get the configuration from acceptance.suite.yml (see: tests/_support/acceptancehelper.php)
$I->fillField('Admin Email', $I->getConfiguration('Admin email'));
$I->fillField('Admin Username', $I->getConfiguration('Username'));
$I->fillField('Admin Password', $I->getConfiguration('Password'));
$I->fillField('Confirm Admin Password', $I->getConfiguration('Password'));
$I->click($configurationPage['No Site Offline']);
$I->click('Next');
$I->wantTo('Fill the form for creating the Joomla site Database');
$I->waitForText('Database Configuration', 10, 'h3');
예제 #11
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('create a new user account');
$I->amOnPage('/join');
//--------------------------------------------------------------------
// Error without info
//--------------------------------------------------------------------
$I->expect('the form is not submitted');
$I->seeElement('#submit');
$I->submitForm('form', [], '#submit');
$I->seeElement('.alert-danger');
//--------------------------------------------------------------------
// Error with weak password
//--------------------------------------------------------------------
$fields = ['first_name' => 'Test', 'last_name' => 'User', 'email' => '*****@*****.**', 'username' => 'tester', 'password' => '123456', 'pass_confirm' => '123456'];
$I->expect('the form is not submitted');
$I->submitForm('#join_form', $fields, '#submit');
$I->seeElement('.alert-danger');
//--------------------------------------------------------------------
// Can create user
//--------------------------------------------------------------------
$fields = ['first_name' => 'Test', 'last_name' => 'User', 'email' => '*****@*****.**', 'username' => 'tester', 'password' => 'mylittlepony', 'pass_confirm' => 'mylittlepony'];
$I->expect('the form is submitted and a user is created');
$I->submitForm('#join_form', $fields, '#submit');
$I->dontSeeElement('.alert-danger');
예제 #12
0
<?php

use yii\helpers\Url;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('vérifier que la page cms/languages/index fonctionne bien');
$pageUrl = Url::to(['/cms/languages/index']);
$wait = 1;
// secondes
$I->checkAccessFiltersAndLog($pageUrl, '*****@*****.**', 'ew0oVQQkaCvCGwmIxK7a', 'Liste des langues');
$I->expect('la suppression fonctionne si la langue n\'est pas utilisée');
$url = Url::to(['/cms/languages/delete', 'id' => 3], true);
// espagnol "http://127.0.0.1:8061/index-test.php/cms/languages/delete?id=3"
$I->seeElement(['css' => 'a[href="' . $url . '"]']);
$I->click(['css' => 'a[href="' . $url . '"]']);
$I->acceptPopup();
$I->wait($wait);
$I->see('Suppression réussie');
$I->dontSeeElement(['css' => 'a[href="' . $url . '"]']);
$I->expect('la suppression échoue si la langue est utilisée');
$url = Url::to(['/cms/languages/delete', 'id' => 1], true);
// français
$I->seeElement(['css' => 'a[href="' . $url . '"]']);
$I->click(['css' => 'a[href="' . $url . '"]']);
$I->acceptPopup();
$I->wait($wait);
$I->see('Suppression impossible');
$I->seeElement(['css' => 'a[href="' . $url . '"]']);
$I->expect('le lien de création fonctionne');
$I->seeLink('Ajouter une langue');
$I->click('Ajouter une langue');