diff_test 0.7.0 → 0.8.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e1c998d4518e8fa85ca6b032ea150f6583faae256ca6cd0a898db1b5f36b5a
|
4
|
+
data.tar.gz: b82d63f526687c9f15399b68500be58ef4a3b52bda449125f3a6efa8f0bc0895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3e4317b88e81d8d98094c19169de1d75d0458b4fae14fa79ea0ef8b5cf7a00f71344c3e6631248177f58140c2efcd4e063ecdd04031b9ca05d1bb1187d26d22
|
7
|
+
data.tar.gz: 04b161c82a2e075484540abedfb0111c51c6bb8f8f7eb4ecd713f9075e921c09a0c201d0d0f21424239031c10308c8870d3239bcd7b0e3f54e439709df84c512
|
@@ -36,13 +36,26 @@ module DiffTest
|
|
36
36
|
def script
|
37
37
|
<<~HTML
|
38
38
|
<script>
|
39
|
+
let timeout = null
|
39
40
|
var owner = globalThis || window
|
40
41
|
owner.diffTestTrackedJsFiles = owner.diffTestTrackedJsFiles || [];
|
41
42
|
owner.diffTestTrackJsFile = function(file_path) {
|
43
|
+
owner.diffTestTrackedJsFiles.push(file_path);
|
44
|
+
if(!timeout) {
|
45
|
+
timeout = setTimeout(flushTrackedJsFiles, 0);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
owner.diffTestTrackJsFileAuto = owner.diffTestTrackJsFile;
|
50
|
+
|
51
|
+
function flushTrackedJsFiles() {
|
52
|
+
timeout = null
|
53
|
+
const file_paths = owner.diffTestTrackedJsFiles;
|
54
|
+
owner.diffTestTrackedJsFiles = [];
|
55
|
+
|
42
56
|
const path = "/__diff_test_js_beacon";
|
43
|
-
const payload = JSON.stringify({ test_id: #{DiffTest::TestExecution.current.id.to_json},
|
57
|
+
const payload = JSON.stringify({ test_id: #{DiffTest::TestExecution.current.id.to_json}, file_paths: file_paths });
|
44
58
|
|
45
|
-
owner.diffTestTrackedJsFiles.push(file_path);
|
46
59
|
if (owner.navigator && owner.navigator.sendBeacon) {
|
47
60
|
// Use sendBeacon in capable browsers/environments
|
48
61
|
window.navigator.sendBeacon(path, payload);
|
@@ -58,8 +71,6 @@ module DiffTest
|
|
58
71
|
});
|
59
72
|
}
|
60
73
|
}
|
61
|
-
|
62
|
-
owner.diffTestTrackJsFileAuto = owner.diffTestTrackJsFile;
|
63
74
|
</script>
|
64
75
|
HTML
|
65
76
|
end
|
@@ -19,7 +19,9 @@ module DiffTest
|
|
19
19
|
if path.include?('__diff_test_js_beacon')
|
20
20
|
body = env['rack.input'].read
|
21
21
|
json = JSON.parse(body)
|
22
|
-
|
22
|
+
json['file_paths'].each do |file_path|
|
23
|
+
DiffTest::Trackers::JsFile.record_by_test_id(json['test_id'], file_path)
|
24
|
+
end
|
23
25
|
[204, {}, []]
|
24
26
|
else
|
25
27
|
env.delete('HTTP_IF_NONE_MATCH')
|
data/lib/diff_test/version.rb
CHANGED