trabajo-afectivo/test/browser/auth_test.rb

90 lines
1.6 KiB
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
2015-02-22 12:28:34 +00:00
require 'browser_test_helper'
class AuthTest < TestCase
def test_authentication
@browser = browser_instance
2016-03-10 07:39:41 +00:00
location(url: browser_url)
2015-02-22 12:28:34 +00:00
match(
css: '#login',
value: 'username',
2015-02-22 12:28:34 +00:00
)
2016-03-10 07:39:41 +00:00
click(css: '#login button')
2015-02-22 12:28:34 +00:00
sleep 4
match(
css: '#login',
value: 'username',
2015-02-22 12:28:34 +00:00
)
# login with username/password
login(
username: 'nicole.braun@zammad.org',
password: 'test',
2015-02-22 12:28:34 +00:00
)
tasks_close_all
2015-02-22 12:28:34 +00:00
# reload page
reload
2015-02-22 12:28:34 +00:00
# check if cookie is temporarily
watch_for(
css: 'body',
value: 'Overviews',
2015-02-22 12:28:34 +00:00
)
# verify session cookie
cookie(
name: '^_zammad.+?',
value: '.+?',
expires: '',
2015-02-22 12:28:34 +00:00
)
end
def test_authentication_new_browser_without_permanent_cookie_no_session_should_be
@browser = browser_instance
2016-03-10 07:39:41 +00:00
location(url: browser_url)
2015-02-22 12:28:34 +00:00
match(
css: '#login',
value: 'username',
2015-02-22 12:28:34 +00:00
)
end
def test_new_browser_with_permanent_cookie_login
@browser = browser_instance
2016-03-10 07:39:41 +00:00
location(url: browser_url)
2015-02-22 12:28:34 +00:00
# login with username/password
login(
username: 'nicole.braun@zammad.org',
password: 'test',
remember_me: true,
2015-02-22 12:28:34 +00:00
)
# check if cookie is temporarily
watch_for(
css: 'body',
value: 'Overviews',
2015-02-22 12:28:34 +00:00
)
# verify session cookie
cookie(
name: '^_zammad.+?',
value: '.+?',
expires: '\d{4}-\d{1,2}-\d{1,2}.+?',
2015-02-22 12:28:34 +00:00
)
logout
2015-02-22 12:28:34 +00:00
# verify session cookie
sleep 2
2015-02-22 12:28:34 +00:00
cookie(
name: '^_zammad.+?',
value: '.+?',
expires: '',
2015-02-22 12:28:34 +00:00
)
end
end