Remove redundant client tests ... fix session spec

This commit is contained in:
Martin Lensment 2014-10-16 12:22:17 +03:00
parent 0fe4841f50
commit 6eaa9215b1
6 changed files with 4 additions and 292 deletions

View file

@ -2,7 +2,7 @@ class Admin::DomainsController < AdminController
before_action :set_domain, only: [:show, :edit, :update] before_action :set_domain, only: [:show, :edit, :update]
def index def index
@q = Domain.search(params[:q]) @q = Domain.includes(:registrar, :owner_contact).search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
end end

View file

@ -4,7 +4,7 @@ class Client::DomainsController < ClientController
before_action :verify_deletion, only: [:destroy] before_action :verify_deletion, only: [:destroy]
def index def index
@q = current_registrar.domains.search(params[:q]) @q = current_registrar.domains.includes(:owner_contact).search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
end end

View file

@ -1,38 +0,0 @@
require 'rails_helper'
feature 'Contact management', type: :feature do
# background do
# end
before(:each) do
Fabricate(:user, country: Fabricate(:country, iso: 'EE'), admin: false, username: 'zone')
visit login_path
click_on 'ID card (zone)'
end
scenario 'User sees contacts', js: true do
Fabricate(:contact, registrar: Registrar.first)
Fabricate(:contact, registrar: Registrar.first)
visit client_contacts_path
expect(page).to have_text(Contact.first.name)
expect(page).to have_text(Contact.second.name)
end
scenario 'User creates contact', js: true do
visit client_contacts_path
click_on 'Create new contact'
fill_in('Name', with: 'John Doe The Third')
fill_in('Email', with: 'john@doe.eu')
fill_in('Phone', with: '+123.3213123')
fill_in('Ident', with: '312313')
click_on 'Save'
expect(current_path).to eq client_contact_path(Contact.first)
expect(page).to have_text('Contact added!')
expect(page).to have_text('Contact details')
expect(page).to have_text('John Doe The Third')
expect(Contact.first.registrar).to eq Registrar.first
end
end

View file

