Use input labels in Voucher system spec

It's more robust, and closer to what the user sees and does. It's also
verifying that the labels are correctly connected to the inputs.
This commit is contained in:
Maikel Linke
2023-08-14 12:46:13 +10:00
parent ba53f31309
commit 91e4fb18ed

View File

@@ -50,9 +50,9 @@ describe '
context "with a flat rate voucher" do
it 'creates a voucher' do
# And I fill in the fields for a new voucher click save
fill_in 'vouchers_flat_rate_code', with: voucher_code
select "Flat", from: "vouchers_flat_rate_voucher_type"
fill_in 'vouchers_flat_rate_amount', with: amount
fill_in "Voucher Code", with: voucher_code
select "Flat", from: "Voucher Type"
fill_in "Amount", with: amount
click_button 'Save'
# Then I should get redirect to the entreprise voucher tab and see the created voucher
@@ -64,9 +64,9 @@ describe '
context "with a percentage rate voucher" do
it 'creates a voucher' do
# And I fill in the fields for a new voucher click save
fill_in 'vouchers_flat_rate_code', with: voucher_code
select "Percentage (%)", from: "vouchers_flat_rate_voucher_type"
fill_in 'vouchers_flat_rate_amount', with: amount
fill_in "Voucher Code", with: voucher_code
select "Percentage (%)", from: "Voucher Type"
fill_in "Amount", with: amount
click_button 'Save'
# Then I should get redirect to the entreprise voucher tab and see the created voucher