mirror of
https://github.com/internetee/registry.git
synced 2025-06-13 08:04:45 +02:00
changed tabs
This commit is contained in:
parent
02b5c8c4b6
commit
486fceca9c
3 changed files with 129 additions and 141 deletions
|
@ -11,42 +11,6 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helpers funcs
|
|
||||||
def createNewAdminUser(valid)
|
|
||||||
visit admin_admin_users_path
|
|
||||||
click_on 'New admin user'
|
|
||||||
|
|
||||||
fill_in 'Username', with: 'test_user_name'
|
|
||||||
# If valid=true creating valid user, if else, then with invalid data
|
|
||||||
if valid
|
|
||||||
fill_in 'Password', with: 'test_password'
|
|
||||||
fill_in 'Password confirmation', with: 'test_password'
|
|
||||||
else
|
|
||||||
fill_in 'Password', with: 'test_password'
|
|
||||||
fill_in 'Password confirmation', with: 'test_password2'
|
|
||||||
end
|
|
||||||
fill_in 'Identity code', with: '38903110313'
|
|
||||||
fill_in 'Email', with: 'oleg@tester.ee'
|
|
||||||
|
|
||||||
select 'Estonia', from: 'admin_user_country_code', match: :first
|
|
||||||
|
|
||||||
select_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[1]")
|
|
||||||
select_element.click
|
|
||||||
|
|
||||||
option_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[2]/div/div[1]")
|
|
||||||
option_element.click
|
|
||||||
|
|
||||||
click_on 'Save'
|
|
||||||
|
|
||||||
if valid
|
|
||||||
assert_text 'Record created'
|
|
||||||
else
|
|
||||||
assert_text 'Failed to create record'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
# "/admin/admin_users"
|
|
||||||
def test_create_new_admin_user
|
def test_create_new_admin_user
|
||||||
createNewAdminUser(true)
|
createNewAdminUser(true)
|
||||||
end
|
end
|
||||||
|
@ -92,13 +56,46 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
visit admin_admin_users_path
|
visit admin_admin_users_path
|
||||||
click_on 'test_user_name'
|
click_on 'test_user_name'
|
||||||
|
|
||||||
assert_text 'General'
|
assert_text 'General'
|
||||||
click_on 'Delete'
|
click_on 'Delete'
|
||||||
|
|
||||||
# Accept to delete in modal window
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
assert_text 'Record deleted'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def createNewAdminUser(valid)
|
||||||
|
visit admin_admin_users_path
|
||||||
|
click_on 'New admin user'
|
||||||
|
|
||||||
|
fill_in 'Username', with: 'test_user_name'
|
||||||
|
# If valid=true creating valid user, if else, then with invalid data
|
||||||
|
if valid
|
||||||
|
fill_in 'Password', with: 'test_password'
|
||||||
|
fill_in 'Password confirmation', with: 'test_password'
|
||||||
|
else
|
||||||
|
fill_in 'Password', with: 'test_password'
|
||||||
|
fill_in 'Password confirmation', with: 'test_password2'
|
||||||
|
end
|
||||||
|
fill_in 'Identity code', with: '38903110313'
|
||||||
|
fill_in 'Email', with: 'oleg@tester.ee'
|
||||||
|
|
||||||
|
select 'Estonia', from: 'admin_user_country_code', match: :first
|
||||||
|
|
||||||
|
select_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[1]")
|
||||||
|
select_element.click
|
||||||
|
|
||||||
|
option_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[2]/div/div[1]")
|
||||||
|
option_element.click
|
||||||
|
|
||||||
|
click_on 'Save'
|
||||||
|
|
||||||
|
if valid
|
||||||
|
assert_text 'Record created'
|
||||||
|
else
|
||||||
|
assert_text 'Failed to create record'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,10 +13,7 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
||||||
|
|
||||||
def test_remove_reserved_domain
|
def test_remove_reserved_domain
|
||||||
visit admin_reserved_domains_path
|
visit admin_reserved_domains_path
|
||||||
|
|
||||||
click_link_or_button 'Delete', match: :first
|
click_link_or_button 'Delete', match: :first
|
||||||
|
|
||||||
# Accept to delete in modal window
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
assert_text 'Domain deleted!'
|
assert_text 'Domain deleted!'
|
||||||
|
@ -24,11 +21,8 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
||||||
|
|
||||||
def test_add_invalid_domain
|
def test_add_invalid_domain
|
||||||
visit admin_reserved_domains_path
|
visit admin_reserved_domains_path
|
||||||
|
|
||||||
click_on 'New reserved domain'
|
click_on 'New reserved domain'
|
||||||
|
|
||||||
fill_in "Name", with: "@##@$"
|
fill_in "Name", with: "@##@$"
|
||||||
|
|
||||||
click_on 'Save'
|
click_on 'Save'
|
||||||
|
|
||||||
assert_text 'Failed to add domain!'
|
assert_text 'Failed to add domain!'
|
||||||
|
@ -36,11 +30,8 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
||||||
|
|
||||||
def test_update_reserved_domain
|
def test_update_reserved_domain
|
||||||
visit admin_reserved_domains_path
|
visit admin_reserved_domains_path
|
||||||
|
|
||||||
click_link_or_button 'Edit Pw', match: :first
|
click_link_or_button 'Edit Pw', match: :first
|
||||||
|
|
||||||
fill_in 'Password', with: '12345678'
|
fill_in 'Password', with: '12345678'
|
||||||
|
|
||||||
click_on 'Save'
|
click_on 'Save'
|
||||||
|
|
||||||
assert_text 'Domain updated!'
|
assert_text 'Domain updated!'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue