Skip to content

Commit 2ed527f

Browse files
Merge pull request #2057 from senid231/fix-new-customer-auth-account-tom-select-flaky
Fix flaky feature specs: use select_tom_select_by_value for fillable tom-select fields
2 parents d7115d8 + 95e8b1b commit 2ed527f

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

spec/features/rate_management/project/create_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
let(:fill_form!) do
2222
fill_in 'Name', with: new_attrs[:name]
2323
fill_in_tom_select 'Vendor', with: new_attrs[:vendor].name, search: true
24-
fill_in_tom_select 'Account', with: new_attrs[:account].name, search: true
24+
select_tom_select_by_value 'Account', { new_attrs[:account].id => new_attrs[:account].name }
2525
fill_in_tom_select 'Routing group', with: new_attrs[:routing_group].name
2626
fill_in_tom_select 'Routeset discriminator', with: new_attrs[:routeset_discriminator].name
27-
fill_in_tom_select 'Gateway', with: new_attrs[:gateway].name
27+
select_tom_select_by_value 'Gateway', { new_attrs[:gateway].id => new_attrs[:gateway].name }
2828
end
2929

3030
let(:new_attrs) do
@@ -63,9 +63,9 @@
6363
let(:fill_form!) do
6464
fill_in 'Name', with: new_attrs[:name]
6565
fill_in_tom_select 'Vendor', with: new_attrs[:vendor].name, search: true
66-
fill_in_tom_select 'Account', with: new_attrs[:account].name, search: true
66+
select_tom_select_by_value 'Account', { new_attrs[:account].id => new_attrs[:account].name }
6767
fill_in_tom_select 'Routing group', with: new_attrs[:routing_group].name
68-
fill_in_tom_select 'Gateway', with: new_attrs[:gateway].name
68+
select_tom_select_by_value 'Gateway', { new_attrs[:gateway].id => new_attrs[:gateway].name }
6969
fill_in_tom_select 'Routeset discriminator', with: new_attrs[:routeset_discriminator].name
7070
fill_in_tom_select 'Routing Tags', with: new_attrs[:routing_tags].first.name, multiple: true
7171
fill_in_tom_select 'Routing Tags', with: new_attrs[:routing_tags].second.name, multiple: true
@@ -179,10 +179,10 @@
179179
let(:fill_form!) do
180180
fill_in 'Name', with: new_attrs[:name]
181181
fill_in_tom_select 'Vendor', with: new_attrs[:vendor].name, search: true
182-
fill_in_tom_select 'Account', with: new_attrs[:account].name, search: true
182+
select_tom_select_by_value 'Account', { new_attrs[:account].id => new_attrs[:account].name }
183183
fill_in_tom_select 'Routing group', with: new_attrs[:routing_group].name
184184
fill_in_tom_select 'Routeset discriminator', with: new_attrs[:routeset_discriminator].name
185-
fill_in_tom_select 'Gateway', with: new_attrs[:gateway].name
185+
select_tom_select_by_value 'Gateway', { new_attrs[:gateway].id => new_attrs[:gateway].name }
186186
fill_in_tom_select 'Routing Tags', with: routing_tags.third.name, multiple: true
187187
fill_in_tom_select 'Routing Tags', with: Routing::RoutingTag::ANY_TAG, multiple: true
188188
fill_in_tom_select 'Routing Tags', with: routing_tags.first.name, multiple: true

spec/features/rate_management/project/update_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
let(:fill_form!) do
1515
fill_in 'Name', with: new_name
1616
clear_tom_select 'Gateway'
17-
fill_in_tom_select 'Gateway Group', with: gateway_group.display_name
17+
select_tom_select_by_value 'Gateway Group', { gateway_group.id => gateway_group.display_name }
1818
tom_select_deselect_values 'Routing Tags', values: record.routing_tags.map(&:name)
1919
end
2020

@@ -37,10 +37,10 @@
3737
context 'when project with same scope attributes exists' do
3838
let(:fill_form!) do
3939
fill_in_tom_select 'Vendor', with: another_project.vendor.name, search: true
40-
fill_in_tom_select 'Account', with: another_project.account.name, search: true
40+
select_tom_select_by_value 'Account', { another_project.account.id => another_project.account.name }
4141
fill_in_tom_select 'Routing group', with: another_project.routing_group.name
4242
fill_in_tom_select 'Routeset discriminator', with: another_project.routeset_discriminator.name
43-
fill_in_tom_select 'Gateway', with: another_gateway.name
43+
select_tom_select_by_value 'Gateway', { another_gateway.id => another_gateway.name }
4444
end
4545
let!(:another_project) do
4646
FactoryBot.create(:rate_management_project, :filled)

