示例#1
0
 /**
  * @depends deleteNewsNoTickConfirmation
  */
 public function deleteNewsTickConfirmation(AcceptanceTester $I)
 {
     $I->logInAsAnAdmin();
     $I->amOnListNews();
     $I->click('Edit');
     $I->waitForText('Edit news item');
     $I->seeInCurrentUrl('/edit_news');
     $I->checkOption('#delete_confirmation');
     $I->click('Delete news item');
     $I->seeInCurrentUrl('/list_news');
     $I->dontSee('Edit');
 }
示例#2
0
 public function _before(\AcceptanceTester $I)
 {
     $I->am('guest user');
     $I->amGoingTo('Load the homepage');
     $I->amOnPage('/');
     $I->seeInCurrentUrl('/');
 }
示例#3
0
 public function editCategoryNotExposed(AcceptanceTester $I)
 {
     $I->logInAsAnAdmin();
     $I->amOnEditCategory(CI_EDITABLE_CATEGORY_ID);
     $title = time() . 'title';
     $description = time() . 'body';
     $from = date_time();
     $until = date_time(time() + 10000);
     $I->fillField('title', $title);
     $I->fillField('description', $description);
     $I->uncheckOption('#exposed');
     $I->fillField('available_from', $from);
     $I->fillField('available_until', $until);
     $I->click('Save changes');
     $I->waitForText('Edit category');
     $I->seeInCurrentUrl('/edit_category');
     $I->seeInField('title', $title);
     $I->seeInField('description', $description);
     $I->dontSeeCheckboxIsChecked('#exposed');
     $I->seeInField('available_from', $from);
     $I->seeInField('available_until', $until);
     $I->amOnPage('/challenges');
     $I->dontSee($title);
     $I->amOnPage('/scores');
     $I->dontSee($title);
 }
 public function it_prevents_guests_from_seeing_profiles(AcceptanceTester $I)
 {
     $user = $this->userActor->create();
     $I->amOnRoute('profile.show', $user->username);
     $I->seeInCurrentUrl('auth/login');
     $I->seeCurrentRouteIs('auth.login');
     $I->dontSee('Profile of user');
 }
示例#5
0
 public function seeMembers(\AcceptanceTester $I)
 {
     $I->am('guest user');
     $I->amGoingTo('Load the members section');
     $I->amOnPage('/');
     $I->click('Members');
     $I->seeInCurrentUrl('/members');
     $I->see('Name');
     $I->see('Role');
 }
示例#6
0
 public function submitCorrect(AcceptanceTester $I)
 {
     $I->logInAsANormalUser();
     $I->amOnPage('/challenges?category=' . to_permalink(CI_DEFAULT_CATEGORY_TITLE));
     $I->see(CI_DEFAULT_CHALLENGE_TITLE);
     $I->see(CI_DEFAULT_CHALLENGE_DESCRIPTION);
     $flag_field = '#flag-input-' . CI_DEFAULT_CHALLENGE_ID;
     $I->fillField($flag_field, CI_DEFAULT_CHALLENGE_FLAG);
     $I->click('#flag-submit-' . CI_DEFAULT_CHALLENGE_ID);
     $I->seeInCurrentUrl('status=correct');
     $I->dontSeeElement($flag_field);
 }
示例#7
0
 public function register(\AcceptanceTester $I)
 {
     $I->amGoingTo('register');
     $I->amOnPage('/auth/register');
     $I->fillField('name', 'codeception');
     $I->fillField('password', 'acceptance');
     $I->fillField('email', '*****@*****.**');
     $I->click('submit');
     $I->see('Registered successfully!');
     $I->seeLink('Go back to Home');
     $I->click('Go back to Home');
     $I->seeInCurrentUrl('/');
 }
示例#8
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('see note can not be edited without required fields');
$I->testLogin();
$I->amOnPage('/notes/1/edit');
$I->fillField('Name', '');
$I->fillField('Text', '');
$I->click('Save');
$I->seeInCurrentUrl('/notes/1/edit');
$I->see('Name is required');
$I->see('Text is required');
$I = new AcceptanceTester($scenario);
//login as a user
$I->amOnPage('/oc-panel/auth/login');
$I->fillField('email', '*****@*****.**');
$I->fillField('password', '1234');
$I->click('auth_redirect');
$I->am("a user");
$I->wantTo('visit pages on the user dropdown menu');
$I->wantTo('see the panel');
//green profile button
$I->lookForwardTo('see the title "my advertisements" and url contains "/myads"');
$I->click("a[href='http://reoc.lo/oc-panel']");
$I->see('my advertisements', 'h1');
$I->dontSee('homepage');
$I->seeInCurrentUrl('/myads');
$I->amOnPage('/');
//back on homepage
$I->wantTo('see the my ads');
//my advertisements on dropdown menu
$I->lookForwardTo('see the title "my advertisements" and url contains "/myads"');
$I->click("a[href='http://reoc.lo/oc-panel/myads']");
$I->see('my advertisements', 'h1');
$I->dontSee('homepage');
$I->seeInCurrentUrl('/myads');
$I->amOnPage('/');
//back on homepage
$I->wantTo('see the my favorites');
//my favorites on dropdown menu
$I->lookForwardTo('see the title "my favorites" and url contains "/profile/favorites"');
$I->click("a[href='http://reoc.lo/oc-panel/profile/favorites']");
<?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');
<?php

$I = new AcceptanceTester($scenario);
$I->am('Guest Site User');
$I->wantTo('View a Product\'s Details Page');
$I->amOnPage('/');
$I->click('View');
$I->seeInCurrentUrl('/product/details/');
$I->see('Product Description');
$I->see('Checkout');
$I->see('Add To Cart');
示例#12
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('see pad can not be created without required fields');
$I->testLogin();
$I->amOnPage('/pads/create');
$I->click('Save');
$I->dontSee('Example pad');
$I->seeInCurrentUrl('/pads/create');
$I->see('Name is required');
$I->amOnPage('/home');
$I->see('Add a Category Below');
$I->fillField('Category Name', 'Test Category');
$I->click('Add Category');
$I->seeCurrentUrlEquals('/home');
$I->see('Test Category');
$I->wantTo('add another category');
$I->fillField('Category Name', 'My Next Category');
$I->fillField('Category Description', 'I can put whatever I want here???');
$I->click('Add Category');
$I->seeCurrentUrlEquals('/home');
$I->see('My Next Category');
$I->see('I can put whatever I want');
$I->wantTo('add a bookmark to Test Category');
$I->click('Test Category');
$I->seeInCurrentUrl('edit-category');
$I->see('This category has 0 bookmarks.');
$I->see('Add a Bookmark to this Category:');
$I->fillField('Bookmark Name', 'Laravel');
$I->fillField('Bookmark URL', 'https://laravel.com/');
$I->fillField('Bookmark Description', 'The PHP Framework for Web Artisans');
$I->click('Add Bookmark');
$I->seeInCurrentUrl('edit-category');
$I->see('This category has 1 bookmark.');
$I->see('Laravel');
$I->see('The PHP Framework for Web Artisans');
$I->wantTo('change the category description while I\'m here');
$I->see('Editing Category: Test Category');
$I->fillField('Category Description', 'The best damn category, period.');
$I->click('Save Changes');
$I->seeInCurrentUrl('edit-category');
示例#14
0
<?php

$userName = '******';
$I = new AcceptanceTester($scenario);
$I->wantTo('log in as regular user');
$I->amOnPage('/admin/login');
$I->appendField('login', $userName);
$I->appendField('password', 'admin');
$I->click('Войти');
$I->seeInCurrentUrl('/components/run/shop/dashboard');
//$I->amOnPage('/admin/');
//$I->click('//nav/ul/li[3]/a');
//$I->click('//nav/ul/li[3]/ul/li[1]/a');
//$I->waitForElement('.//*[@id="mainContent"]/section/div[1]/div[2]/div/a');
//$I->click('.//*[@id="mainContent"]/section/div[1]/div[2]/div/a');
//$I->waitForElement('#inputName');
//$I->appendField('#inputName', 'Категория');
//$I->click('a.chosen-single');
//$I->click('//div[@id="inputMainC_chosen"]/div/ul/li[4]');
//$I->click('//*[@id="mainContent"]/section/div/div[2]/div/button[2]');
//
//sleep('5');
$I->see;
示例#15
0
<?php

$i = new AcceptanceTester($scenario);
$i->wantTo('login in and see the panel');
$i->amOnPage('/login');
$i->fillField('_username', 'francesco.viglino');
$i->fillField('Password', 'testtest');
$i->click('Log in');
$i->seeInCurrentUrl('/');
$i->see('Welcome to Gpanel');
示例#16
0
 /**
  * Tests Checkout Success page
  *
  * @group checkout
  *
  * @param $I AcceptanceTester
  *
  * @depends testOnePageCheckout
  */
 public function testOnePageCheckoutSuccess(AT $I)
 {
     $I->wantTo('Observe the order success page');
     $I->expectTo('see order success page');
     $I->seeInCurrentUrl(Page\Checkout::$SUCCESS_URL);
     $I->expectTo('be a happy customer');
 }
示例#17
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('sign in');
$I->amOnPage('user/login');
$I->fillField('email', '*****@*****.**');
$I->fillField('password', 'adminn');
$I->click('Login', '.btn-primary');
$I->amOnPage('/');
$I->see('admin');
$I->seeInDatabase('users', ['email' => '*****@*****.**']);
$I->amOnPage('user/profile');
$I->see('Birthday');
$I->click('Create a new post');
$I->see('Title');
$I->seeInCurrentUrl('post/create');
$I->click('Create a new post', '.btn-primary');
$I->see('The title field is required.');
$I->see('The content field is required.');
$I = new AcceptanceTester($scenario);
//login as a user
$I->amOnPage('/oc-panel/auth/login');
$I->fillField('email', '*****@*****.**');
$I->fillField('password', '1234');
$I->click('auth_redirect');
//edit profile on dropdown menu
$I->wantTo('1) see the profile edit page, 2) change my name, my email and add a description, 3) change my passwd, 4) upload a profile pic, 5) See those changes on public profile');
// 1)
$I->wantTo('1) see the profile edit page');
$I->lookForwardTo('see "Edit Profile" header');
$I->click("a[href='http://reoc.lo/oc-panel/profile/edit']");
$I->see('edit profile', 'h3');
$I->dontSee('homepage');
$I->dontSee('my advertisements', 'h1');
$I->seeInCurrentUrl('/profile/edit');
// 2)
$I->wantTo('2) change my name, my email and add a description');
$I->lookForwardTo('see a successful message');
$I->fillField('#name', 'user');
$I->fillField("#email", '*****@*****.**');
$I->fillField("#description", 'Hello!!!');
$I->click("button[type=submit]");
$I->see('You have successfully changed your data');
//repeat 2)
$I->wantTo('2) change my name, my email and remove description');
$I->lookForwardTo('see a successful message');
$I->fillField('#name', 'Gary Doe');
$I->fillField("#email", '*****@*****.**');
$I->fillField("#description", '');
$I->click("button[type=submit]");
 public function customer_会員登録利用規約(\AcceptanceTester $I)
 {
     $I->wantTo('EF0404-UC01-T01 会員登録 利用規約');
     $I->amOnPage('/entry');
     $I->click('#main_middle form .form_terms_link a');
     $I->switchToNewWindow();
     $I->seeInCurrentUrl('/help/agreement');
 }
示例#20
0
$I = new AcceptanceTester($scenario);
$I->wantTo('login');
$I->amOnPage('/index.php');
$I->fillField('username', 'admin');
$I->fillField('password', 'admin');
$I->click('Sisene');
$I->see('Sisseloggimine õnnestus, Tere tulemast!');
$I->seeInCurrentUrl('/welcome.php');
?>


<?php 
$I = new AcceptanceTester($scenario);
$I->wantTo('login');
$I->amOnPage('/index.php');
$I->fillField('username', 'admin');
$I->fillField('password', 'valeparool');
$I->click('Sisene');
$I->see('Vale kasutajatunnus või parool!');
$I->seeInCurrentUrl('/index.php');
?>


