コード例 #1
0
ファイル: AuthCest.php プロジェクト: inoplate/account
 public function checkAuthEndpoint(FunctionalTester $I)
 {
     $I->wantTo('Visit login endpoint');
     $I->amOnPage('login');
     $I->seeResponseCodeIs(200);
     $I->wantTo('Visit register endpoint');
     $I->amOnPage('register');
     $I->seeResponseCodeIs(200);
 }
コード例 #2
0
ファイル: LoginCest.php プロジェクト: rhamlet1/Hazid
 public function testValidDetails(\FunctionalTester $I)
 {
     $I->wantTo('test logging in with the correct details');
     LoginPage::openBy($I);
     LoginPage::loginAsUser($I);
     $I->seeCurrentUrlEquals(IndexPage::$url);
 }
コード例 #3
0
 /**
  *
  * @param \FunctionalTester $I
  * @param \Codeception\Scenario $scenario
  */
 public function testUserRegistration($I, $scenario)
 {
     $I->wantTo('ensure that registration works');
     $registrationPage = RegistrationPage::openBy($I);
     $I->see('Sign up', 'h1');
     $I->amGoingTo('submit registration form with no data');
     $registrationPage->submit([]);
     $I->expectTo('see validations errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('E-mail cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->see('Repeated password cannot be blank.', '.help-block');
     $I->amGoingTo('submit registration form with not correct email and repeated password');
     $registrationPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'password2' => 'tester_password2']);
     $I->expectTo('see that email address and repeated password is wrong');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->dontSee('Password cannot be blank.', '.help-block');
     $I->dontSee('Repeated password cannot be blank.', '.help-block');
     $I->see('E-mail is not a valid email address.', '.help-block');
     $I->see('Repeated password must be repeated exactly.', '.help-block');
     $I->amGoingTo('submit registration form with correct data');
     $registrationPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'password2' => 'tester_password']);
     $registrationPage = RegistrationPage::openBy($I);
     $I->amGoingTo('submit registration form with same data');
     $registrationPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'password2' => 'tester_password']);
     $I->expectTo('see that username and email address have already been taken');
     $I->see('Username "tester" has already been taken.', '.help-block');
     $I->see('E-mail "*****@*****.**" has already been taken.', '.help-block');
     //        $I->expectTo('see that user logged in');
     //        $I->seeLink('Logout (tester)');
 }
コード例 #4
0
ファイル: CreateCest.php プロジェクト: rhamlet1/Hazid
 public function testPageContent(\FunctionalTester $I)
 {
     $I->wantTo('test that the project creation page works');
     CreatePage::openBy($I, $this->params);
     $I->see(CreatePage::$headingText, CreatePage::$headingSelector);
     $I->see(CreatePage::$placeholderText);
 }
コード例 #5
0
 public function guestCantVisitRolesPage(FunctionalTester $I)
 {
     $I->am('a guest');
     $I->wantTo('make sure I can\'t view the roles page');
     //I can see the menu item
     $I->amOnPage('/roles');
     $I->canSeeCurrentUrlEquals('/login');
 }
コード例 #6
0
ファイル: LoginCest.php プロジェクト: VasileGabriel/humhub
 public function testUnApprovedUser(FunctionalTester $I)
 {
     $I->wantTo('ensure that unapproved user cannot login');
     $loginPage = LoginPage::openBy($I);
     $loginPage->login('UnApprovedUser', '123qwe');
     $I->expectTo('see validations errors');
     $I->see('Your account is not approved yet!');
 }
コード例 #7
0
ファイル: WPDbUserCest.php プロジェクト: lucatume/wp-browser
 /**
  * @test
  * it should insert a user in the database allowing for user defaults override
  */
 public function it_should_insert_a_user_in_the_database_allowing_for_user_defaults_override(FunctionalTester $I)
 {
     $I->wantTo('insert a user in the database overriding defaults');
     $table = $I->grabPrefixedTableNameFor('users');
     $overrides = ['user_pass' => 'luca12345678', 'user_nicename' => 'lucatume', 'user_email' => '*****@*****.**', 'user_url' => 'http://theaveragedev.com', 'user_status' => 1, 'user_activation_key' => 'foo', 'display_name' => 'theAverageDev'];
     $I->haveUserInDatabase('Luca', 'subscriber', $overrides);
     $I->seeUserInDatabase($overrides);
 }
