mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
covered blocked_domains with test, started account_activities
This commit is contained in:
parent
8fe9e46fc9
commit
db22f48990
3 changed files with 95 additions and 4 deletions
18
test/integration/admin_area/account_activities_test.rb
Normal file
18
test/integration/admin_area/account_activities_test.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'test_helper'
|
||||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaAccountActivitiesIntegrationTest < ApplicationSystemTestCase
|
||||
# /admin/account_activities
|
||||
include Devise::Test::IntegrationHelpers
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
@original_default_language = Setting.default_language
|
||||
end
|
||||
|
||||
|
||||
# TESTS
|
||||
# TODO
|
||||
|
||||
end
|
|
@ -30,17 +30,16 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
|
||||
select 'Estonia', from: 'admin_user_country_code', match: :first
|
||||
|
||||
# option_select = '//div[@class="selectize-input items has-options full has-items"]'
|
||||
# find(:xpath, ".//table/tr").click
|
||||
# select 'User', from: 'admin_user_roles_', match: :first
|
||||
# '//div[@class="selectize-input items has-options full has-items"]'
|
||||
select_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[1]")
|
||||
select_element.click
|
||||
|
||||
# /html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[2]/div/div[1]
|
||||
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 user created with valid data then record successfuly, else it failed
|
||||
if valid
|
||||
assert_text 'Record created'
|
||||
else
|
||||
|
|
74
test/integration/admin_area/blocked_domains_test.rb
Normal file
74
test/integration/admin_area/blocked_domains_test.rb
Normal file
|
@ -0,0 +1,74 @@
|
|||
require 'test_helper'
|
||||
require 'application_system_test_case'
|
||||
|
||||
|
||||
# /admin/blocked_domains
|
||||
class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
@blocked_domain = blocked_domains(:one)
|
||||
end
|
||||
|
||||
# HELPERS
|
||||
def visit_admin_blocked_domains_path
|
||||
visit admin_blocked_domains_path
|
||||
assert_text 'Blocked domains'
|
||||
end
|
||||
|
||||
def add_domain_into_blocked_list(value)
|
||||
click_on 'New blocked domain'
|
||||
assert_text 'Add domain to blocked list'
|
||||
|
||||
fill_in 'Name', with: @domain.name
|
||||
click_on 'Save'
|
||||
|
||||
return assert_text 'Domain added!' if value
|
||||
return assert_text 'Failed to add domain!'
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# TESTs
|
||||
def test_page_successfully_loaded
|
||||
visit_admin_blocked_domains_path
|
||||
end
|
||||
|
||||
def test_add_into_blocked_list
|
||||
visit_admin_blocked_domains_path
|
||||
add_domain_into_blocked_list(true)
|
||||
end
|
||||
|
||||
def test_add_into_blocked_list_same_domain
|
||||
visit_admin_blocked_domains_path
|
||||
add_domain_into_blocked_list(true)
|
||||
add_domain_into_blocked_list(false)
|
||||
end
|
||||
|
||||
def test_delete_domain_from_blocked_list
|
||||
visit_admin_blocked_domains_path
|
||||
add_domain_into_blocked_list(true)
|
||||
|
||||
click_link_or_button 'Delete', match: :first
|
||||
|
||||
# Accept to delete in modal window
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
assert_text 'Domain deleted!'
|
||||
end
|
||||
|
||||
def test_find_blocked_domain_from_blocked_list
|
||||
visit_admin_blocked_domains_path
|
||||
add_domain_into_blocked_list(true)
|
||||
|
||||
fill_in 'Name', with: @domain.name
|
||||
find(:xpath, "//span[@class='glyphicon glyphicon-search']").click
|
||||
|
||||
assert_text @domain.name
|
||||
end
|
||||
|
||||
def test_set_domain
|
||||
assert_equal @blocked_domain.name, BlockedDomain.find(name: @blocked_domain.name)
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue