Beispiel #1
0
 public function testLoginToFacebook()
 {
     $this->markTestSkipped();
     // preconditions: #1 php web server being run
     $browserModule = new PhpBrowser();
     $browserModule->_setConfig(array('url' => 'http://localhost:8000'));
     $browserModule->_initialize();
     $browserModule->_cleanup();
     $browserModule->_before($this->makeTest());
     SuiteManager::$modules['PhpBrowser'] = $browserModule;
     // preconditions: #2 facebook test user was created
     $this->module->haveFacebookTestUserAccount();
     $testUserFirstName = $this->module->grabFacebookTestUserFirstName();
     // preconditions: #3 test user logged in on facebook
     $this->module->haveTestUserLoggedInOnFacebook();
     // go to our page with facebook login button
     $browserModule->amOnPage('/facebook');
     // check that yet we are not logged in with facebook
     $browserModule->see('You are not Connected.');
     // click on "Login with Facebook" button to start login with facebook
     $browserModule->click('Login with Facebook');
     // check that we are logged in with facebook
     $browserModule->see('Your User Object (/me)');
     $browserModule->see($testUserFirstName);
     // cleanup
     unset(SuiteManager::$modules['PhpBrowser']);
     $browserModule->_after($this->makeTest());
     data::clean();
 }
 public function testSwitchToIframe()
 {
     $this->module->amOnPage('/iframe');
     $this->module->switchToIframe('content');
     $this->module->see('Is that interesting?');
     $this->module->click('Ссылочка');
 }
Beispiel #3
0
 public function testSeeWithNonLatinAndSelectors()
 {
     $this->module->amOnPage('/info');
     $this->module->see('Текст', 'p');
     $this->module->seeLink('Ссылочка');
     $this->module->click('Ссылочка');
 }
 public function testLoadPageApi()
 {
     $this->module->_loadPage('POST', '/form/try', ['user' => 'davert']);
     $data = data::get('form');
     $this->assertEquals('davert', $data['user']);
     $this->module->see('Welcome to test app');
     $this->module->click('More info');
     $this->module->seeInCurrentUrl('/info');
 }
 public function testHttpAuth()
 {
     $this->module->amOnPage('/auth');
     $this->module->seeResponseCodeIs(401);
     $this->module->see('Unauthorized');
     $this->module->amHttpAuthenticated('davert', 'password');
     $this->module->amOnPage('/auth');
     $this->module->dontSee('Unauthorized');
     $this->module->see("Welcome, davert");
     $this->module->amHttpAuthenticated('davert', '123456');
     $this->module->amOnPage('/auth');
     $this->module->see('Forbidden');
 }
 public function testAmpersand()
 {
     $this->module->amOnPage('/info');
     $this->module->see('Kill & Destroy');
     $this->module->see('Kill & Destroy', 'div');
 }
 public function testSeeInsideFails()
 {
     $this->shouldFail();
     $this->module->amOnPage('/info');
     $this->module->see('woups', 'p');
 }
 private function loginToFacebook(PhpBrowser $browserModule)
 {
     // preconditions: #1 facebook test user is created
     $this->module->haveFacebookTestUserAccount();
     $testUserName = $this->module->grabFacebookTestUserName();
     // preconditions: #2 test user is logged in on facebook
     $this->module->haveTestUserLoggedInOnFacebook();
     // go to our page with facebook login button
     $browserModule->amOnPage('/facebook');
     // check that yet we are not logged in on facebook
     $browserModule->see('You are not Connected.');
     // click on "Login with Facebook" button to start login with facebook
     $browserModule->click('Login with Facebook');
     // check that we are logged in with facebook
     $browserModule->see('Your User Object (/me)');
     $browserModule->see($testUserName);
 }
Beispiel #9
0
 /**
  * Get facebook test user be logged in on facebook.
  *
  * @throws ModuleConfigException
  */
 public function haveTestUserLoggedInOnFacebook()
 {
     if (!array_key_exists('id', $this->testUser)) {
         throw new ModuleException(__CLASS__, 'Facebook test user was not found. Did you forget to create one?');
     }
     // go to facebook and make login; it work only if you visit facebook.com first
     $this->phpBrowser->amOnPage('https://www.facebook.com/');
     $this->phpBrowser->sendAjaxPostRequest('login.php', ['email' => $this->grabFacebookTestUserEmail(), 'pass' => $this->testUser['password']]);
     $this->phpBrowser->see($this->grabFacebookTestUserName());
 }
Beispiel #10
0
 public function testApostrophesInText()
 {
     $this->module->amOnPage('/info');
     $this->module->see("Don't do that at home!");
     $this->module->see("Don't do that at home!", 'h3');
 }