bard-attachment_field 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bard/attachment_field/cucumber.rb +14 -14
- data/lib/bard/attachment_field/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32a9e349c2ce7715b8a5732e730bbd96efb6c50f542b0f39fd470a1b39b2952e
|
|
4
|
+
data.tar.gz: 1da2861ccab4b81ffc92f0dc6b933c9266b07ba2b96747469d3030de9f44f9f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26808a1afc2c0156726a2fb3443a600efb194bdf87ad4d9a284896e0a53ed24ba3cae9170875fa7bb27cc933de8eafa71fc5116669531ab3431329c59ec6c323
|
|
7
|
+
data.tar.gz: 0f48786c5c1eea01995a6e8d04e41f3cb24c5866456b99068d1a4cf6bbedf41e5879df2d02b4f28b02bb5b939f454a9230e2f7bf7e0a49c5a09ef618b200a2cd
|
|
@@ -62,6 +62,17 @@ module Bard::AttachmentField::TestHelper
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
def wait_for_no_files(session, element_id, selector = "attachment-file", timeout: 10)
|
|
66
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
67
|
+
loop do
|
|
68
|
+
count = session.evaluate_script("document.getElementById('#{element_id}').querySelectorAll('#{selector}').length")
|
|
69
|
+
break if count == 0
|
|
70
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
|
71
|
+
raise "Expected no #{selector} in ##{element_id}, found #{count} after #{timeout}s" if elapsed > timeout
|
|
72
|
+
sleep 0.1
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
65
76
|
def wait_for_upload(session, element_id, timeout: 30)
|
|
66
77
|
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
67
78
|
loop do
|
|
@@ -189,11 +200,7 @@ When "I remove the file from {string}" do |field|
|
|
|
189
200
|
removeLink.click();
|
|
190
201
|
})(arguments[0])
|
|
191
202
|
JS
|
|
192
|
-
|
|
193
|
-
page.document.synchronize(5, errors: [Capybara::ElementNotFound]) do
|
|
194
|
-
fresh_element = page.find("##{element_id}")
|
|
195
|
-
expect(fresh_element).to have_no_css("attachment-file")
|
|
196
|
-
end
|
|
203
|
+
Bard::AttachmentField::TestHelper.wait_for_no_files(page, element_id)
|
|
197
204
|
end
|
|
198
205
|
|
|
199
206
|
When "I remove {string} from {string}" do |filename, field|
|
|
@@ -208,11 +215,7 @@ When "I remove {string} from {string}" do |filename, field|
|
|
|
208
215
|
removeLink.click();
|
|
209
216
|
})(arguments[0], arguments[1])
|
|
210
217
|
JS
|
|
211
|
-
|
|
212
|
-
page.document.synchronize(5, errors: [Capybara::ElementNotFound]) do
|
|
213
|
-
fresh_element = page.find("##{element_id}")
|
|
214
|
-
expect(fresh_element).to have_no_css("attachment-file[filename='#{filename}']")
|
|
215
|
-
end
|
|
218
|
+
Bard::AttachmentField::TestHelper.wait_for_no_files(page, element_id, "attachment-file[filename='#{filename}']")
|
|
216
219
|
end
|
|
217
220
|
|
|
218
221
|
When "I remove {string} from the {string} field" do |filename, field|
|
|
@@ -226,10 +229,7 @@ When "I remove {string} from the {string} field" do |filename, field|
|
|
|
226
229
|
removeLink.click();
|
|
227
230
|
})(arguments[0], arguments[1])
|
|
228
231
|
JS
|
|
229
|
-
|
|
230
|
-
fresh_element = page.find("##{element_id}")
|
|
231
|
-
expect(fresh_element).to have_no_css("attachment-file[filename='#{filename}']")
|
|
232
|
-
end
|
|
232
|
+
Bard::AttachmentField::TestHelper.wait_for_no_files(page, element_id, "attachment-file[filename='#{filename}']")
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
When "I drag the file {string} onto the {string} attachment field" do |path, field|
|