From 1904d4a195ad985a1e3b5dc18d628175ddecafe3 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Fri, 24 Apr 2020 12:07:07 -0400 Subject: [PATCH] fixed tests and added missing frontend elements Signed-off-by: Victor Gonzalez --- .../modules/user/views/sign-in/signup.php | 2 +- frontend/views/article/view.php | 15 +++++++++++++++ tests/frontend/acceptance/LoginCept.php | 6 +++--- tests/frontend/acceptance/SignupCest.php | 19 ++++++++++++++++++- tests/frontend/functional/ArticleCest.php | 4 ++-- tests/frontend/functional/SignupCest.php | 6 +++++- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/frontend/modules/user/views/sign-in/signup.php b/frontend/modules/user/views/sign-in/signup.php index 590f85d4d..9e4725dfd 100755 --- a/frontend/modules/user/views/sign-in/signup.php +++ b/frontend/modules/user/views/sign-in/signup.php @@ -25,7 +25,7 @@ field($model, 'password_confirm')->passwordInput() ?>
- 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?> + 'btn btn-primary btn-lg btn-block', 'name' => 'signup-button']) ?>
diff --git a/frontend/views/article/view.php b/frontend/views/article/view.php index 45df81122..fc40648cd 100755 --- a/frontend/views/article/view.php +++ b/frontend/views/article/view.php @@ -52,6 +52,21 @@ body) ?> + + articleAttachments)): ?> +

+ +
diff --git a/tests/frontend/acceptance/LoginCept.php b/tests/frontend/acceptance/LoginCept.php index c37f68a43..f969753a3 100644 --- a/tests/frontend/acceptance/LoginCept.php +++ b/tests/frontend/acceptance/LoginCept.php @@ -13,14 +13,14 @@ $I->amGoingTo('submit login form with no data'); $loginPage->login('', ''); $I->expectTo('see validations errors'); -$I->see('Username or email cannot be blank.', '.help-block'); -$I->see('Password cannot be blank.', '.help-block'); +$I->see('Username or email cannot be blank.', '.alert.alert-danger'); +$I->see('Password cannot be blank.', '.alert.alert-danger'); $I->amGoingTo('try to login with wrong credentials'); $I->expectTo('see validations errors'); $loginPage->login('admin', 'wrong'); $I->expectTo('see validations errors'); -$I->see('Incorrect username or password.', '.help-block'); +$I->see('Incorrect username or password.', '.alert.alert-danger'); $I->amGoingTo('try to login with correct credentials'); $loginPage->login('webmaster', 'webmaster'); diff --git a/tests/frontend/acceptance/SignupCest.php b/tests/frontend/acceptance/SignupCest.php index a43add105..fe8ef5711 100644 --- a/tests/frontend/acceptance/SignupCest.php +++ b/tests/frontend/acceptance/SignupCest.php @@ -34,7 +34,7 @@ public function testUserSignup($I, $scenario) $I->wantTo('ensure that signup works'); $signupPage = SignupPage::openBy($I); - $I->see('Signup', 'h1'); + $I->see('Sign up', 'h1'); $I->amGoingTo('submit signup form with no data'); @@ -44,24 +44,41 @@ public function testUserSignup($I, $scenario) $I->see('Username cannot be blank.', '.alert.alert-danger'); $I->see('E-mail cannot be blank.', '.alert.alert-danger'); $I->see('Password cannot be blank.', '.alert.alert-danger'); + $I->see('Confirm Password cannot be blank.', '.alert.alert-danger'); $I->amGoingTo('submit signup form with not correct email'); $signupPage->submit([ 'username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', + 'password_confirm' => 'tester_password', ]); $I->expectTo('see that email address is wrong'); $I->dontSee('Username cannot be blank.', '.alert.alert-danger'); $I->dontSee('Password cannot be blank.', '.alert.alert-danger'); + $I->dontSee('Confirm Password cannot be blank.', '.alert.alert-danger'); $I->see('E-mail is not a valid email address.', '.alert.alert-danger'); + $I->amGoingTo('submit signup form with different passwords'); + $signupPage->submit([ + 'username' => 'tester', + 'email' => 'tester.email@example.com', + 'password' => 'tester_password', + 'password_confirm' => 'wrong_password', + ]); + + $I->expectTo('see that confirm password is wrong'); + $I->dontSee('Confirm Password cannot be blank.', '.alert.alert-danger'); + $I->dontSee('Password cannot be blank.', '.alert.alert-danger'); + $I->see('Confirm Password must be equal to "Password".', '.alert.alert-danger'); + $I->amGoingTo('submit signup form with correct email'); $signupPage->submit([ 'username' => 'tester', 'email' => 'tester.email@example.com', 'password' => 'tester_password', + 'password_confirm' => 'tester_password', ]); if (method_exists($I, 'wait')) { $I->wait(3); // only for selenium diff --git a/tests/frontend/functional/ArticleCest.php b/tests/frontend/functional/ArticleCest.php index 67e379e9d..50ad69ff2 100644 --- a/tests/frontend/functional/ArticleCest.php +++ b/tests/frontend/functional/ArticleCest.php @@ -9,8 +9,8 @@ public function testArticlesList(FunctionalTester $I) { $I->amOnPage(['article/index']); $I->canSee('Articles', 'h1'); - $I->canSee('Test Article 1', 'h2'); - $I->dontSee('Test Article 2', 'h2'); + $I->canSee('Test Article 1', '.h3.card-title'); + $I->dontSee('Test Article 2', '.h3.card-title'); } public function testArticleView(FunctionalTester $I) diff --git a/tests/frontend/functional/SignupCest.php b/tests/frontend/functional/SignupCest.php index 3d6e0c80d..e7c7c0a7f 100644 --- a/tests/frontend/functional/SignupCest.php +++ b/tests/frontend/functional/SignupCest.php @@ -48,7 +48,7 @@ public function testUserSignup($I, $scenario) $I->wantTo('ensure that signup works'); $signupPage = SignupPage::openBy($I); - $I->see('Signup', 'h1'); + $I->see('Sign up', 'h1'); $I->amGoingTo('submit signup form with no data'); @@ -58,17 +58,20 @@ public function testUserSignup($I, $scenario) $I->see('Username cannot be blank.', '.alert.alert-danger'); $I->see('E-mail cannot be blank.', '.alert.alert-danger'); $I->see('Password cannot be blank.', '.alert.alert-danger'); + $I->see('Confirm Password cannot be blank.', '.alert.alert-danger'); $I->amGoingTo('submit signup form with not correct email'); $signupPage->submit([ 'username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', + 'password_confirm' => 'tester_password', ]); $I->expectTo('see that email address is wrong'); $I->dontSee('Username cannot be blank.', '.alert.alert-danger'); $I->dontSee('Password cannot be blank.', '.alert.alert-danger'); + $I->dontSee('Password Confirm cannot be blank.', '.alert.alert-danger'); $I->see('E-mail is not a valid email address.', '.alert.alert-danger'); @@ -77,6 +80,7 @@ public function testUserSignup($I, $scenario) 'username' => 'tester', 'email' => 'tester.email@example.com', 'password' => 'tester_password', + 'password_confirm' => 'tester_password', ]); $I->expectTo('see that user is created');