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'); }
public function isNotEditedPost(AcceptanceTester $I, UserSteps $userSteps) { $I->wantTo('check history for post which is not edited'); $userId = $userSteps->amRegularUser(); $catId = $userSteps->haveCategory(); $post = new Posts(['title' => 'Some title', 'content' => 'Some content.', 'users_id' => $userId, 'categories_id' => $catId]); $I->amOnPage("/discussion/{$post->id}/some-title"); $I->dontSee('edited'); }
/** * Check the homepage * * @param \AcceptanceTester $I */ public function checkFrontPageTest(\AcceptanceTester $I) { $I->wantTo('see that the homepage works.'); $I->amOnPage('/'); $I->see('A sample site'); $I->see('Recent Pages'); $I->dontSee('Recent Resources'); $I->see('A Page I Made', 'h1'); $I->see('Built with Bolt, tested with Codeception', 'footer'); }
public function i_can_click_name_grid_item(\AcceptanceTester $I) { $I->clickNode('#model0-node'); $I->click('.dvs-sidebar-elements button'); $I->waitForElement('#dvs-sidebar-field-form', 5); $I->see('Max Length'); $I->click('a[data-breadcrumb-id="0"]'); $I->wait(1); $I->dontSee('Max Length'); }
/** * @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'); }
public function i_can_click_each_grid_item(\AcceptanceTester $I) { $I->clickNode('#creatorcreator-933e76acb06dec2ba6c31ba9c058a4e9-node'); $I->click('button[data-creator-attribute-name="Name"]'); $I->waitForElement('#dvs-sidebar-field-form', self::WAIT_TIME); $I->see('Max Length'); $I->click('a[data-breadcrumb-id="0"]'); $I->wait(1); $I->dontSee('Max Length'); $I->click('button[data-creator-attribute-name="Email"]'); $I->waitForElement('#dvs-sidebar-field-form', self::WAIT_TIME); $I->see('Max Length'); $I->click('a[data-breadcrumb-id="0"]'); $I->wait(1); $I->dontSee('Max Length'); $I->click('button[data-creator-attribute-name="Password"]'); $I->waitForElement('#dvs-sidebar-field-form', self::WAIT_TIME); $I->see('Max Length'); $I->click('a[data-breadcrumb-id="0"]'); $I->wait(1); $I->dontSee('Max Length'); }
/** * Test that a user with no access rights to Dashboard gets redirected to * the hmoepage. * * Inspired by the Atari game Lemmings and the Eddie Vedder commment: * "Longest song title in the Pearl Jam catalogue", referencing the song * "Elderly Woman Behind the Counter in a Small Town", and the name of the * particular unit test method until Bolt 2.3… * * @param \AcceptanceTester $I */ public function dashboardWithoutPermissionRedirectsToHomepageTest(\AcceptanceTester $I) { $I->wantTo('Set permissions/global/dashboard to empty and be redirected to the homepage'); // Set up the browser $I->setCookie($this->tokenNames['authtoken'], $this->cookies[$this->tokenNames['authtoken']]); $I->setCookie($this->tokenNames['session'], $this->cookies[$this->tokenNames['session']]); $I->amOnPage('/bolt/file/edit/config/permissions.yml'); $yaml = $I->getLemmingsPermissions(); $I->fillField('#form_contents', $yaml); $token = $I->grabValueFrom('#form__token'); $I->sendAjaxPostRequest('/bolt/file/edit/config/permissions.yml', ['form[_token]' => $token, 'form[contents]' => $yaml]); // Verify we go to the dashboard and end up on the homepage $I->amOnPage('/bolt'); $I->see('A sample site'); $I->see('Recent Pages'); $I->dontSee('Recent Resources'); $I->see('A Page I Made', 'h1'); $I->see('Built with Bolt, tested with Codeception', 'footer'); }
//click create // Read $I->amOnPage('/blog'); $I->see('Blog Post Title'); $I->click("a[href='http://reoc.lo/blog/blog-post-title.html']"); //click create $I->see('Blog Post Title', 'h1'); $I->see('This is my test post on my Blog'); $I->see("comments powered by Disqus"); // Delete BLOG $I->amOnPage('/oc-panel/Blog/'); $I->see('Blog Post Title'); $I->click('.btn.btn-danger.index-delete'); sleep(1); $I->amOnPage('/oc-panel/Blog/'); $I->dontSee('Blog Post Title'); $I->amOnPage('/blog'); $I->dontSee('Blog Post Title'); $I->amOnPage('/oc-panel/Config/update/blog'); $I->fillField("#formorm_config_value", '0'); $I->click("//button[@type='submit']"); //click save $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/'); $I->dontSeeElement('a', ['href' => 'http://reoc.lo/blog']); $I->amOnPage('/oc-panel/Config/update/blog_disqus'); $I->fillField('#formorm_config_value', ''); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); // Disqus for FAQ $I->amOnPage('/oc-panel/Config/update/faq_disqus');
$I->am('a visitor'); $I->wantTo('publish a new ad'); $I->amOnPage('publish-new.html'); $I->see('Publish new advertisement', 'h1'); $I->fillField('#title', 'New ad'); $I->click('.select-category'); $I->fillField('category', '18'); $I->fillField('location', '4'); $I->fillField('#description', 'This is a new ad'); $I->attachFile('input[type="file"]', 'photo.jpg'); $I->fillField('#phone', '99885522'); $I->fillField('#address', 'barcelona'); $I->fillField('#price', '25'); $I->fillField('#website', 'https://www.google.com'); $I->fillField('#name', 'David'); $I->fillField('#email', '*****@*****.**'); $I->click('submit_btn'); $I->see('Advertisement is posted. Congratulations!'); $I->amOnPage('/apartment/new-ad.html'); $I->see('New ad', 'h1'); $I->see('25.00', 'span'); $I->see('Phone: 99885522', 'a'); $I->see('This is a new ad'); $I->see('Barcelona'); $I->seeElement('a', ['href' => 'http://reoc.lo/user/david']); $I->seeElement('a', ['href' => 'https://www.google.com']); // Check if user has created $I->amOnPage('/user/david'); $I->see('David', 'h3'); $I->dontSee('Page not found');
$I->see('welcome admin'); // search_multi_catloc $I->amOnPage('/oc-panel/Config/update/search_multi_catloc'); $I->fillField('#formorm_config_value', '1'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/search.html'); $I->see('Search', 'h1'); $I->selectOption('form select[id=category]', array('Jobs', 'House')); $I->click("submit"); $I->see('title for the ad', 'a'); $I->see('just random title here', 'a'); $I->see('another great title', 'a'); $I->see('some nice title here', 'a'); $I->amOnPage('/search.html'); $I->see('Search', 'h1'); $I->selectOption('form select[id=location]', array('London', 'Madrid')); $I->click("submit"); $I->dontSee('title for the ad', 'a'); $I->dontSee('just random title here', 'a'); $I->see('another great title', 'a'); $I->see('some nice title here', 'a'); $I->amOnPage('/oc-panel/Config/update/search_multi_catloc'); $I->fillField('#formorm_config_value', '0'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/search.html?title=&category[]=house&category[]=jobs&price-min=&price-max=&submit='); $I->seeElement('div', ['id' => 'kohana_error']); $I->amOnPage('/search.html?title=&location[]=madrid&location[]=london&price-min=&price-max=&submit='); $I->seeElement('div', ['id' => 'kohana_error']); $I->amOnPage('/');
/** * Check that the editor can't publish Entries * * @param \AcceptanceTester $I */ public function deniedPublishPagesTest(\AcceptanceTester $I) { $I->wantTo("be denied permission to publish Pages as the 'editor' user"); // Set up the browser $I->setCookie($this->tokenNames['authtoken'], $this->cookies[$this->tokenNames['authtoken']]); $I->setCookie($this->tokenNames['session'], $this->cookies[$this->tokenNames['session']]); $I->amOnPage('bolt/editcontent/pages/1'); $I->see('Actions for this Page'); // Make sure the page cannot be published by setting its status $I->seeInField('#statusselect', 'draft'); $I->dontSeeInField('#statusselect', 'published'); // Save the page and return to the overview $I->click('Save & return to overview'); $I->see('Actions for Pages'); // Check the 'Publish page' context menu option isn't shown $I->dontSee('Publish Page'); // Check the 'Duplicate page' context menu option is shown $I->see('Duplicate Page'); }
public function it_validates_name_regex(AcceptanceTester $I) { //^[A-Za-z]'?[-\. a-zA-Z]+$ $field = 'name'; $error = 'The name format is invalid.'; //Starts with letter $I->amOnRoute(RegisterPage::$ROUTE); $I->fillField($field, '1'); $I->submitForm(RegisterPage::$formId, [], 'Register'); $I->see($error); //Can have space $I->amOnRoute(RegisterPage::$ROUTE); $I->fillField($field, 'aa aa'); $I->submitForm(RegisterPage::$formId, [], 'Register'); $I->dontSee($error); //Can have symbols $I->amOnRoute(RegisterPage::$ROUTE); $I->fillField($field, 'aa-.'); $I->submitForm(RegisterPage::$formId, [], 'Register'); $I->dontSee($error); }
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see note can not be deleted by not an owner'); $I->testLogin(); $I->amOnPage('/notes/5/delete'); $I->dontSee('Yes, I want to delete this note');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see note can be successfully deleted'); $I->testLogin(); $I->amOnPage('/notes/1/delete'); $I->click('Yes, I want to delete this note'); $I->dontSee('Note 1');
$I->am("the admin"); $I->wantTo('change configurations and see changes on frontend'); $I->amOnPage('/oc-panel/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '1234'); $I->click('auth_redirect'); $I->amOnPage('/oc-panel/'); $I->see('welcome admin'); // Address $I->amOnPage('/oc-panel/Config/update/address'); $I->fillField('#formorm_config_value', '0'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); //Read $I->amOnPage('/publish-new.html'); $I->dontSee('Address', 'label'); $I->dontSeeElement('input', ['name' => 'address']); // Back to default $I->amOnPage('/oc-panel/Config/update/address'); $I->fillField('#formorm_config_value', '1'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/publish-new.html'); $I->see('Address', 'label'); $I->seeElement('input', ['name' => 'address']); // Phone $I->amOnPage('/oc-panel/Config/update/phone'); $I->fillField('#formorm_config_value', '0'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); //Read
<?php namespace ApplicationTest; $I = new AcceptanceTester($scenario); $I->wantTo('ensure that Search Page works'); $I->amOnPage('/'); $I->see('demo'); $I->see('Query body (json)'); $I->dontSee('Response'); $I->fillField('query', ' { "query" : { "filtered" : { "filter" : { "bool" : { "should" : [ { "bool": { "must": [ { "terms": { "group": ["alpha", "beta"] } }, { "term": { "age": 20 } } ]
$I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/oc-panel/Config/update/to_top'); $I->fillField('#formorm_config_value', '1'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); // Read $I->amOnPage('/oc-panel/myads'); $I->seeElement('.glyphicon.glyphicon-circle-arrow-up'); $I->see('Featured', 'a'); $I->amOnPage('/jobs/some-nice-title-here.html'); $I->see('Your Advertisement can go on top again! For only', 'p'); $I->see('Go Top!', 'a'); $I->see('Your Advertisement can go to featured! For only', 'p'); $I->see('Go Featured!', 'a'); // Back to default $I->amOnPage('/oc-panel/Config/update/to_featured'); $I->fillField('#formorm_config_value', '0'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/oc-panel/Config/update/to_top'); $I->fillField('#formorm_config_value', '0'); $I->click('button[type="submit"]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/oc-panel/myads'); $I->dontSeeElement('.glyphicon.glyphicon-circle-arrow-up'); $I->dontSee('Featured', 'a'); $I->amOnPage('/jobs/some-nice-title-here.html'); $I->dontSee('Your Advertisement can go on top again! For only', 'p'); $I->dontSee('Go Top!', 'a'); $I->dontSee('Your Advertisement can go to featured! For only', 'p'); $I->dontSee('Go Featured!', 'a');
<?php use schmunk42\giiant\tests\_pages\LoginPage; #new schmunk42\giiant\tests\_pages\LoginPage; $I = new AcceptanceTester($scenario); $I->wantTo('ensure that crud works with access rules'); $I->amOnPage('/crud/actor'); $I->dontSee('Actor', 'h2'); $I->makeScreenshot('crud-actor-login'); $I->see('Sign in', 'h3'); $I->amGoingTo('try to login with correct credentials'); // TODO: use LoginPage $username = '******'; $password = '******'; $I->fillField('input[name="login-form[login]"]', $username); $I->fillField('input[name="login-form[password]"]', $password); $I->click('Sign in'); $I->waitForElement('#link-logout', 5); #LoginPage::openBy($I); #$loginPage = LoginPage::openBy($I); #$loginPage->login('admin', 'admin'); $I->see('Actor', 'h2'); $I->makeScreenshot('crud-actor');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('get learn form page'); $I->amOnPage('/learn-zf2-form-usage'); $I->see('Form with Zend\\Form sample usage'); $I->dontSee("Value is required and can't be empty"); $I->click("#submitbutton"); $I->see("Value is required and can't be empty");
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see news page without errors'); $I->amOnPage('/news/'); $I->dontSee('Fatal error'); $I->canSee('Стартовал набор на велокруиз 2016 ! Запись тут');
<?php $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"');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('get credits page'); $I->amOnPage('/credits'); $I->see('This site contained some grabbed outside resources'); $I->dontSee('Welcome to LearnZF2 site');
$I->click('submit'); $I->seeElement('.alert.alert-success'); $I->see('Success'); // READ PAGE $I->amOnPage('/about.html'); $I->see('About', 'h1'); $I->see('All about us!!'); // UPDATE PAGE $I->amOnPage('/oc-panel/content/edit/13'); $I->see('Edit Page', 'h1'); $I->fillField('#title', 'About Us'); $I->fillField('#description', 'All you need to know about us!!'); $I->fillField('#seotitle', 'about-us'); $I->click('submit'); $I->seeElement('.alert.alert-success'); $I->see('page is edited'); // read updated page $I->amOnPage('/about-us.html'); $I->see('About Us', 'h1'); $I->see('All you need to know about us!!'); // DELETE PAGE $I->amOnPage('/oc-panel/content/page'); $I->see('About us'); $I->click('.btn.btn-danger.index-delete'); $I->amOnPage('/oc-panel/content/page'); $I->dontSee('About us'); $I->amOnPage('/about-us.html'); $I->see('Page not found', 'h2'); // Logout $I->amOnPage('/oc-panel/auth/logout'); $I->see('Login', 'a');
<?php /** * @link http://www.diemeisterei.de/ * @copyright Copyright (c) 2015 diemeisterei GmbH, Stuttgart * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use tests\codeception\_pages\LoginPage; $I = new AcceptanceTester($scenario); $I->amOnPage('/settings'); $I->dontSee('Settings', 'h1'); $loginPage = LoginPage::openBy($I); $loginPage->login('admin', 'admin'); $I->amOnPage('/settings'); $I->see('Settings', 'h1');
/** * @depends openUpdateDolzh */ public function deleteDolzh(AcceptanceTester $I) { $I->click('//td[text()="СТАРШАЯ МЕДСЕСТРА"]/preceding-sibling::td/button[@title="Удалить"]'); $I->wait(2); $I->see('Вы уверены, что хотите удалить запись?'); $I->click('button[data-bb-handler="confirm"]'); $I->wait(2); $I->dontSee('СТАРШАЯ МЕДСЕСТРА'); $I->see('Ничего не найдено'); }
<?php // @group mandatory use tests\codeception\_pages\LoginPage; $I = new AcceptanceTester($scenario); $I->wantTo('ensure backend access works'); $I->amOnPage('/backend'); $I->dontSeeElement('.small-box'); $I->amOnPage('/prototype/html'); $I->dontSee('Htmls', 'h1'); $I->amOnPage('/prototype/less'); $I->dontSee('Lesses', 'h1'); $I->amOnPage('/settings'); $I->dontSee('Settings', 'h1'); $loginPage = LoginPage::openBy($I); $loginPage->login('admin', 'admin'); $I->amOnPage('/backend'); $I->seeElement('.small-box'); $I->amOnPage('/prototype/html'); $I->see('Htmls', 'h1'); $I->amOnPage('/prototype/less'); $I->see('Lesses', 'h1'); $I->amOnPage('/settings'); $I->see('Settings', 'h1');
$I->click('formorm[submit]'); $I->seeElement('.alert.alert-success'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/'); //$I->seeElement('.fixed.bottom'); //$I->see('We use cookies to track usage and preferences'); //$I->seeElement('.cb-enable'); //$I->see('I Understand','a'); // Cookies consent appears, but phpBrowser can't read it. If I uncomment the above 4 lines, // test fails but on _output/admin.09-SettingsGeneralCept.fail.html cookie consent appears. $I->amOnPage('/oc-panel/Config/update/cookie_consent'); $I->fillField('#formorm_config_value', '0'); $I->click('formorm[submit]'); $I->seeElement('.alert.alert-success'); $I->see('Item updated. Please to see the changes delete the cache'); $I->dontSee('We use cookies to track usage and preferences'); $I->dontSeeElement('.cb-enable'); $I->dontSee('I Understand', 'a'); /************************* LANDING PAGE **************************/ $I->amOnPage('/oc-panel/Config/update/landing_page'); $I->fillField('formorm[config_value]', '{"controller":"product","action":"listing"}'); $I->click('formorm[submit]'); $I->seeElement('.alert.alert-success'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/'); $I->see('Listing', 'h1'); $I->amOnPage('/oc-panel/Config/update/landing_page'); $I->fillField('formorm[config_value]', '{"controller":"home","action":"index"}'); $I->click('formorm[submit]');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see note can not be edited by not an owner'); $I->testLogin(); $I->amOnPage('/notes/5/edit'); $I->dontSee('Save', 'input');
/** * @depends openUpdatePodraz */ public function deletePodraz(AcceptanceTester $I) { $I->click('//td[text()="ДНЕВНОЙ СТАЦИОНАР"]/preceding-sibling::td/button[@title="Удалить"]'); $I->wait(2); $I->see('Вы уверены, что хотите удалить запись?'); $I->click('button[data-bb-handler="confirm"]'); $I->wait(2); $I->dontSee('ДНЕВНОЙ СТАЦИОНАР'); $I->see('Ничего не найдено'); }
$I->fillField('#formorm_config_value', '1'); $I->click('formorm[submit]'); $I->see('Item updated. Please to see the changes delete the cache'); // Check 2 step authentication on profile edit $I->wantTo('check 2 step authentication on profile edit'); $I->amOnPage('/oc-panel/profile/edit'); $I->see('2 Step Authentication', 'h3'); $I->seeElement('.btn.btn-primary'); $I->seeElement('.fa.fa-android'); $I->seeElement('.fa.fa-apple'); // Enable 2 step authentication and see the code $I->click('a[href="http://reoc.lo/oc-panel/profile/2step/enable"]'); $I->see('2 Step Authentication Enabled'); $I->seeElement('.alert.alert-success'); $I->see('Google Authenticator Code'); $I->seeElement('.btn.btn-warning'); // Disable 2 step authentication and see the code $I->click('a[href="http://reoc.lo/oc-panel/profile/2step/disable"]'); $I->seeElement('.alert.alert-info'); $I->see('2 Step Authentication Disabled'); $I->dontSee('Google Authenticator Code'); // Disable google_authenticator $I->wantTo('disable google_authenticator'); $I->amOnPage('/oc-panel/Config/update/google_authenticator'); $I->fillField('#formorm_config_value', '0'); $I->click('formorm[submit]'); $I->see('Item updated. Please to see the changes delete the cache'); $I->amOnPage('/oc-panel/profile/edit'); $I->dontSee('2 Step Authentication', 'h3'); $I->dontSeeElement('.fa.fa-android'); $I->dontSeeElement('.fa.fa-apple');