<?php 
$I = new AcceptanceTester($scenario);
$I->wantTo('login');
$I->amOnPage('/welcome.php');
$I->click('Loggi välja');
$I->see('Olete välja logginud');
$I->seeInCurrentUrl('/logout.php');
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('open blog page and see article there');
$I->amOnPage('/');
$I->click('Browse application');
$I->seeInCurrentUrl('blog');
$I->seeElement('article.post');
示例#22
0
 public function tryToTest(AcceptanceTester $I)
 {
     $this->allTests = loadFromJson(__DIR__ . '/../tests.json');
     $this->currentTest = [];
     //idčka první odpovědi k otázkám v testu
     $I->wantTo('fill test and download results');
     $I->amOnPage('/login.php?id=127');
     $I->click('input[type="submit"]');
     $I->seeInCurrentUrl('test');
     $I->see('testu stiskem');
     for ($i = 1; $i <= 30; $i++) {
         $questionText = $I->grabTextFrom("~{$i}.<\\/b> otázka \\(.*?\\) - +<b>(.*?)<\\/b>~");
         $answer1number = $I->grabTextFrom("~<TD VALIGN=\"MIDDLE\"><INPUT TYPE=\"radio\" VALUE=\"(\\d+)\" NAME=\"a{$i}\" \\/><\\/TD><TD>(.*?)<BR /></TD>~i");
         $this->currentTest[] = $answer1number;
         if (array_key_exists($answer1number, $this->allTests)) {
         } else {
             /** @var Answer[] $answers */
             $answers = [];
             $answersCount = $I->getNumberOfElements("input[name=a{$i}]");
             for ($j = 0; $j < $answersCount; $j++) {
                 $number = $answer1number + $j;
                 $answerText = $I->grabTextFrom("~<TD VALIGN=\"MIDDLE\"><INPUT TYPE=\"radio\" VALUE=\"{$number}\" NAME=\"a{$i}\" \\/><\\/TD><TD>(.*?)<BR /></TD>~i");
                 $answers[] = new Answer($answerText, null, $number, false);
             }
             $this->allTests[$answer1number] = new Question($questionText, $answers);
         }
     }
     //naklikání nevyzkoušených odpovědí
     foreach ($this->currentTest as $answer1number) {
         /** @var Question $question */
         $question = $this->allTests[$answer1number];
         $I->wantTo('select correct answer of ' . json_encode($question));
         if ($question->hasCorrectAnswer()) {
             $id = $question->correctAnswer->id;
             $I->click("input[value=\"{$id}\"]");
             continue;
         }
         foreach ($question->answers as $answer) {
             if (!$answer->tried) {
                 //první nevyzkoušená otázka
                 $id = $answer->id;
                 $I->click("input[value=\"{$id}\"]");
                 $question->selected = $answer;
                 $answer->tried = true;
                 break;
             }
         }
     }
     //submit formuláře
     $I->click('input[type=button]');
     //přečtení správnosti
     $i = 0;
     foreach ($this->currentTest as $answer1number) {
         /** @var Question $question */
         $question = $this->allTests[$answer1number];
         $i++;
         //číslo otázky
         if (!$question->hasCorrectAnswer()) {
             $image = $I->grabTextFrom("~<img alt=\"status\" src=\"(.*?)\"(.*?)</td><td><b>{$i}\\.~i");
             if ($image == 'img/icon_good.jpg') {
                 $question->selected->correct = true;
                 $question->correctAnswer = $question->selected;
             }
         }
     }
     foreach ($this->allTests as $questionText => $question) {
         $question->selected = null;
     }
     file_put_contents('tests.json', json_encode($this->allTests, JSON_PRETTY_PRINT));
 }
