示例#1
0
 public function testValidDetails(\FunctionalTester $I)
 {
     $I->wantTo('test logging in with the correct details');
     LoginPage::openBy($I);
     LoginPage::loginAsUser($I);
     $I->seeCurrentUrlEquals(IndexPage::$url);
 }
示例#2
0
 protected function login(FunctionalTester $I, $name, $password)
 {
     $loginPage = LoginPage::openBy($I);
     $I->seeInTitle('Login');
     $loginPage->login($name, $password);
     $I->see('Logout', '.nav');
 }
示例#3
0
 public function testLogin(AcceptanceTester $I)
 {
     $I->wantTo('ensure that login works');
     $loginPage = LoginPage::openBy($I);
     $I->seeInTitle('Login');
     $I->amGoingTo('try to login with empty credentials');
     $loginPage->login('', '');
     if (method_exists($I, 'wait')) {
         $I->wait(1);
         // only for selenium
     }
     $I->expectTo('see validations errors');
     $I->see('Username cannot be blank.');
     $I->see('Password cannot be blank.');
     $I->amGoingTo('try to login with wrong credentials');
     $loginPage->login('admin', 'wrong');
     if (method_exists($I, 'wait')) {
         $I->wait(1);
         // only for selenium
     }
     $I->expectTo('see validations errors');
     $I->see('Incorrect username or password.');
     $I->amGoingTo('try to login with correct credentials');
     $loginPage->login('admin', 'adminpass');
     if (method_exists($I, 'wait')) {
         $I->wait(2);
         // only for selenium
     }
     $I->expectTo('see user info');
     $I->seeLink('Profile', '.nav');
     $I->dontSeeLink('Login', '.nav');
     $I->dontSeeLink('Signup', '.nav');
 }
示例#4
0
 public function _before(\FunctionalTester $I)
 {
     $this->page = 'tests\\codeception\\_pages\\project\\CreatePage';
     $this->params = [];
     $this->project = '\\NewProject';
     LoginPage::openBy($I);
     LoginPage::loginAsManager($I);
 }
示例#5
0
 public function _before(\FunctionalTester $I)
 {
     $this->page = 'tests\\codeception\\_pages\\activity\\UpdatePage';
     $this->params = ['id' => \Activity::$id];
     $this->activity = '\\NewActivity';
     LoginPage::openBy($I);
     LoginPage::loginAsCoordinator($I);
 }
示例#6
0
 public function testVolunteerFormLinkAsUser(\FunctionalTester $I)
 {
     LoginPage::openBy($I);
     LoginPage::loginAsUser($I);
     $I->seeCurrentUrlEquals(IndexPage::$url);
     $I->seeLink(IndexPage::$logoutLinkText);
     $I->click(IndexPage::$volunteerFormButtonText, IndexPage::$contentSelector);
     $I->seeCurrentUrlEquals(VolunteerPage::$url);
 }
示例#7
0
 protected function login(AcceptanceTester $I, $name = 'admin', $password = '******')
 {
     $loginPage = LoginPage::openBy($I);
     $I->seeInTitle('Login');
     $loginPage->login($name, $password);
     if (method_exists($I, 'wait')) {
         $I->wait(2);
         // only for selenium
     }
     $I->see('Profile', '.nav');
 }
示例#8
0
 /**
  * @after logout
  */
 public function testLogin(FunctionalTester $I)
 {
     $I->wantTo('ensure that login works');
     $loginPage = LoginPage::openBy($I);
     $I->seeInTitle('Login');
     $I->amGoingTo('try to login with empty credentials');
     $loginPage->login('', '');
     $I->expectTo('see validations errors');
     $I->see('Username cannot be blank.');
     $I->see('Password cannot be blank.');
     $I->amGoingTo('try to login with wrong credentials');
     $loginPage->login('admin', 'wrong');
     $I->expectTo('see validations errors');
     $I->see('Incorrect username or password.');
     $I->amGoingTo('try to login with correct credentials');
     $loginPage->login('admin', 'adminpass');
     $I->expectTo('see user info');
     $I->see('Profile', '.nav');
 }
示例#9
0
 public function testFollowActivity(\FunctionalTester $I)
 {
     $I->wantTo('check that Follow button works');
     LoginPage::openBy($I);
     LoginPage::loginAsUser($I);
     IndexPage::openBy($I);
     $I->seeLink(IndexPage::$followButtonText, IndexPage::getFollowLink(\Project::$id));
     $I->dontSeeLink(IndexPage::$unfollowButtonText, IndexPage::getUnfollowLink(\Project::$id));
     $I->sendAjaxPostRequest(IndexPage::getFollowLink(\Project::$id));
     IndexPage::openBy($I);
     $I->seeRecord('app\\models\\ProjectActivityFollowers', ['activityID' => \ProjectActivity::$id, 'usersFollowing' => \Yii::$app->getUser()->getId()]);
     $I->seeLink(IndexPage::$unfollowButtonText, IndexPage::getUnfollowLink(\Project::$id));
     $I->dontSeeLink(IndexPage::$followButtonText, IndexPage::getFollowLink(\Project::$id));
 }
示例#10
0
 public function _before(\FunctionalTester $I)
 {
     $I->wantTo('log in so I can test the volunteer page');
     LoginPage::openBy($I);
     LoginPage::loginAsUser($I);
 }