forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintenance: Ported auth test to capybara.
- Loading branch information
1 parent
55e99d7
commit 3036453
Showing
5 changed files
with
55 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,42 @@ | |
require 'rails_helper' | ||
|
||
RSpec.describe 'Authentication', type: :system do | ||
|
||
it 'Login', authenticated_as: false do | ||
login( | ||
username: '[email protected]', | ||
password: 'test', | ||
) | ||
|
||
expect_current_route 'dashboard' | ||
|
||
refresh | ||
|
||
# Check that cookies is temporary. | ||
cookie = cookie('^_zammad.+?') | ||
expect(cookie[:expires]).to eq(nil) | ||
end | ||
|
||
it 'Login with remember me', authenticated_as: false do | ||
login( | ||
username: '[email protected]', | ||
password: 'test', | ||
remember_me: true | ||
) | ||
|
||
expect_current_route 'dashboard' | ||
|
||
refresh | ||
|
||
# Check that cookies has a expire date. | ||
cookie = cookie('^_zammad.+?') | ||
expect(cookie[:expires]).to be_truthy | ||
|
||
logout | ||
expect_current_route 'login', wait: 10 | ||
|
||
# Check that cookies has no longer a expire date after logout. | ||
cookie = cookie('^_zammad.+?') | ||
expect(cookie[:expires]).to eq(nil) | ||
end | ||
|
||
it 'Logout' do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,15 @@ | |
it 'fqdn is visible on login page' do | ||
expect(page).to have_css('.login p', text: Setting.get('fqdn')) | ||
end | ||
|
||
it 'Login with wrong credentials' do | ||
within('#login') do | ||
fill_in 'username', with: '[email protected]' | ||
fill_in 'password', with: 'wrong' | ||
|
||
click_button | ||
end | ||
|
||
expect(page).to have_css('#login .alert') | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.