Add registrant area tests

This commit is contained in:
Artur Beljajev 2018-08-15 12:57:15 +03:00
parent ca5edb16fa
commit 5a466206bf
5 changed files with 112 additions and 1 deletions

View file

@ -9,6 +9,8 @@ john:
code: john-001 code: john-001
auth_info: cacb5b auth_info: cacb5b
uuid: eb2f2766-b44c-4e14-9f16-32ab1a7cb957 uuid: eb2f2766-b44c-4e14-9f16-32ab1a7cb957
created_at: <%= Time.zone.parse('2010-07-05').to_s(:db) %>
updated_at: <%= Time.zone.parse('2010-07-06').to_s(:db) %>
william: &william william: &william
name: William name: William

View file

@ -4,7 +4,11 @@ shop:
registrar: bestnames registrar: bestnames
registrant: john registrant: john
transfer_code: 65078d5 transfer_code: 65078d5
valid_to: 2010-07-05 registered_at: <%= Time.zone.parse('2010-07-04').to_s(:db) %>
valid_to: <%= Time.zone.parse('2010-07-05').to_s(:db) %>
outzone_at: <%= Time.zone.parse('2010-07-06').to_s(:db) %>
delete_at: <%= Time.zone.parse('2010-07-07').to_s(:db) %>
force_delete_at: <%= Time.zone.parse('2010-07-08').to_s(:db) %>
period: 1 period: 1
period_unit: m period_unit: m
uuid: 1b3ee442-e8fe-4922-9492-8fcb9dccc69c uuid: 1b3ee442-e8fe-4922-9492-8fcb9dccc69c

View file

@ -0,0 +1,27 @@
require 'test_helper'
class RegistrantAreaContactDetailsTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@contact = contacts(:john)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_general_data
visit registrant_domain_contact_url(domains(:shop), @contact)
assert_text 'Code john-001'
assert_text 'Name John'
assert_text 'Auth info'
assert_css('[value="cacb5b"]')
assert_text 'Ident 1234'
assert_text 'Email john@inbox.test'
assert_text 'Phone +555.555'
assert_text "Created at #{l Time.zone.parse('2010-07-05')}"
assert_text "Updated at #{l Time.zone.parse('2010-07-06')}"
end
end

View file

@ -0,0 +1,58 @@
require 'test_helper'
class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@domain = domains(:shop)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_general_data
visit registrant_domain_url(@domain)
assert_text 'Name shop.test'
assert_text "Registered at #{l Time.zone.parse('2010-07-04')}"
assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar)
assert_text 'Transfer code'
assert_css('[value="65078d5"]')
assert_text "Valid to #{l Time.zone.parse('2010-07-05')}"
assert_text "Outzone at #{l Time.zone.parse('2010-07-06')}"
assert_text "Delete at #{l Time.zone.parse('2010-07-07')}"
assert_text "Force delete at #{l Time.zone.parse('2010-07-08')}"
end
def test_registrant
visit registrant_domain_url(@domain)
assert_text 'Name John'
assert_text 'Code john-001'
assert_text 'Ident 1234'
assert_text 'Email john@inbox.test'
assert_text 'Phone +555.555'
assert_link 'View details', href: registrant_domain_contact_path(@domain, @domain.registrant)
end
def test_admin_contacts
visit registrant_domain_url(@domain)
within('.admin-domain-contacts') do
assert_link 'Jane', href: registrant_domain_contact_path(@domain, contacts(:jane))
assert_text 'jane-001'
assert_text 'jane@mail.test'
assert_css '.admin-domain-contact', count: 1
end
end
def test_tech_contacts
visit registrant_domain_url(@domain)
within('.tech-domain-contacts') do
assert_link 'William', href: registrant_domain_contact_path(@domain, contacts(:william))
assert_text 'william-001'
assert_text 'william@inbox.test'
assert_css '.tech-domain-contact', count: 2
end
end
end

View file

@ -0,0 +1,20 @@
require 'test_helper'
class RegistrantAreaDomainListTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@domain = domains(:shop)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_show_domain_list
visit registrant_domains_url
assert_link 'shop.test', href: registrant_domain_path(@domain)
assert_link 'John', href: registrant_domain_contact_path(@domain, @domain.registrant)
assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar)
assert_text l(Time.zone.parse('2010-07-05'))
assert_css '.domains .domain', count: 5
end
end