Files
openfoodnetwork/spec/system/admin/payments_taler_spec.rb
Maikel Linke 9d79119eb0 Link to payment action with title
The custom helper was adding a PowerTip which replaced the title
attribute with its own display. I removed the PowerTip and use a simple
title attribute. This should have several benefits:

- Capybara can find the link by the title.
- Screenreaders should be able read the title.
- Browser can show the title in the best position.
- Using the browser feature is more consistent and efficient.
2026-02-23 13:00:02 +11:00

53 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require 'system_helper'
RSpec.describe "Admin -> Order -> Payments" do
include AuthenticationHelper
include TableHelper
let(:distributor) { build(:distributor_enterprise) }
let(:order) { create(:completed_order_with_fees, distributor:, payments: [payment]) }
let(:payment) {
build(:payment, :completed, payment_method: taler, source: taler, response_code: "taler-id-1")
}
let(:taler) {
Spree::PaymentMethod::Taler.new(
name: "Taler",
distributors: [distributor],
environment: "test",
preferred_backend_url: "https://taler.example.com",
preferred_api_key: "sandbox",
)
}
before do
login_as distributor.owner
end
it "allows to refund a Taler payment" do
order_status = {
order_status: "paid",
contract_terms: {
amount: "KUDOS:2",
}
}
order_endpoint = "https://taler.example.com/private/orders/taler-id-1"
refund_endpoint = "https://taler.example.com/private/orders/taler-id-1/refund"
stub_request(:get, order_endpoint).to_return(body: order_status.to_json)
stub_request(:post, refund_endpoint).to_return(body: "{}")
visit spree.admin_order_payments_path(order.number)
within row_containing("Taler") do
expect(page).to have_text "COMPLETED"
expect(page).to have_link "Void"
click_link class: "icon-void"
expect(page).to have_text "VOID"
expect(page).not_to have_link "Void"
end
end
end