@ -1,124 +0,0 @@
require 'rails_helper'
feature 'Domain management', type: :feature do
background do
Fabricate(:registrar)
Fabricate(:domain_validation_setting_group)
Fabricate.times(4, :domain)
end
scenario 'User sees domains', js: true do
visit root_path
click_on 'Domains'
Domain.all.each do |x|
expect(page).to have_link(x)
expect(page).to have_link(x.registrar)
expect(page).to have_link(x.owner_contact)
end
end
scenario 'User adds a domain', js: true do
visit admin_domains_path
click_on 'Add'
fill_in('Domain name', with: 'example.ee')
fill_in('Period', with: 1)
fill_in('Registrar', with: 'zone', fill_options: { blur: false })
# TODO: Wait for poltergeist to support blur option, then uncomment these lines:
# expect(page).to have_text('Zone Media OÜ (10577829)')
# click_on('Zone Media OÜ (10577829)')
# expect(find_field('Registrar').value).to eq('Zone Media OÜ (10577829)')
# temporary solution:
page.execute_script("$('#domain_registrar_id').val('1')")
c = Contact.first
fill_in('Registrant', with: c.code, fill_options: { blur: false })
# TODO: Wait for poltergeist to support blur option, then uncomment these lines:
# expect(page).to have_text(c.code)
# click_on(c.code)
# expect(find_field('Registrar').value).to eq(c.code)
# temporary solution:
page.execute_script("$('#domain_owner_contact_id').val('1')")
click_on('Save')
expect(page).to have_text('Domain details')
expect(page).to have_text('example.ee')
expect(page).to have_link('Zone Media OÜ')
expect(page).to have_link(c.name, count: 3)
expect(page).to have_text(c.code)
expect(page).to have_text(c.ident)
expect(page).to have_text(c.email)
expect(page).to have_text(c.phone)
expect(page).to have_text('Nameservers count must be between 1-13')
end
scenario 'User adds nameserver to domain' do
d = Domain.first
visit admin_domain_path(d)
within('#nameservers') { click_on 'Add' }
fill_in('Hostname', with: 'ns1.example.ee')
fill_in('Ipv4', with: '192.168.1.1')
fill_in('Ipv6', with: 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329')
click_on 'Save'
expect(page).to have_text('Nameserver added!')
within('#nameservers') do
expect(page).to have_link('ns1.example.ee')
expect(page).to have_text('192.168.1.1')
expect(page).to have_text('FE80:0000:0000:0000:0202:B3FF:FE1E:8329')
end
end
scenario 'User adds status to domain' do
d = Domain.first
visit admin_domain_path(d)
within('#domain_statuses') { click_on 'Add' }
fill_in('Description', with: 'All is well.')
click_on 'Save'
expect(page).to have_text('Status added!')
within('#domain_statuses') do
expect(page).to have_text('ok')
expect(page).to have_text('All is well.')
end
end
scenario 'User adds technical contact', js: true do
d = Domain.first
visit admin_domain_path(d)
within('#tech_contacts') { click_on 'Add' }
c = Contact.last
fill_in('Contact', with: c.code, fill_options: { blur: false })
# TODO: Wait for poltergeist to support blur option, then uncomment these lines:
# expect(page).to have_text(c.code)
# click_on(c.code)
# expect(find_field('Tech contact').value).to eq(c.code)
# temporary solution:
page.execute_script("$('#domain_contact_contact_id').val('#{c.id}')")
click_on 'Save'
expect(page).to have_text('Contact added!')
within('#tech_contacts') do
expect(page).to have_link(c.name)
expect(page).to have_text(c.email)
end
end
end

View file

@ -1,126 +0,0 @@
require 'rails_helper'
feature 'Domain transfer', type: :feature do
let(:elkdata) { Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' }) }
let(:zone) { Fabricate(:registrar) }
let(:zone_user) { Fabricate(:user, registrar: zone, username: 'zone', admin: false, identity_code: '37810013087') }
let(:elkdata_user) do
Fabricate(:user, registrar: elkdata, username: 'elkdata', admin: false, identity_code: '37810013261')
end
background do
Fabricate(:domain_validation_setting_group)
Fabricate(:domain_general_setting_group)
Fabricate(:dnskeys_setting_group)
Fabricate(:domain, registrar: zone)
end
scenario 'Registrar requests transfer on own domain', js: true do
sign_in zone_user
click_on 'Domains'
click_on 'Domain transfers list'
click_on 'Request domain transfer'
fill_in 'Domain name', with: 'false'
click_on 'Request domain transfer'
expect(page).to have_text('Domain was not found!')
d = Domain.first
fill_in 'Domain name', with: d.name
click_on 'Request domain transfer'
expect(page).to have_text('Password invalid!')
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_text('Domain already belongs to the querying registrar')
end
scenario 'Other registrar requests transfer with 0 wait time' do
sign_in elkdata_user
d = Domain.first
visit client_domains_path
expect(page).to_not have_link(d.name)
visit new_client_domain_transfer_path
fill_in 'Domain name', with: d.name
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_text('Domain transfer approved!')
expect(page).to have_text('serverApproved')
visit client_domains_path
expect(page).to have_link(d.name)
end
scenario 'Other registrar requests transfer with 1 wait time' do
s = Setting.find_by(code: 'transfer_wait_time')
s.value = 1
s.save
sign_in elkdata_user
d = Domain.first
visit client_domains_path
expect(page).to_not have_link(d.name)
visit new_client_domain_transfer_path
fill_in 'Domain name', with: d.name
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_text('Domain transfer requested!')
expect(page).to have_text('pending')
visit new_client_domain_transfer_path
fill_in 'Domain name', with: d.name
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_text('Domain transfer requested!')
expect(page).to have_text('pending')
visit client_domains_path
expect(page).to_not have_link(d.name)
end
scenario 'Domain owner approves request' do
s = Setting.find_by(code: 'transfer_wait_time')
s.value = 1
s.save
d = Domain.first
d.domain_transfers.create(
status: DomainTransfer::PENDING,
transfer_requested_at: Time.zone.now,
transfer_to: elkdata,
transfer_from: zone
)
sign_in elkdata_user
visit new_client_domain_transfer_path
fill_in 'Domain name', with: d.name
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_text('Domain transfer requested!')
expect(page).to_not have_button('Approve')
sign_in zone_user
visit new_client_domain_transfer_path
fill_in 'Domain name', with: d.name
fill_in 'Domain password', with: d.auth_info
click_on 'Request domain transfer'
expect(page).to have_link('Approve')
click_on 'Approve'
expect(page).to have_text('Domain transfer approved!')
expect(page).to have_text('clientApproved')
sign_in elkdata_user
visit client_domains_path
expect(page).to have_link(d.name)
end
end

View file

@ -5,9 +5,9 @@ feature 'Sessions', type: :feature do
let(:zone) { Fabricate(:registrar) } let(:zone) { Fabricate(:registrar) }
background do background do
Fabricate(:user, registrar: zone, username: 'elkdata', identity_code: '37810013261') create_settings
Fabricate(:user, registrar: nil, identity_code: '37810013261')
Fabricate(:user, registrar: zone, username: 'zone', admin: false, identity_code: '37810013087') Fabricate(:user, registrar: zone, username: 'zone', admin: false, identity_code: '37810013087')
Fabricate(:domain_validation_setting_group)
Fabricate.times(2, :domain, registrar: zone) Fabricate.times(2, :domain, registrar: zone)
Fabricate.times(2, :domain, registrar: elkdata) Fabricate.times(2, :domain, registrar: elkdata)
end end