|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + +------------------------------------------------------------------------+ |
| 5 | + | Phalcon forum | |
| 6 | + +------------------------------------------------------------------------+ |
| 7 | + | Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) | |
| 8 | + +------------------------------------------------------------------------+ |
| 9 | + | This source file is subject to the New BSD License that is bundled | |
| 10 | + | with this package in the file LICENSE.txt. | |
| 11 | + | | |
| 12 | + | If you did not receive a copy of the license and are unable to | |
| 13 | + | obtain it through the world-wide-web, please send an email | |
| 14 | + | to [email protected] so we can send you a copy immediately. | |
| 15 | + +------------------------------------------------------------------------+ |
| 16 | + | Authors: Sergii Svyrydenko <[email protected]> | |
| 17 | + +------------------------------------------------------------------------+ |
| 18 | +*/ |
| 19 | + |
| 20 | +class AuthorizationCest |
| 21 | +{ |
| 22 | + public function shouldCheckAutorizationOnForumWithGit(AcceptanceTester $I) |
| 23 | + { |
| 24 | + $I->wantTo('check authorization on the forum with github'); |
| 25 | + |
| 26 | + $I->amOnPage('/discussions/hot'); |
| 27 | + $I->click('Log In'); |
| 28 | + $I-> fillField( 'login', '[email protected]'); |
| 29 | + $I->fillField('password', 'test123456'); |
| 30 | + $I->click('Sign in'); |
| 31 | + |
| 32 | + if (in_array('Reauthorization required', $I->grabMultiple('h2'))) { |
| 33 | + $I->click('#js-oauth-authorize-btn'); |
| 34 | + } |
| 35 | + |
| 36 | + $I->see('Welcome'); |
| 37 | + $I->canSeeInCurrentUrl('/discussions'); |
| 38 | + |
| 39 | + $I->amOnPage('/discussions/hot'); |
| 40 | + $I->click(".//*[@id='forum-navbar-collapse']/ul/li[8]/a"); |
| 41 | + $I->see('Goodbye!'); |
| 42 | + } |
| 43 | + |
| 44 | + public function shouldAuthorizationOnGitAndForum(AcceptanceTester $I) |
| 45 | + { |
| 46 | + $I->wantTo('check authorization on the github after that on the forum'); |
| 47 | + |
| 48 | + $I->amOnUrl('https://github.com'); |
| 49 | + $I->amOnPage('/login'); |
| 50 | + $I-> fillField( 'login', '[email protected]'); |
| 51 | + $I->fillField('password', 'test123456'); |
| 52 | + $I->click('commit'); |
| 53 | + $I->see('Learn Git and GitHub without any code!'); |
| 54 | + |
| 55 | + $I->amOnUrl($_SERVER['APP_URL']); |
| 56 | + $I->amOnPage('/'); |
| 57 | + $I->see('Hot'); |
| 58 | + $I->amOnPage('/discussions/hot'); |
| 59 | + $I->canSeeInCurrentUrl('/discussions/hot'); |
| 60 | + |
| 61 | + $I->click('Log In'); |
| 62 | + if (in_array('Reauthorization required', $I->grabMultiple('h2'))) { |
| 63 | + $I->click('#js-oauth-authorize-btn'); |
| 64 | + } |
| 65 | + |
| 66 | + $I->see('Welcome'); |
| 67 | + $I->canSeeInCurrentUrl('/discussions'); |
| 68 | + |
| 69 | + $I->amOnPage('/discussions/hot'); |
| 70 | + $I->click(".//*[@id='forum-navbar-collapse']/ul/li[8]/a"); |
| 71 | + $I->see('Goodbye!'); |
| 72 | + } |
| 73 | +} |
0 commit comments