mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Remove capybara-selenium
This commit is contained in:
parent
eda6772c6f
commit
d7dc1017b0
15 changed files with 126 additions and 162 deletions
|
@ -1,9 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ListInvoicesTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
setup do
|
||||
@user = users(:api_bestnames)
|
||||
@registrar_invoices = @user.registrar.invoices
|
||||
login_as @user
|
||||
|
@ -17,6 +15,7 @@ class ListInvoicesTest < ActionDispatch::IntegrationTest
|
|||
|
||||
def test_show_single_invoice
|
||||
@invoice = invoices(:valid)
|
||||
@registrar_invoices = []
|
||||
@registrar_invoices << @invoice
|
||||
|
||||
visit registrar_invoices_path
|
||||
|
@ -26,14 +25,15 @@ class ListInvoicesTest < ActionDispatch::IntegrationTest
|
|||
|
||||
# This bastard fails, only unpaid invoice is attached to the registrar
|
||||
# TODO: Fix and uncomment
|
||||
# def test_show_multiple_invoices
|
||||
# @invoices = invoices
|
||||
# @invoices.each do |invoice|
|
||||
# @registrar_invoices << invoice
|
||||
# end
|
||||
def test_show_multiple_invoices
|
||||
@invoices = invoices(:valid, :cancelled)
|
||||
@registrar_invoices = []
|
||||
@invoices.each do |invoice|
|
||||
@registrar_invoices << invoice
|
||||
end
|
||||
|
||||
# visit registrar_invoices_path
|
||||
# assert_text "Unpaid", count: 2
|
||||
# assert_text "Invoice no.", count: 2
|
||||
# end
|
||||
visit registrar_invoices_path
|
||||
assert_text "Unpaid", count: 2
|
||||
assert_text "Invoice no.", count: 2
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
setup do
|
||||
@original_methods = ENV['payment_methods']
|
||||
@original_seb_URL = ENV['seb_payment_url']
|
||||
@original_bank_certificate = ENV['seb_bank_certificate']
|
||||
|
@ -15,19 +13,20 @@ class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
|||
ENV['seb_bank_certificate'] = 'test/fixtures/files/seb_bank_cert.pem'
|
||||
ENV['seb_seller_certificate'] = 'test/fixtures/files/seb_seller_key.pem'
|
||||
ENV['every_pay_payment_url'] = 'https://example.com/every_pay_url'
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
@original_vat_rate = @user.registrar.vat_rate
|
||||
@user.registrar.vat_rate = 0.2
|
||||
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
|
||||
teardown do
|
||||
ENV['every_pay_payment_url'] = @original_ep_url
|
||||
ENV['payment_methods'] = @original_methods
|
||||
ENV['seb_payment_url'] = @original_seb_URL
|
||||
ENV['seb_bank_certificate'] = @original_bank_certificate
|
||||
ENV['seb_seller_certificate'] = @original_seller_certificate
|
||||
@user.registrar.vat_rate = @original_vat_rate
|
||||
end
|
||||
|
||||
def create_invoice_and_visit_its_page
|
||||
|
@ -44,12 +43,12 @@ class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
|||
form = page.find('form')
|
||||
assert_equal 'https://example.com/seb_url', form['action']
|
||||
assert_equal 'post', form['method']
|
||||
assert_equal '240.00', form.find_by_id('VK_AMOUNT', visible: false).value
|
||||
assert_equal 'Order nr. 13150', form.find_by_id('VK_MSG', visible: false).value
|
||||
assert_equal '220.00', form.find_by_id('VK_AMOUNT', visible: false).value
|
||||
end
|
||||
|
||||
def test_create_new_Every_Pay_payment
|
||||
create_invoice_and_visit_its_page
|
||||
save_and_open_page
|
||||
click_link_or_button 'Every pay'
|
||||
expected_hmac_fields = 'account_id,amount,api_username,callback_url,' +
|
||||
'customer_url,hmac_fields,nonce,order_reference,timestamp,transaction_type'
|
||||
|
@ -58,6 +57,6 @@ class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'https://example.com/every_pay_url', form['action']
|
||||
assert_equal 'post', form['method']
|
||||
assert_equal expected_hmac_fields, form.find_by_id('hmac_fields', visible: false).value
|
||||
assert_equal '240.0', form.find_by_id('amount', visible: false).value
|
||||
assert_equal '220.0', form.find_by_id('amount', visible: false).value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewInvoiceTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
login_as users(:api_bestnames)
|
||||
setup do
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
@original_vat_rate = @user.registrar.vat_rate
|
||||
@user.registrar.vat_rate = 0.2
|
||||
end
|
||||
|
||||
teardown do
|
||||
@user.registrar.vat_rate = @original_vat_rate
|
||||
AccountActivity.destroy_all
|
||||
Invoice.destroy_all
|
||||
end
|
||||
|
||||
def test_show_balance
|
||||
|
@ -23,7 +31,7 @@ class NewInvoiceTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert_text 'Please pay the following invoice'
|
||||
assert_text 'Invoice no. 131050'
|
||||
assert_text 'Total without VAT 200,00'
|
||||
assert_text 'Subtotal 200,00 €'
|
||||
assert_text 'Pay invoice'
|
||||
end
|
||||
|
||||
|
@ -61,7 +69,7 @@ class NewInvoiceTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert_text 'Please pay the following invoice'
|
||||
assert_text 'Invoice no. 131050'
|
||||
assert_text 'Total without VAT 0,00'
|
||||
assert_text 'Subtotal 0,00 €'
|
||||
assert_text 'Pay invoice'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue