mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 11:38:30 +02:00
Remove capybara-selenium
This commit is contained in:
parent
eda6772c6f
commit
d7dc1017b0
15 changed files with 126 additions and 162 deletions
2
test/fixtures/invoices.yml
vendored
2
test/fixtures/invoices.yml
vendored
|
@ -34,4 +34,4 @@ overdue:
|
|||
|
||||
for_payments_test:
|
||||
<<: *DEFAULTS
|
||||
sum_cache: 100.00
|
||||
total: 100.00
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,27 +27,6 @@ class BankLinkTest < ActiveSupport::TestCase
|
|||
travel_back
|
||||
end
|
||||
|
||||
def test_form_fields
|
||||
expected_response = {
|
||||
"VK_SERVICE": "1012",
|
||||
"VK_VERSION": "008",
|
||||
"VK_SND_ID": "SEB",
|
||||
"VK_STAMP": nil,
|
||||
"VK_AMOUNT": nil,
|
||||
"VK_CURR": "EUR",
|
||||
"VK_REF": "",
|
||||
"VK_MSG": "Order nr. ",
|
||||
"VK_RETURN": "return.url",
|
||||
"VK_CANCEL": "return.url",
|
||||
"VK_DATETIME": "2018-04-01T00:30:00+0300",
|
||||
"VK_MAC": "fPHKfBNwtyQI5ec1pnrlIUJI6nerGPwnoqx0K9/g40hsgUmum4QE1Eq992FR73pRXyE2+1dUuahEd3s57asM7MOD2Pb8SALA/+hi3jlqjiAAThdikDuJ+83LogSKQljLdd0BHwqe+O0WPeKaOmP2/HltOEIHpY3d399JAi1t7YA=",
|
||||
"VK_ENCODING": "UTF-8",
|
||||
"VK_LANG": "ENG"
|
||||
}.with_indifferent_access
|
||||
|
||||
assert_equal expected_response, @bank_link.form_fields
|
||||
end
|
||||
|
||||
def test_is_not_valid_without_response
|
||||
assert_equal false, @bank_link.valid_response?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue