Inheritance: extends Codeception\Actor, use trait _generated\AcceptanceTesterActions
Exemplo n.º 1
0
 /**
  * Clear cache work only at admin panel
  * @param AcceptanceTester $I Controller 
  */
 public static function ClearAllCach($I)
 {
     $I->amOnPage('/admin');
     $I->click(NavigationBarPage::$System);
     $I->click(NavigationBarPage::$SystemClearAllCach);
     $I->wait(3);
 }
Exemplo n.º 2
0
 public function testIfICantCreateAnEventWithoutBeingAuthenticated(AcceptanceTester $I)
 {
     $I->am('guest');
     $I->wantTo('see that i can\'t create an event');
     $I->amOnPage('event/create');
     $I->canSee('have to be logged in', '.alert-danger');
 }
Exemplo n.º 3
0
 public function testAPI(AcceptanceTester $I)
 {
     $I->wantTo('test the API');
     $data = new stdClass();
     $data->contact = new stdClass();
     $data->contact->email = $this->faker->safeEmail;
     $clientId = $this->createEntity('client', $data);
     $this->listEntities('client');
     $data = new stdClass();
     $data->client_id = $clientId;
     $data->description = $this->faker->realText(100);
     $this->createEntity('task', $data);
     $this->listEntities('task');
     $lineItem = new stdClass();
     $lineItem->qty = $this->faker->numberBetween(1, 10);
     $lineItem->cost = $this->faker->numberBetween(1, 10);
     $data = new stdClass();
     $data->client_id = $clientId;
     $data->invoice_items = [$lineItem];
     $invoiceId = $this->createEntity('invoice', $data);
     $this->listEntities('invoice');
     $data = new stdClass();
     $data->invoice_id = $invoiceId;
     $data->amount = 1;
     $this->createEntity('payment', $data);
     $this->listEntities('payment');
     $this->listEntities('account');
 }
Exemplo n.º 4
0
 private function submitTheForm(AcceptanceTester $I, $attributes)
 {
     $I->waitForElement('form', 2);
     $I->fillField('form #title', $attributes['title']);
     $I->fillField('form #content', $attributes['content']);
     $I->click('form .btn-primary');
 }
Exemplo n.º 5
0
 function loginWithoutEmail(\AcceptanceTester $I, \Page\Login $loginPage)
 {
     $I->wantTo("Check login with No Email and Valid Password");
     $loginPage->loginWithPasswordOnly('debby');
     $I->seeElement('div[class = "control-group email error"]');
     $I->dontSeeInCurrentUrl('activities');
 }
 /**
  * Tests that form manager opens on the new form page
  *
  * @since 7.0
  * @param \GLM\Tests\Acceptance\AcceptanceTester $I The current actor.
  */
 public function formManagerOpensNewForm(AcceptanceTester $I)
 {
     $I->wantTo('Ensure the form manager opens in the new form page');
     $I->amOnPage(admin_url('post-new.php?post_type=ccf_form'));
     $I->click('Manage Form');
     $I->see('Click on a field to edit it');
 }
Exemplo n.º 7
0
 /**
  * @param AcceptanceTester $I
  */
 protected function setLoginCookies(\AcceptanceTester $I)
 {
     $authTokenName = (string) $this->tokenNames['authtoken'];
     $sessionTokenName = (string) $this->tokenNames['session'];
     $I->setCookie($this->tokenNames['authtoken'], $this->cookies[$authTokenName]);
     $I->setCookie($this->tokenNames['session'], $this->cookies[$sessionTokenName]);
 }
 public function loginWithInvalidCredentials(AcceptanceTester $I)
 {
     $I->amOnPage('/login');
     $I->click('Login');
     $I->seeCurrentUrlEquals('/login');
     $I->see('Invalid Credentials', '.flash');
 }
 public function testShowAction(AcceptanceTester $I)
 {
     $I->wantTo('too see inside the dashboard area');
     $I->amOnPage('/dashboard');
     $I->see('a placeholder for dashboard');
     $I->wait(3);
 }
Exemplo n.º 10
0
 public function viewHomepage(AcceptanceTester $I)
 {
     $I->wantTo('view the homepage');
     $I->amOnPage('/');
     $I->see('Zen Kommerce');
     //$I->dontSeeHttpHeader('Set-Cookie');
 }
 public function testShowAction(AcceptanceTester $I)
 {
     $I->wantTo('too see inside the "Writing" workspace');
     $I->amOnPage('/workspace/writing');
     $I->see('Symfony book');
     $I->wait(3);
 }
 public function tryToTest(AcceptanceTester $I)
 {
     $I->expectARequestToRemoteServiceWithAResponse(Phiremock::on(A::getRequest()->andUrl(Is::equalTo('/some/url')))->then(Respond::withStatusCode(203)->andBody('I am a response')));
     $response = file_get_contents('http://localhost:18080/some/url');
     $I->assertEquals('I am a response', $response);
     $I->seeRemoteServiceReceived(1, A::getRequest()->andUrl(Is::equalTo('/some/url')));
 }
 public function it_validates_required_fields(AcceptanceTester $I)
 {
     $I->amOnRoute(LoginPage::$ROUTE);
     $I->submitForm(LoginPage::$formId, [], 'Login');
     $I->see('The username field is required.');
     $I->see('The password field is required.');
 }
Exemplo n.º 14
0
 /**
  * @param AcceptanceTester $I
  */
 public function startAConversation(AcceptanceTester $I)
 {
     $I->wantToTest('if I can start a conversation');
     $I->amOnPage('/messages');
     $I->click('#startConversation');
     $I->see('Send a message');
 }
 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');
 }
Exemplo n.º 16
0
 public function createAnExpectationWithRegexReplacementFromBodyAndUrl(AcceptanceTester $I)
 {
     $expectation = PhiremockClient::on(A::postRequest()->andUrl(Is::matching('/&test=(\\d+)/'))->andBody(Is::matching('/a tomato (\\d+)/')))->then(Respond::withStatusCode(200)->andBody('the numbers are ${url.1} and ${body.1}'));
     $this->phiremock->createExpectation($expectation);
     $I->sendPOST('/potato?param1=123&test=456', 'this is a tomato 3kg it weights');
     $I->seeResponseCodeIs('200');
     $I->seeResponseContains('the numbers are 456 and 3');
 }
Exemplo n.º 17
0
 /**
  * @test
  * it should render extended shortcode
  */
 public function it_should_render_extended_shortcode(\AcceptanceTester $I)
 {
     $content = 'Lorem ipsum [idlikethis]Some idea of mine[/idlikethis]';
     $I->havePostInDatabase(['post_name' => 'foo', 'post_content' => $content]);
     $I->amOnPage('/foo');
     $text = "Some idea of mine";
     $I->seeElement('.idlikethis-button[data-text="' . $text . '"] button');
 }
Exemplo n.º 18
0
 public function i_can_edit_the_user(\AcceptanceTester $I)
 {
     $I->clickNode('#model1-node');
     // $I->fillField('text','*****@*****.**');
     // $I->click('button.dvs-sidebar-save-group');
     // $I->wait(self::WAIT_TIME);
     // $I->seeInDatabase('users', array('email' => '*****@*****.**'));
 }
Exemplo n.º 19
0
 public function comment(AcceptanceTester $I)
 {
     $I->wantTo('post a comment');
     $I->amOnPage('/Mikroblogi');
     $I->canSeeElement('.comment-submit');
     //        $I->submitForm('.comment-submit', ['text' => 'To jest unikalny komentarz']);
     //        $I->wait(1);
     //        $I->canSee('To jest unikalny komentarz');
 }
 /**
  * Login the admin user using his email
  *
  * @param \AcceptanceTester $I
  */
 public function loginAdminUserTest(\AcceptanceTester $I)
 {
     $I->wantTo('log into the backend as Admin with email');
     $I->loginWithEmailAs($this->user['admin']);
     $this->saveLogin($I);
     $I->see('Dashboard');
     $I->see('Configuration', Locator::href('/bolt/users'));
     $I->see("You've been logged on successfully.");
 }
 public function authentication_最終ログイン日時確認(\AcceptanceTester $I)
 {
     $I->wantTo('EA0201-UC01-T01 最終ログイン日時確認');
     $I->click(['css' => '.navbar-menu .dropdown-toggle']);
     $loginText = $I->grabTextFrom(['css' => '.navbar-menu .dropdown-menu']);
     $lastLogin = preg_replace('/.*(\\d{4}\\/\\d{2}\\/\\d{2} \\d{2}:\\d{2}).*/s', '$1', $loginText);
     // 表示されるログイン日時では秒数がわからないため、タイミングによっては1分ちょっと変わる
     $I->assertTrue(strtotime('now') - strtotime($lastLogin) < 70, '最終ログイン日時が正しい');
 }
Exemplo n.º 22
0
 public function proxyToGivenUriTest(AcceptanceTester $I)
 {
     $expectation = PhiremockClient::on(A::getRequest()->andUrl(Is::equalTo('/potato'))->andHeader('X-Potato', Is::sameStringAs('bAnaNa'))->andScenarioState('PotatoScenario', 'Scenario.START'))->proxyTo('https://es.wikipedia.org/wiki/Proxy');
     $this->phiremock->createExpectation($expectation);
     $guzzle = new GuzzleHttp\Client();
     $originalBody = $guzzle->get('https://es.wikipedia.org/wiki/Proxy')->getBody();
     $I->haveHttpHeader('X-Potato', 'banana');
     $I->sendGet('/potato');
     $I->seeResponseEquals($originalBody);
 }
Exemplo n.º 23
0
 /**
  * Search for the 'About' page record.
  *
  * @param \AcceptanceTester $I
  */
 public function omnisearchTest(\AcceptanceTester $I)
 {
     $I->wantTo("Search for the 'About' page as the 'author' user");
     // Set up the browser
     $this->setLoginCookies($I);
     $I->amOnPage('/bolt/omnisearch');
     $I->fillField('.col-md-8 .form-control', 'About');
     $I->click('Search', '.col-md-8 [type="submit"]');
     $I->seeLink('Edit', '/bolt/editcontent/pages/2');
 }
Exemplo n.º 24
0
 /**
  * Publish the 'Contact' page.
  *
  * @param \AcceptanceTester $I
  */
 public function publishContactPageTest(\AcceptanceTester $I)
 {
     $I->wantTo("Publish the 'Contact' page with 'templatefields' as 'manager' user");
     // Set up the browser
     $this->setLoginCookies($I);
     $I->amOnPage('/bolt/editcontent/pages/3');
     $I->seeInSource('This is the contact text');
     $I->selectOption('#statusselect', 'published');
     $I->click('Save', '#savecontinuebutton');
     $I->see('The changes to the Page have been saved.');
 }
Exemplo n.º 25
0
 private function GetEtsyShops(\AcceptanceTester $I)
 {
     for ($pg = 1060; $pg <= 1250; $pg++) {
         $I->amOnPage("/search/shops?page=" . $pg);
         $I->waitForElement('.shopname', 100);
         $shops = $I->grabMultiple('.shopname');
         foreach ($shops as $shop) {
             $this->db->real_query("INSERT INTO `etsy_store_list` (`id`, `store_slug`, `from_where`, `sent_at`, `created_at`) VALUES (NULL, '{$shop}', '{$pg}', NULL, CURRENT_TIMESTAMP);");
         }
     }
 }
Exemplo n.º 26
0
 public function seeNavBar(\AcceptanceTester $I)
 {
     $I->wantTo('See the navbar links');
     $I->seeLink('News');
     $I->seeLink('Members');
     $I->seeLink('Warlog');
     $I->seeLink('Media');
     $I->seeLink('Live');
     $I->seeLink('Apply Now');
     $I->seeLink('Login');
     $I->seeLink('Register');
 }
Exemplo n.º 27
0
 public function tryToTransferFundsBetweenMembers(AcceptanceTester $I)
 {
     $I->am('ewallet member');
     $I->wantTo('pay a debt');
     $I->lookForwardTo('transfer funds to my friend');
     $I->amOnPage(TransferFundsPage::$formPage);
     $I->selectOption(TransferFundsPage::$toMember, 'Luis Montealegre');
     $I->fillField(TransferFundsPage::$amount, 5);
     $I->click(TransferFundsPage::$transfer);
     $I->seeCurrentUrlMatches('/' . TransferFundsPage::$transferPage . '/');
     $I->seeElement(TransferFundsPage::$successMessage);
 }
Exemplo n.º 28
0
 public function failOnEmptyHeadersInspecificationTest(AcceptanceTester $I)
 {
     $I->wantTo('fail when creating a specification with invalid headers');
     $request = new Request();
     $request->setUrl(new Condition('isEqualTo', '/the/request/url'));
     $response = (new Response())->setHeaders('potato');
     $specification = new Expectation();
     $specification->setRequest($request)->setResponse($response);
     $I->haveHttpHeader('Content-Type', 'application/json');
     $I->sendPOST('/__phiremock/expectations', $specification);
     $I->seeResponseCodeIs(500);
 }
Exemplo n.º 29
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');
 }
Exemplo n.º 30
0
 public function ensureThatLoginWorks(AcceptanceTester $I)
 {
     $I->amOnPage(Url::toRoute('/user/login'));
     $I->see('Login', 'h1');
     $I->amGoingTo('try to login with correct credentials');
     $I->fillField('input[name="LoginForm[username]"]', 'admin');
     $I->fillField('input[name="LoginForm[password]"]', 'admin');
     $I->click('login-button');
     $I->wait(2);
     // wait for button to be clicked
     $I->expectTo('see user info');
     $I->see('Logout');
 }