示例#23
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('see note can not be created without required fields');
$I->testLogin();
$I->amOnPage('/notes/create');
$I->click('Save');
$I->seeInCurrentUrl('/notes/create');
$I->see('Name is required');
$I->see('Text is required');
示例#24
0
 /**
  * Test to make sure a user cannot go manipulate the form flow
  *
  * @before reset
  * @before login
  * @before validateWizard
  *
  * @param AcceptanceTester $I
  */
 public function validateFormSequence(AcceptanceTester $I)
 {
     $I->wantToTest('The user cannot manipulate the form sequence manually');
     /**
      * Step 1: Start
      */
     DEBUG::debug('Trying to go forward 1 step without clicking continue ...');
     $I->amOnPage(admin_url('/?page=wpem&step=settings'));
     // Redirected back to the most current step
     $I->seeInCurrentUrl('/wp-admin/?page=wpem&step=start');
     $I->click(self::PRIMARY_BUTTON);
     $I->waitForElementNotVisible('.wpem-step-1 form', 15);
     /**
      * Step 2: Settings
      */
     $I->seeInCurrentUrl('/wp-admin/?page=wpem&step=settings');
     DEBUG::debug('Trying to go back to the previous step ...');
     $I->moveBack();
     // Redirected back to the most current step
     $I->seeInCurrentUrl('/wp-admin/?page=wpem&step=settings');
     DEBUG::debug("Typing in the previous step's URL directly ...");
     $I->amOnPage(admin_url('/?page=wpem&step=start'));
     // Redirected back to the most current step
     $I->seeInCurrentUrl('/wp-admin/?page=wpem&step=settings');
 }
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Admin wrong login auth false');
$I->amOnPage('/admin');
$I->seeInCurrentUrl('/admin/index/login');
/*$I->seeInTitle('Login');
$I->seeElement('#login');
$I->seeElement('#password');
$I->fillField('login', 'yona#%@!^');
$I->fillField('password', 'yonacmsphalcon');
$I->click('Login');*/
UserLoginPage::of($I)->login('yona', 'yonacmsphalcon@#$%^&*');
$I->see('Неверный логин или пароль');
$I->seeInCurrentUrl('/admin/index/login');
$I->seeInTitle('Login');
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Test Guide Search on main page');
$I->amOnPage('subjects/index.php');
$I->fillField('searchterm', 'art');
$I->click('Go');
$I->seeInCurrentUrl('subjects/search.php');
$I->see('Art History');
示例#27
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('see user can successfully sign up');
$I->amOnPage('/signup');
$I->fillField('Email', '*****@*****.**');
$I->fillField('Password', 'qwerty');
$I->fillField('confirm', 'qwerty');
$I->click('Sign Up');
$I->seeInCurrentUrl('/signin');
$I->see('User is successfully created. Now you can sign in.');
$I->testLogin('*****@*****.**', 'qwerty');
$I->seeCurrentUrlEquals('/');
$I->see('My pads');
示例#28
0
<?php

$I = new AcceptanceTester($scenario);
$i = rand(1, 1000);
$I->wantTo('Add Website');
$I->amOnPage('/login');
$I->fillField('email', '*****@*****.**');
$I->fillField("password", "123456");
$I->click(['class' => 'btn-raised']);
$I->seeLink('Logout', '/logout');
$I->click('Websites');
$I->seeInCurrentUrl('/websites');
$I->click(['class' => 'btn-primary']);
$I->see('Basic Details');
$I->selectOption('id_domain', '101');
//Need to change Value every time before run
$I->selectOption('id_template', '101');
$I->fillField('campaign_id', '595');
$I->fillField('campaign_link', 'http://www.equinoxdna.com/o23new/direct_billing.php');
$I->fillField('website_title', 'Equinox DaynNight Serum Trial');
$I->fillField('company_id', '1');
$I->fillField('company_name', 'Equinox DaynNight Serum Trial');
$I->fillField('product_id', '4');
$I->fillField('product_name', 'Equinox DaynNight Serum Trial');
$I->fillField('email', 'abc' . $i . '@abc.com');
$I->fillField('cancel_order_email', 'abc' . $i . '@abc.com');
$I->selectOption('id_address', 'QA Address');
$I->selectOption('id_prices', 'QA Price');
$I->checkOption(['class' => 'show-hide-details', 'name' => 'is_us']);
$I->fillField('us_company_name', 'QA US' . $i . '');
$I->fillField('us_phone_number', '12345678901');
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('see user can not sign up with invalid email');
$I->amOnPage('/signup');
$I->fillField('Email', 'abcd');
$I->fillField('Password', 'pass');
$I->fillField('confirm', 'pass');
$I->click('Sign Up');
$I->seeInCurrentUrl('/signup');
$I->see('Invalid email');
/*
 * Furthermore he sees all the links to the functionality on the website.
 */
$I->seeLink('Forside');
$I->seeLink('Tilføj ny opskrift');
$I->seeLink('Tilføj ny plante');
$I->seeLink('Tilføj ny ingridients');
$I->seeLink('Om');
/*
 * He wants to create a new plant in the system so he clicks on the link "Tilføj ny plante".
 */
$I->click('Tilføj ny plante');
/*
 * He now gets redirected to the creation page "create-new-plant".
 */
$I->seeInCurrentUrl('add-new-plant');
/*
 * Here he fills out the form.
 * Its a very special plant so he fills out all the information about the plant,
 * he even checks all the checkboxes.
 */
$I->fillField('#name', 'Test plant');
$I->fillField('#name_latin', 'Test plant latin');
$I->fillField('#description', 'Test description of a test plant');
$I->fillField('#history', 'Test history of a test plant');
$I->checkOption('spring');
$I->checkOption('summer');
$I->checkOption('autumn');
$I->checkOption('winter');
$I->checkOption('10');
// does not get tested