コード例 #8
0
ファイル: ResetPasswordCest.php プロジェクト: rhamlet1/Hazid
 public function testValidPassword(\FunctionalTester $I)
 {
     $I->wantTo('test that supplying valid new password succeeds');
     ResetPasswordPage::setNewPassword($I, Auth::$newPassword);
     $I->seeCurrentUrlEquals(IndexPage::$url);
     $I->see('Your new password has been saved.');
     $hash = $I->grabRecord('app\\models\\User', ['email' => Auth::$validEmail])->passwordHash;
     $I->assertTrue(Yii::$app->getSecurity()->validatePassword(Auth::$newPassword, $hash));
 }
コード例 #9
0
ファイル: VehiclesCest.php プロジェクト: tekkie/autolog-api
 public function updateItem(FunctionalTester $I, $scenario)
 {
     $I->wantTo('modify an existing item');
     $I->sendPUT('/vehicles/123', ['name' => 'Pansy updated']);
     $scenario->incomplete('work in progress');
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['id' => 123, 'name' => 'Pansy updated']);
 }
コード例 #10
0
 public function GetTimestamp(Tester $I)
 {
     $I->wantTo('Get Current Server Timestamp, make sure it is smaller than local');
     $I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
     $I->sendGET("currenttime", ["source" => $this->apiInfo[Helper::CSV_ORDER_SOURCE]]);
     $response = $I->grabResponse();
     $timeDifference = time() - intval($response);
     $I->assertTrue($timeDifference < 90 && $timeDifference > -90);
 }
コード例 #11
0
 public function testRegisterSuccsess(FunctionalTester $I)
 {
     $I->wantTo('register a user');
     $I->amOnPage('/register');
     $I->fillField('name', 'JohnDoe');
     $I->fillField('email', '*****@*****.**');
     $I->fillField('password', 'admin');
     $I->fillField('password_confirmation', 'admin');
     $I->click('Continue');
     $I->amOnPage('/');
 }
コード例 #12
0
ファイル: LoginCest.php プロジェクト: oliverpool/tinyissue
 /**
  * @param FunctionalTester $I
  *
  * @return void
  */
 public function invalidUsernamePassword(FunctionalTester $I)
 {
     $I->wantTo('login with invalid username/password');
     $I->amOnAction('HomeController@getIndex');
     $I->dontSeeAuthentication();
     $I->see('Login');
     $I->fillField('Email', '*****@*****.**');
     $I->fillField('Password', '1234');
     $I->click('Login');
     $I->dontSeeAuthentication();
 }
コード例 #13
0
ファイル: LoginCest.php プロジェクト: inoplate/account
 public function trySigninWithInvalidCredentials(FunctionalTester $I)
 {
     $I->wantTo('Login as user with invalid credentials');
     $I->dontSeeAuthentication();
     $I->amOnPage('/login');
     $I->fillField('identifier', 'spectator');
     $I->fillField('password', 'invalid');
     $I->click('button[type=submit]');
     $I->seeCurrentUrlEquals('/login');
     $I->dontSeeAuthentication();
 }
コード例 #14
0
ファイル: IndexCest.php プロジェクト: rhamlet1/Hazid
 public function testVolunteerFormLinkWithLogin(\FunctionalTester $I)
 {
     $I->wantTo('check that logging in after trying to access the volunteer form redirects me to the volunteer form');
     IndexPage::openBy($I);
     $I->click(IndexPage::$volunteerFormButtonText, IndexPage::$contentSelector);
     $I->seeCurrentUrlEquals(LoginPage::$url);
     LoginPage::loginAsUser($I);
     $I->seeCurrentUrlEquals(VolunteerPage::$url);
     $I->seeLink(VolunteerPage::$logoutLinkText);
     $I->see(VolunteerPage::$headingText, VolunteerPage::$headingSelector);
 }