spec/features/routing/customers_auths/new_customer_auth_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
let(:fill_form!) do
2020
fill_in 'Name', with: 'Test'
2121
fill_in_tom_select 'Customer', with: customer.name, search: true
22-
fill_in_tom_select 'Account', with: account.name
22+
select_tom_select_by_value 'Account', { account.id => account.name }
2323
fill_in_tom_select 'DST Numberlist', with: dst_numberlist.display_name, search: true
2424
fill_in_tom_select 'SRC Numberlist', with: src_numberlist.display_name, search: true
25-
fill_in_tom_select 'Gateway', with: gateway.name
25+
select_tom_select_by_value 'Gateway', { gateway.id => gateway.name }
2626
fill_in_tom_select 'Rateplan', with: rateplan.name
2727
fill_in_tom_select 'Routing plan', with: routing_plan.name
2828
end

spec/features/routing/dialpeers/edit_dialpeer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
let!(:account) { FactoryBot.create(:account, contractor: vendor) }
139139
let(:fill_form!) do
140140
fill_in_tom_select 'Vendor', with: vendor.name, search: true
141-
fill_in_tom_select 'Account', with: account.name, search: true
141+
select_tom_select_by_value 'Account', { account.id => account.name }
142142
end
143143

144144
it 'does not update dialpeer' do
@@ -183,7 +183,7 @@
183183
context 'with gateway' do
184184
let(:fill_form!) do
185185
super()
186-
fill_in_tom_select 'Gateway', with: gateway.name, exact_label: true
186+
select_tom_select_by_value 'Gateway', { gateway.id => gateway.name }, exact_label: true
187187
end
188188

189189
it 'updates correctly' do
@@ -213,7 +213,7 @@
213213
context 'with gateway_group' do
214214
let(:fill_form!) do
215215
super()
216-
fill_in_tom_select 'Gateway Group', with: gateway_group.name
216+
select_tom_select_by_value 'Gateway Group', { gateway_group.id => gateway_group.name }
217217
end
218218

219219
it 'updates correctly' do

spec/features/routing/dialpeers/new_dialpeer_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
fill_in 'Initial rate', with: '0.1'
6868
fill_in 'Next rate', with: '0.2'
6969
fill_in_tom_select 'Vendor', with: vendor.display_name, search: true
70-
fill_in_tom_select 'Account', with: account.display_name, search: true
70+
select_tom_select_by_value 'Account', { account.id => account.display_name }
7171
fill_in_tom_select 'Routing group', with: routing_group.display_name
7272
fill_in_tom_select 'Routeset discriminator', with: routeset_discriminator.display_name
73-
fill_in_tom_select 'Gateway', with: gateway.display_name
73+
select_tom_select_by_value 'Gateway', { gateway.id => gateway.display_name }
7474
fill_in_tom_select 'Currency', with: currency.name
7575
end
7676

@@ -161,10 +161,10 @@
161161
fill_in 'Initial rate', with: '0.1'
162162
fill_in 'Next rate', with: '0.2'
163163
fill_in_tom_select 'Vendor', with: vendor.display_name, search: true
164-
fill_in_tom_select 'Account', with: account.display_name, search: true
164+
select_tom_select_by_value 'Account', { account.id => account.display_name }
165165
fill_in_tom_select 'Routing group', with: routing_group.display_name
166166
fill_in_tom_select 'Routeset discriminator', with: routeset_discriminator.display_name
167-
fill_in_tom_select 'Gateway Group', with: gateway_group.display_name
167+
select_tom_select_by_value 'Gateway Group', { gateway_group.id => gateway_group.display_name }
168168
fill_in_tom_select 'Currency', with: currency.name
169169
end
170170

@@ -193,11 +193,11 @@
193193
fill_in 'Initial rate', with: '0.1'
194194
fill_in 'Next rate', with: '0.2'
195195
fill_in_tom_select 'Vendor', with: vendor.display_name, search: true
196-
fill_in_tom_select 'Account', with: account.display_name, search: true
196+
select_tom_select_by_value 'Account', { account.id => account.display_name }
197197
fill_in_tom_select 'Routing group', with: routing_group.display_name
198198
fill_in_tom_select 'Routeset discriminator', with: routeset_discriminator.display_name
199-
fill_in_tom_select 'Gateway', with: gateway.display_name
200-
fill_in_tom_select 'Gateway Group', with: gateway_group.display_name
199+
select_tom_select_by_value 'Gateway', { gateway.id => gateway.display_name }
200+
select_tom_select_by_value 'Gateway Group', { gateway_group.id => gateway_group.display_name }
201201
fill_in_tom_select 'Currency', with: currency.name
202202
end
203203

0 commit comments

Comments
 (0)