コード例 #15
0
ファイル: FormTests.php プロジェクト: rhamlet1/Hazid
 public function testValidDetails(\FunctionalTester $I)
 {
     $page = $this->page;
     $activity = $this->activity;
     $I->wantTo('test that submitting valid data is successful');
     $page::openBy($I, $this->params);
     $page::submit($I, ['project' => $activity::$project, 'name' => $activity::$name, 'date' => $activity::$date, 'description' => $activity::$description]);
     $I->seeCurrentUrlEquals(IndexPage::$url);
     $I->see($activity::$name);
     $I->seeRecord('app\\models\\ProjectActivity', ['projectID' => $activity::$project, 'name' => $activity::$name, 'date' => $activity::$date, 'description' => $activity::$description]);
 }
コード例 #16
0
 public function memberCanLeave(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('leave build brighton');
     //Load and login a known member
     $user = User::find(1);
     Auth::login($user);
     $I->amOnPage('/account/' . $user->id . '');
     $I->canSee('Active');
     $I->click("Leave Build Brighton");
     $I->canSee('Leaving');
 }
コード例 #17
0
 public function teamMemberCanEditLog(FunctionalTester $I)
 {
     $I->am('a laser team member');
     $I->wantTo('make sure I can edit laser logs');
     //Load and login a known admin member
     $user = $I->loginLaserTeamMember();
     $otherUser = User::find(1);
     $I->amOnPage('/equipment/laser');
     $I->see($otherUser->name);
     $I->selectOption('form[name=equipmentLog] select[name=reason]', 'testing');
     $I->click('Update');
 }
コード例 #18
0
ファイル: RegisterCest.php プロジェクト: inoplate/account
 public function tryRegisterDesiredInputWithDefaultRole(FunctionalTester $I)
 {
     $I->haveRecord('roles', ['id' => 2, 'name' => 'Spectator', 'slug' => 'spectator', 'landing' => 'admin/profile', 'is_default' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     $I->wantTo('Register a user with desired input');
     $I->amOnPage('/register');
     $I->fillField('username', 'usertest');
     $I->fillField('email', '*****@*****.**');
     $I->fillField('password', '123456');
     $I->fillField('password_confirmation', '123456');
     $I->click('button[type=submit]');
     $I->seeRecord('users', ['username' => 'usertest']);
     $I->seeCurrentUrlEquals('/login');
 }
コード例 #19
0
ファイル: PasswordCest.php プロジェクト: inoplate/account
 public function tryToResetPasswordWithValidToken(FunctionalTester $I)
 {
     $I->seeRecord('password_resets', ['email' => '*****@*****.**']);
     $I->wantTo('Reset my password invalid token');
     $I->amOnPage('/password/reset/reset-token');
     $I->fillField('email', '*****@*****.**');
     $I->fillField('password', '123456');
     $I->fillField('password_confirmation', '123456');
     $I->click('button[type=submit]');
     $I->dontSeeRecord('password_resets', ['email' => '*****@*****.**']);
     $I->seeAuthentication();
     $I->seeCurrentUrlEquals('/admin/dashboard');
 }
コード例 #20
0
 public function financeMemberCanVisitPaymentPage(FunctionalTester $I)
 {
     $I->am('a member of the finance group');
     $I->wantTo('make sure I can view the payments page');
     //Load and login a known member
     $user = User::find(3);
     $role = Role::findByName('finance');
     $role->users()->attach($user->id);
     Auth::login($user);
     $I->amOnPage('/payments');
     $I->seeCurrentUrlEquals('/payments');
     $I->see('Payments');
 }
コード例 #21
0
ファイル: CrudUserCest.php プロジェクト: oliverpool/tinyissue
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteUser(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('delete an existing user details');
     $admin = $I->createUser(1, 4);
     $user = $I->createUser(2, 1);
     $user1 = $I->createUser(3, 2);
     $I->amLoggedAs($admin);
     $I->amOnAction('Administration\\UsersController@getDelete', ['user' => $user]);
     $I->seeCurrentActionIs('Administration\\UsersController@getIndex');
     $I->dontSee($user->fullname);
     $I->see($user1->fullname);
 }
コード例 #22
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteProject(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('delete an existing project details');
     $project = $I->createProject(1);
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $I->amOnAction('ProjectController@getEdit', ['project' => $project]);
     $I->click(trans('tinyissue.delete_something', ['name' => $project->name]));
     $I->seeCurrentActionIs('ProjectsController@getIndex');
     $I->dontSeeLink('Project 1');
     $I->amOnAction('ProjectsController@getIndex', ['status' => Project::STATUS_ARCHIVED]);
     $I->dontSeeLink('Project 1');
     $I->dontSeeRecord($project->getTable(), ['name' => 'Project 1']);
 }
コード例 #23
0
ファイル: FormTests.php プロジェクト: rhamlet1/Hazid
 public function testValidImageUpload(\FunctionalTester $I)
 {
     $page = $this->page;
     $project = $this->project;
     $I->wantTo('test that uploading a valid image with description succeeds');
     $page::openBy($I, $this->params);
     $page::submit($I, ['name' => $project::$name, 'coordinator' => $project::$coordinator, 'status' => $project::$status, 'image' => $I->getTestImageFilename(), 'imageDescription' => $project::$imageDescription]);
     $I->seeCurrentUrlMatches(IndexPage::$regexUrl);
     $I->see($project::$name);
     $I->seeRecord('app\\models\\Project', ['name' => $project::$name, 'coordinator' => $project::$coordinator, 'status' => $project::$status]);
     $record = $I->grabRecord('app\\models\\Project', ['name' => $project::$name]);
     $I->seeRecord('app\\models\\ProjectImage', ['projectID' => $record->projectID, 'description' => $project::$imageDescription, 'dateTaken' => $project::$imageTimestamp]);
     $imageRecord = $I->grabRecord('app\\models\\ProjectImage', ['projectID' => $record->projectID, 'description' => $project::$imageDescription, 'dateTaken' => $project::$imageTimestamp]);
     $I->assertContains(pathinfo($I->getTestImageFilename(), PATHINFO_EXTENSION), $imageRecord->filename);
 }
コード例 #24
0
 public function testValidEmail(\FunctionalTester $I)
 {
     $I->wantTo('test that submitting a valid email succeeds');
     RequestPasswordResetPage::openBy($I);
     $I->cleanDir($I->getEmailDir());
     RequestPasswordResetPage::submitEmail($I, Auth::$validEmail);
     $I->see(RequestPasswordResetPage::$successText);
     $I->seeFileFound('*.eml', $I->getEmailDir());
     $I->openFile($I->getFirstEmailPath());
     $I->seeInThisFile(Email::$resetSubject);
     $I->seeInThisFile(Email::$resetText);
     $I->seeInThisFile(Email::$resetLink);
     $user = $I->grabRecord('app\\models\\User', ['email' => Auth::$validEmail]);
     $I->assertNotEmpty($user->passwordResetToken);
 }
コード例 #25
0
ファイル: UpdateCest.php プロジェクト: rhamlet1/Hazid
 public function testEmailActivityFollowers(\FunctionalTester $I)
 {
     $I->wantTo('check that email notifications are sent when an activity is updated');
     // first follow project
     IndexPage::openBy($I);
     $I->sendAjaxPostRequest(IndexPage::getFollowLink(\ProjectActivity::$id));
     // update project
     $I->cleanDir($I->getEmailDir());
     self::testValidDetails($I);
     $I->seeFileFound('*.eml', $I->getEmailDir());
     $I->openFile($I->getFirstEmailPath());
     $I->seeInThisFile(\Email::$followActivitySubject);
     $I->seeInThisFile(\Email::$followActivityText);
     $I->seeInThisFile(\Email::$followActivityLink);
 }
コード例 #26
0
ファイル: CrudTagCest.php プロジェクト: oliverpool/tinyissue
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function updateTag(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('edit an existing tag');
     $tag = (new Tag())->where('group', '=', false)->get()->random(1);
     $data = ['name' => 'tag updated'];
     $tagName = $tag->name;
     $I->amLoggedAs($I->createUser(1, 4));
     $I->amOnAction('Administration\\TagsController@getIndex');
     $I->click($this->_editTagSelector($tagName));
     $I->seeCurrentActionIs('Administration\\TagsController@getEdit', ['tag' => $tag]);
     $I->submitForm('form', $data);
     $I->amOnAction('Administration\\TagsController@getIndex');
     $I->see($data['name'], $this->_editTagSelector($data['name']));
     $I->dontSee($data['name'], $this->_editTagSelector($tagName));
 }
コード例 #27
0
 public function adminCanDeclineExpenses(FunctionalTester $I)
 {
     $I->am('an admin');
     $I->wantTo('make sure I can decline an expense');
     //Create a proposal that's currently open
     $I->haveInDatabase('expenses', ['id' => 4, 'category' => 'consumables', 'description' => 'Another Description', 'user_id' => '3', 'amount' => 1234, 'expense_date' => Carbon::now()]);
     //Load and login a known member
     $user = User::find(3);
     Auth::login($user);
     $I->amOnPage('/expenses');
     $I->canSee('Expenses');
     $I->canSee('Another Description');
     $I->cantSee('Declined by');
     $I->click('Decline');
     $I->canSee('Declined by');
 }
コード例 #28
0
ファイル: SignupCest.php プロジェクト: rhamlet1/Hazid
 public function testEmailVerification(\FunctionalTester $I)
 {
     $I->wantTo('check that the email verification system works');
     // First signup as a new user.
     SignupPage::openBy($I);
     SignupPage::signup($I, ['email' => NewUser::$email, 'password' => NewUser::$password, 'forename' => NewUser::$forename, 'surname' => NewUser::$surname]);
     $I->seeCurrentUrlEquals(IndexPage::$url);
     // Now get token.
     $token = $I->grabRecord('app\\models\\User', ['email' => NewUser::$email])->emailVerifyToken;
     $I->assertNotEmpty($token);
     // Access verification page.
     $I->amOnPage('/user/verify-email?token=' . $token);
     $I->seeCurrentUrlEquals(IndexPage::$url);
     $I->see('Your email address has been verified.');
     $user = $I->grabRecord('app\\models\\User', ['email' => NewUser::$email]);
     $I->assertEquals(1, $user->emailVerified);
     $I->assertEmpty($user->emailVerifyToken);
 }
コード例 #29
0
ファイル: IssueCest.php プロジェクト: oliverpool/tinyissue
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function assignToUser(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to assign an issue to a user');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $issue = $I->createIssue(1, $admin, null, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSee($developer1->fullname, '.assigned-to .currently_assigned');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postAssign', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
     $I->comment($I->getResponseContent());
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see($developer1->fullname, '.assigned-to .currently_assigned');
 }
コード例 #30
0
 /**
  *
  * @param \FunctionalTester $I
  * @param \Codeception\Scenario $scenario
  */
 public function testUserRegistration($I, $scenario)
 {
     /** @var Module $module */
     $module = \Yii::$app->getModule('users');
     $I->wantTo('ensure that registration works');
     $registrationPage = RegistrationPage::openBy($I);
     $I->see('Sign up', 'h1');
     $I->amGoingTo('submit registration form with no data');
     $registrationPage->submit([]);
     $I->expectTo('see validations errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('E-mail cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->see('Repeated password cannot be blank.', '.help-block');
     $I->amGoingTo('submit registration form with not correct email and repeated password');
     $registrationPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'password2' => 'tester_password2']);
     $I->expectTo('see that email address and repeated password is wrong');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->dontSee('Password cannot be blank.', '.help-block');
     $I->dontSee('Repeated password cannot be blank.', '.help-block');
     $I->see('E-mail is not a valid email address.', '.help-block');
     $I->see('Repeated password must be repeated exactly.', '.help-block');
     $I->amGoingTo('submit registration form with correct data');
     $registrationPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'password2' => 'tester_password']);
     $I->expectTo('see that user is created');
     /** @var User $user */
     $user = $I->grabRecord(User::className(), ['username' => 'tester', 'email' => '*****@*****.**']);
     if ($module->registrationConfirmation) {
         /** @var Token $token */
         $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_REGISTRATION_CONFIRMATION]);
         $I->seeInEmailSubject('Registration confirmation');
         $I->seeInEmailRecipients('*****@*****.**');
         $I->seeInEmail($token->token);
     }
     $registrationPage = RegistrationPage::openBy($I);
     $I->amGoingTo('submit registration form with same data');
     $registrationPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'password2' => 'tester_password']);
     $I->expectTo('see that username and email address have already been taken');
     $I->see('Username "tester" has already been taken.', '.help-block');
     $I->see('E-mail "*****@*****.**" has already been taken.', '.help-block');
     //        $I->expectTo('see that user logged in');
     //        $I->seeLink('Logout (tester)');
 }