logster 2.11.3 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +72 -11
- data/.gitignore +2 -0
- data/CHANGELOG.md +13 -3
- data/README.md +8 -0
- data/assets/javascript/.gitkeep +0 -0
- data/assets/javascript/chunk.143.2faa04830259ce9aa59a.js +22 -0
- data/assets/javascript/chunk.178.ca5ade1d8cbdbfbe6d72.js +22 -0
- data/assets/javascript/chunk.468.95dd450003497c781cb3.js +1213 -0
- data/assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js +579 -0
- data/assets/javascript/client-app.js +1261 -276
- data/assets/javascript/vendor.js +4199 -3514
- data/assets/stylesheets/.gitkeep +0 -0
- data/assets/stylesheets/client-app.css +1 -1
- data/assets/stylesheets/vendor.css +1 -1
- data/build_client_app.sh +6 -8
- data/client-app/.editorconfig +0 -1
- data/client-app/.eslintignore +2 -0
- data/client-app/.eslintrc +10 -0
- data/client-app/.gitignore +1 -1
- data/client-app/.prettierignore +21 -0
- data/client-app/.prettierrc +1 -0
- data/client-app/.template-lintrc.js +10 -0
- data/client-app/README.md +4 -5
- data/client-app/app/app.js +2 -2
- data/client-app/app/components/actions-menu.js +21 -21
- data/client-app/app/components/back-trace.js +89 -90
- data/client-app/app/components/env-tab.js +41 -29
- data/client-app/app/components/message-info.js +78 -75
- data/client-app/app/components/message-row.js +20 -17
- data/client-app/app/components/page-nav.js +33 -24
- data/client-app/app/components/panel-resizer.js +53 -37
- data/client-app/app/components/patterns-list.js +101 -84
- data/client-app/app/components/tab-contents.js +15 -19
- data/client-app/app/components/tabbed-section.js +30 -18
- data/client-app/app/components/time-formatter.js +29 -18
- data/client-app/app/controllers/index.js +143 -119
- data/client-app/app/controllers/show.js +17 -13
- data/client-app/app/helpers/or.js +1 -1
- data/client-app/app/initializers/app-init.js +23 -34
- data/client-app/app/lib/decorators.js +4 -2
- data/client-app/app/lib/preload.js +7 -4
- data/client-app/app/lib/utilities.js +55 -54
- data/client-app/app/models/group.js +20 -15
- data/client-app/app/models/message-collection.js +153 -148
- data/client-app/app/models/message.js +60 -58
- data/client-app/app/models/pattern-item.js +24 -22
- data/client-app/app/router.js +2 -2
- data/client-app/app/routes/index.js +19 -12
- data/client-app/app/routes/settings.js +12 -10
- data/client-app/app/routes/show.js +6 -4
- data/client-app/app/services/events.js +4 -0
- data/client-app/app/styles/app.css +2 -0
- data/client-app/app/templates/application.hbs +1 -2
- data/client-app/app/templates/components/actions-menu.hbs +23 -8
- data/client-app/app/templates/components/back-trace.hbs +10 -3
- data/client-app/app/templates/components/env-tab.hbs +9 -7
- data/client-app/app/templates/components/message-info.hbs +65 -34
- data/client-app/app/templates/components/message-row.hbs +25 -8
- data/client-app/app/templates/components/page-nav.hbs +34 -10
- data/client-app/app/templates/components/panel-resizer.hbs +3 -3
- data/client-app/app/templates/components/patterns-list.hbs +54 -20
- data/client-app/app/templates/components/tabbed-section.hbs +12 -4
- data/client-app/app/templates/components/time-formatter.hbs +1 -1
- data/client-app/app/templates/index.hbs +100 -78
- data/client-app/app/templates/settings.hbs +30 -19
- data/client-app/app/templates/show.hbs +9 -8
- data/client-app/config/ember-cli-update.json +18 -0
- data/client-app/config/environment.js +13 -13
- data/client-app/config/icons.js +3 -3
- data/client-app/config/targets.js +16 -8
- data/client-app/ember-cli-build.js +4 -4
- data/client-app/package.json +43 -30
- data/client-app/testem.js +16 -17
- data/client-app/tests/index.html +8 -1
- data/client-app/tests/integration/components/back-trace-test.js +32 -26
- data/client-app/tests/integration/components/env-tab-test.js +79 -53
- data/client-app/tests/integration/components/message-info-test.js +25 -23
- data/client-app/tests/integration/components/patterns-list-test.js +14 -11
- data/client-app/tests/test-helper.js +8 -4
- data/client-app/tests/unit/controllers/index-test.js +32 -16
- data/client-app/tests/unit/controllers/show-test.js +5 -5
- data/client-app/tests/unit/routes/index-test.js +5 -5
- data/client-app/tests/unit/routes/show-test.js +5 -5
- data/client-app/yarn.lock +9673 -0
- data/lib/logster/middleware/viewer.rb +12 -12
- data/lib/logster/version.rb +1 -1
- data/logster.gemspec +6 -3
- data/test/logster/middleware/test_viewer.rb +14 -8
- metadata +15 -6
- data/client-app/.eslintrc.js +0 -60
- data/client-app/.travis.yml +0 -28
- data/client-app/app/components/update-time.js +0 -21
- data/client-app/package-lock.json +0 -39196
@@ -1,84 +1,86 @@
|
|
1
1
|
import { module, test } from "qunit";
|
2
2
|
import { setupRenderingTest } from "ember-qunit";
|
3
|
-
import {
|
3
|
+
import { find, findAll, render } from "@ember/test-helpers";
|
4
4
|
import hbs from "htmlbars-inline-precompile";
|
5
|
-
import {
|
5
|
+
import { mutatePreload, uninitialize } from "client-app/lib/preload";
|
6
6
|
|
7
|
-
module("Integration | Component | back-trace", function(hooks) {
|
7
|
+
module("Integration | Component | back-trace", function (hooks) {
|
8
8
|
setupRenderingTest(hooks);
|
9
9
|
|
10
|
-
hooks.beforeEach(function() {
|
10
|
+
hooks.beforeEach(function () {
|
11
11
|
uninitialize();
|
12
12
|
});
|
13
13
|
|
14
|
-
hooks.afterEach(function() {
|
14
|
+
hooks.afterEach(function () {
|
15
15
|
uninitialize();
|
16
16
|
});
|
17
17
|
|
18
|
-
test("backtrace lines display and work correctly", async function(assert) {
|
18
|
+
test("backtrace lines display and work correctly", async function (assert) {
|
19
19
|
const backtrace = `/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'
|
20
20
|
/var/www/discourse/lib/permalink_constraint.rb:6:in \`matches?'
|
21
21
|
/var/www/discourse/plugins/discourse-prometheus/lib/middleware/metrics.rb:17:in \`call'
|
22
22
|
activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'`;
|
23
23
|
this.set("backtrace", backtrace);
|
24
|
-
await render(hbs
|
24
|
+
await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
|
25
25
|
|
26
26
|
const [gem, app, plugin, gem2] = findAll("a");
|
27
|
-
assert.
|
27
|
+
assert.strictEqual(
|
28
28
|
gem.href,
|
29
29
|
"https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
|
30
30
|
);
|
31
31
|
|
32
|
-
assert.
|
32
|
+
assert.strictEqual(
|
33
33
|
app.href,
|
34
34
|
"https://github.com/discourse/discourse/blob/ce512452b512b909c38e9c63f2a0e1f8c17a2399/lib/permalink_constraint.rb#L6"
|
35
35
|
);
|
36
36
|
|
37
|
-
assert.
|
37
|
+
assert.strictEqual(
|
38
38
|
plugin.href,
|
39
39
|
"https://github.com/discourse/discourse-prometheus/blob/master/lib/middleware/metrics.rb#L17"
|
40
40
|
);
|
41
41
|
|
42
|
-
assert.
|
42
|
+
assert.strictEqual(
|
43
43
|
gem2.href,
|
44
44
|
"https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
|
45
45
|
);
|
46
46
|
|
47
47
|
let gemLine = find("div.backtrace-line");
|
48
|
-
assert.
|
48
|
+
assert.strictEqual(
|
49
49
|
gemLine.textContent.trim(),
|
50
50
|
"activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in `exists?'",
|
51
51
|
"gem lines are truncated"
|
52
52
|
);
|
53
53
|
});
|
54
54
|
|
55
|
-
test("non-ruby backtraces don't break things", async function(assert) {
|
55
|
+
test("non-ruby backtraces don't break things", async function (assert) {
|
56
56
|
this.set(
|
57
57
|
"backtrace",
|
58
58
|
`m/<@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27448
|
59
59
|
m@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27560
|
60
60
|
string@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27869`
|
61
61
|
);
|
62
|
-
await render(hbs
|
62
|
+
await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
|
63
63
|
const lines = this.backtrace.split("\n");
|
64
64
|
findAll("div.backtrace-line").forEach((node, index) => {
|
65
|
-
assert.
|
65
|
+
assert.strictEqual(node.textContent.trim(), lines[index]);
|
66
66
|
});
|
67
67
|
});
|
68
68
|
|
69
|
-
test("Github links use commit sha", async function(assert) {
|
69
|
+
test("Github links use commit sha", async function (assert) {
|
70
70
|
const backtrace = `/var/www/discourse/lib/permalink_constraint.rb:6:in \`matches?'`;
|
71
71
|
let env = [
|
72
72
|
{ application_version: "123abc" },
|
73
|
-
{ application_version: "abc123" }
|
73
|
+
{ application_version: "abc123" },
|
74
74
|
];
|
75
75
|
this.setProperties({
|
76
76
|
backtrace,
|
77
|
-
env
|
77
|
+
env,
|
78
78
|
});
|
79
|
-
await render(
|
79
|
+
await render(
|
80
|
+
hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
|
81
|
+
);
|
80
82
|
let href = find("a").href;
|
81
|
-
assert.
|
83
|
+
assert.strictEqual(
|
82
84
|
href,
|
83
85
|
"https://github.com/discourse/discourse/blob/123abc/lib/permalink_constraint.rb#L6",
|
84
86
|
"uses the first application_version if there are multiple versions"
|
@@ -86,27 +88,31 @@ string@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27869`
|
|
86
88
|
|
87
89
|
env = { application_version: "567def" };
|
88
90
|
this.set("env", env);
|
89
|
-
await render(
|
91
|
+
await render(
|
92
|
+
hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
|
93
|
+
);
|
90
94
|
href = find("a").href;
|
91
|
-
assert.
|
95
|
+
assert.strictEqual(
|
92
96
|
href,
|
93
97
|
"https://github.com/discourse/discourse/blob/567def/lib/permalink_constraint.rb#L6",
|
94
98
|
"uses application_version when env is only a hash"
|
95
99
|
);
|
96
100
|
|
97
101
|
this.set("env", null);
|
98
|
-
await render(
|
102
|
+
await render(
|
103
|
+
hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
|
104
|
+
);
|
99
105
|
href = find("a").href;
|
100
|
-
assert.
|
106
|
+
assert.strictEqual(
|
101
107
|
href,
|
102
108
|
"https://github.com/discourse/discourse/blob/ce512452b512b909c38e9c63f2a0e1f8c17a2399/lib/permalink_constraint.rb#L6",
|
103
109
|
"falls back to preload if env doesn't contain application_version"
|
104
110
|
);
|
105
111
|
|
106
112
|
mutatePreload("application_version", null);
|
107
|
-
await render(hbs
|
113
|
+
await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
|
108
114
|
href = find("a").href;
|
109
|
-
assert.
|
115
|
+
assert.strictEqual(
|
110
116
|
href,
|
111
117
|
"https://github.com/discourse/discourse/blob/master/lib/permalink_constraint.rb#L6",
|
112
118
|
"falls back to master branch when neither preload nor application_version in env are available"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { module, test } from "qunit";
|
2
2
|
import { setupRenderingTest } from "ember-qunit";
|
3
|
-
import {
|
3
|
+
import { click, find, findAll, render } from "@ember/test-helpers";
|
4
4
|
import hbs from "htmlbars-inline-precompile";
|
5
5
|
import Message from "client-app/models/message";
|
6
6
|
import { init } from "client-app/lib/preload";
|
@@ -9,11 +9,14 @@ const time1 = new Date("2010-01-01T01:00:00").getTime();
|
|
9
9
|
const time2 = new Date("2015-01-01T01:00:00").getTime();
|
10
10
|
|
11
11
|
const message = Message.create({
|
12
|
-
env: [
|
12
|
+
env: [
|
13
|
+
{ a: "aa", b: "bb", time: time1 },
|
14
|
+
{ c: "cc", d: "dd", time: time2 },
|
15
|
+
],
|
13
16
|
});
|
14
17
|
|
15
18
|
const message2 = Message.create({
|
16
|
-
env: { e: "ee", f: "ff" }
|
19
|
+
env: { e: "ee", f: "ff" },
|
17
20
|
});
|
18
21
|
|
19
22
|
const message3 = Message.create({
|
@@ -21,12 +24,12 @@ const message3 = Message.create({
|
|
21
24
|
{ env_key_2: "value1", default_expanded: "vvv1", notExpanded: "dsdcz" },
|
22
25
|
{ env_key_2: "value2", default_expanded: "vvv2", notExpanded: "uerue" },
|
23
26
|
{ env_key_2: "value3", notExpanded: "weeww" },
|
24
|
-
{ env_key_2: "value4", notExpanded: "cxc" }
|
25
|
-
]
|
27
|
+
{ env_key_2: "value4", notExpanded: "cxc" },
|
28
|
+
],
|
26
29
|
});
|
27
30
|
|
28
31
|
const message4 = Message.create({
|
29
|
-
env: { env_key_2: "value", default_expanded: "vvv", notExpanded: "wwww" }
|
32
|
+
env: { env_key_2: "value", default_expanded: "vvv", notExpanded: "wwww" },
|
30
33
|
});
|
31
34
|
|
32
35
|
function reduceToContent(node) {
|
@@ -35,30 +38,38 @@ function reduceToContent(node) {
|
|
35
38
|
);
|
36
39
|
}
|
37
40
|
|
38
|
-
module("Integration | Component | env-tab", function(hooks) {
|
41
|
+
module("Integration | Component | env-tab", function (hooks) {
|
39
42
|
setupRenderingTest(hooks);
|
40
43
|
|
41
|
-
test("it renders", async function(assert) {
|
42
|
-
const callback = newPosition => this.set("envPosition", newPosition);
|
44
|
+
test("it renders", async function (assert) {
|
45
|
+
const callback = (newPosition) => this.set("envPosition", newPosition);
|
43
46
|
this.setProperties({
|
44
47
|
message,
|
45
48
|
callback,
|
46
|
-
envPosition: 0
|
49
|
+
envPosition: 0,
|
47
50
|
});
|
48
51
|
await render(
|
49
|
-
hbs
|
52
|
+
hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
|
50
53
|
);
|
51
54
|
|
52
|
-
assert.
|
55
|
+
assert.strictEqual(
|
53
56
|
find(".current-number").textContent,
|
54
57
|
"1/2",
|
55
58
|
"shows the current over the total number of env objects"
|
56
59
|
);
|
57
60
|
let trs = findAll("tr");
|
58
|
-
assert.
|
59
|
-
assert.
|
60
|
-
|
61
|
-
|
61
|
+
assert.strictEqual(trs.length, 3);
|
62
|
+
assert.strictEqual(
|
63
|
+
reduceToContent(trs[0]),
|
64
|
+
"a: aa",
|
65
|
+
"has the right content"
|
66
|
+
);
|
67
|
+
assert.strictEqual(
|
68
|
+
reduceToContent(trs[1]),
|
69
|
+
"b: bb",
|
70
|
+
"has the right content"
|
71
|
+
);
|
72
|
+
assert.strictEqual(
|
62
73
|
reduceToContent(trs[2]),
|
63
74
|
"time: 1 Jan 10",
|
64
75
|
"has the right content"
|
@@ -76,36 +87,52 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
76
87
|
assert.dom("button").doesNotExist("doesn't show buttons for non-array env");
|
77
88
|
|
78
89
|
trs = findAll("tr");
|
79
|
-
assert.
|
80
|
-
assert.
|
81
|
-
|
90
|
+
assert.strictEqual(trs.length, 2);
|
91
|
+
assert.strictEqual(
|
92
|
+
reduceToContent(trs[0]),
|
93
|
+
"e: ee",
|
94
|
+
"has the right content"
|
95
|
+
);
|
96
|
+
assert.strictEqual(
|
97
|
+
reduceToContent(trs[1]),
|
98
|
+
"f: ff",
|
99
|
+
"has the right content"
|
100
|
+
);
|
82
101
|
});
|
83
102
|
|
84
|
-
test("it works correctly", async function(assert) {
|
85
|
-
const callback = newPosition => this.set("envPosition", newPosition);
|
103
|
+
test("it works correctly", async function (assert) {
|
104
|
+
const callback = (newPosition) => this.set("envPosition", newPosition);
|
86
105
|
this.setProperties({
|
87
106
|
message,
|
88
107
|
callback,
|
89
|
-
envPosition: 0
|
108
|
+
envPosition: 0,
|
90
109
|
});
|
91
110
|
await render(
|
92
|
-
hbs
|
111
|
+
hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
|
93
112
|
);
|
94
113
|
|
95
114
|
const buttons = findAll("button.nav-btn");
|
96
115
|
await click(buttons[2]);
|
97
116
|
|
98
|
-
assert.
|
117
|
+
assert.strictEqual(
|
99
118
|
find(".current-number").textContent,
|
100
119
|
"2/2",
|
101
120
|
"shows the current over the total number of env objects"
|
102
121
|
);
|
103
122
|
|
104
123
|
const trs = findAll("tr");
|
105
|
-
assert.
|
106
|
-
assert.
|
107
|
-
|
108
|
-
|
124
|
+
assert.strictEqual(trs.length, 3);
|
125
|
+
assert.strictEqual(
|
126
|
+
reduceToContent(trs[0]),
|
127
|
+
"c: cc",
|
128
|
+
"has the right content"
|
129
|
+
);
|
130
|
+
assert.strictEqual(
|
131
|
+
reduceToContent(trs[1]),
|
132
|
+
"d: dd",
|
133
|
+
"has the right content"
|
134
|
+
);
|
135
|
+
assert.strictEqual(
|
109
136
|
reduceToContent(trs[2]),
|
110
137
|
"time: 1 Jan 15",
|
111
138
|
"has the right content"
|
@@ -119,51 +146,50 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
119
146
|
assert.ok(buttons[3].disabled, "forward buttons are disabled");
|
120
147
|
});
|
121
148
|
|
122
|
-
test("expandable env keys", async function(assert) {
|
123
|
-
document.getElementById(
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
});
|
149
|
+
test("expandable env keys", async function (assert) {
|
150
|
+
document.getElementById("preloaded-data").dataset.preloaded =
|
151
|
+
JSON.stringify({
|
152
|
+
env_expandable_keys: ["env_key_2", "default_expanded"],
|
153
|
+
});
|
128
154
|
init();
|
129
|
-
const callback = newPosition => this.set("envPosition", newPosition);
|
155
|
+
const callback = (newPosition) => this.set("envPosition", newPosition);
|
130
156
|
this.setProperties({
|
131
157
|
message: message3,
|
132
158
|
callback,
|
133
|
-
envPosition: 0
|
159
|
+
envPosition: 0,
|
134
160
|
});
|
135
161
|
await render(
|
136
|
-
hbs
|
162
|
+
hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
|
137
163
|
);
|
138
164
|
|
139
165
|
const trs = findAll(".env-table tr");
|
140
166
|
const expandable = trs[0];
|
141
167
|
const defaultExpanded = trs[1];
|
142
168
|
|
143
|
-
assert.
|
169
|
+
assert.strictEqual(
|
144
170
|
expandable.children[1].textContent.trim(),
|
145
171
|
"value1, 3 more",
|
146
172
|
"expandable env keys shown correctly"
|
147
173
|
);
|
148
174
|
|
149
|
-
assert.
|
175
|
+
assert.strictEqual(
|
150
176
|
defaultExpanded.children[1].textContent.trim(),
|
151
177
|
"vvv1, [vvv2]",
|
152
178
|
"list is expanded by default when its length is 3 or less"
|
153
179
|
);
|
154
180
|
|
155
|
-
assert.
|
181
|
+
assert.strictEqual(
|
156
182
|
findAll("a.expand-list").length,
|
157
183
|
1,
|
158
184
|
"only whitelisted env keys are expandable"
|
159
185
|
);
|
160
186
|
|
161
187
|
const expandBtn = find("a.expand-list");
|
162
|
-
assert.
|
188
|
+
assert.strictEqual(expandBtn.textContent.trim(), "3 more");
|
163
189
|
await click(expandBtn);
|
164
190
|
|
165
191
|
const expanded = find(".env-table tr");
|
166
|
-
assert.
|
192
|
+
assert.strictEqual(
|
167
193
|
expanded.children[1].textContent.trim(),
|
168
194
|
"value1, [value2, value3, value4]",
|
169
195
|
"expanded env keys shown correctly"
|
@@ -172,23 +198,23 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
172
198
|
this.setProperties({
|
173
199
|
message: message4,
|
174
200
|
callback,
|
175
|
-
envPosition: 0
|
201
|
+
envPosition: 0,
|
176
202
|
});
|
177
203
|
await render(
|
178
|
-
hbs
|
204
|
+
hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
|
179
205
|
);
|
180
206
|
const recreatedEnv = {};
|
181
|
-
findAll(".env-table tr").forEach(node => {
|
182
|
-
recreatedEnv[
|
183
|
-
node.children[
|
184
|
-
] = node.children[1].innerText.trim();
|
207
|
+
findAll(".env-table tr").forEach((node) => {
|
208
|
+
recreatedEnv[node.children[0].innerText.trim()] =
|
209
|
+
node.children[1].innerText.trim();
|
185
210
|
});
|
186
|
-
|
187
|
-
|
188
|
-
|
211
|
+
|
212
|
+
for (const [k, v] of Object.entries(recreatedEnv)) {
|
213
|
+
assert.strictEqual(
|
214
|
+
v,
|
189
215
|
this.message.env[k],
|
190
|
-
`${k}: ${
|
216
|
+
`${k}: ${v} === ${this.message.env[k]}`
|
191
217
|
);
|
192
|
-
}
|
218
|
+
}
|
193
219
|
});
|
194
220
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { module, test } from "qunit";
|
2
2
|
import { setupRenderingTest } from "ember-qunit";
|
3
|
-
import {
|
3
|
+
import { click, find, findAll, render } from "@ember/test-helpers";
|
4
4
|
import hbs from "htmlbars-inline-precompile";
|
5
5
|
import Message from "client-app/models/message";
|
6
6
|
|
@@ -10,45 +10,47 @@ const messageTitle = "This Is Title";
|
|
10
10
|
const message = Message.create({
|
11
11
|
backtrace,
|
12
12
|
message: messageTitle,
|
13
|
-
env: { c: "cc", d: "dd" }
|
13
|
+
env: { c: "cc", d: "dd" },
|
14
14
|
});
|
15
15
|
|
16
|
-
module("Integration | Component | message-info", function(hooks) {
|
16
|
+
module("Integration | Component | message-info", function (hooks) {
|
17
17
|
setupRenderingTest(hooks);
|
18
18
|
|
19
|
-
test("it renders", async function(assert) {
|
20
|
-
const callback = newPosition =>
|
19
|
+
test("it renders", async function (assert) {
|
20
|
+
const callback = (newPosition) =>
|
21
|
+
this.set("currentEnvPosition", newPosition);
|
21
22
|
this.setProperties({
|
22
23
|
actionsInMenu: true,
|
23
24
|
showTitle: false,
|
24
25
|
envPosition: 0,
|
25
26
|
message,
|
26
|
-
callback
|
27
|
+
callback,
|
27
28
|
});
|
28
29
|
|
29
30
|
await render(
|
30
|
-
hbs
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
hbs`<MessageInfo
|
32
|
+
@currentMessage={{this.message}}
|
33
|
+
@showTitle={{this.showTitle}}
|
34
|
+
@currentEnvPosition={{this.envPosition}}
|
35
|
+
@envChangedAction={{this.callback}}
|
36
|
+
@showShare={{true}}
|
37
|
+
@actionsInMenu={{this.actionsInMenu}}
|
38
|
+
/>`
|
37
39
|
);
|
38
40
|
let activeTab = find(".message-info .content.active pre");
|
39
|
-
assert.
|
41
|
+
assert.strictEqual(
|
40
42
|
activeTab.textContent.trim(),
|
41
43
|
backtrace,
|
42
44
|
"default active tab is backtrace"
|
43
45
|
);
|
44
46
|
assert.dom(".message-info .content h3").doesNotExist("no titles are shown");
|
45
|
-
assert.
|
46
|
-
assert.
|
47
|
+
assert.strictEqual(findAll(".tabs a").length, 3, "3 tabs shown");
|
48
|
+
assert.strictEqual(
|
47
49
|
find(".tabs a.active").textContent.trim(),
|
48
50
|
"backtrace",
|
49
51
|
"default active tab is backtrace"
|
50
52
|
);
|
51
|
-
assert.
|
53
|
+
assert.strictEqual(
|
52
54
|
findAll(".message-actions button").length,
|
53
55
|
2,
|
54
56
|
"2 buttons shown when `actionsInMenu` is true"
|
@@ -59,7 +61,7 @@ module("Integration | Component | message-info", function(hooks) {
|
|
59
61
|
assert.dom(".message-actions button.share").exists("share button is shown");
|
60
62
|
|
61
63
|
await click(find(".message-actions button.expand.no-text"));
|
62
|
-
assert.
|
64
|
+
assert.strictEqual(
|
63
65
|
findAll(".actions-menu button").length,
|
64
66
|
3,
|
65
67
|
"extra buttons shown inside a menu"
|
@@ -73,10 +75,10 @@ module("Integration | Component | message-info", function(hooks) {
|
|
73
75
|
|
74
76
|
this.setProperties({
|
75
77
|
showTitle: true,
|
76
|
-
actionsInMenu: false
|
78
|
+
actionsInMenu: false,
|
77
79
|
});
|
78
80
|
|
79
|
-
assert.
|
81
|
+
assert.strictEqual(
|
80
82
|
findAll(".message-info .content h3").length,
|
81
83
|
3,
|
82
84
|
"titles are shown"
|
@@ -84,7 +86,7 @@ module("Integration | Component | message-info", function(hooks) {
|
|
84
86
|
assert
|
85
87
|
.dom(".message-actions button.expand.no-text")
|
86
88
|
.doesNotExist("menu expand button is not shown");
|
87
|
-
assert.
|
89
|
+
assert.strictEqual(
|
88
90
|
findAll(".message-actions button").length,
|
89
91
|
4,
|
90
92
|
"all actions buttons are shown inline when `actionsInMenu` is false"
|
@@ -92,7 +94,7 @@ module("Integration | Component | message-info", function(hooks) {
|
|
92
94
|
|
93
95
|
await click(findAll(".tabs a")[0]);
|
94
96
|
activeTab = find(".message-info .content.active pre");
|
95
|
-
assert.
|
97
|
+
assert.strictEqual(activeTab.textContent, messageTitle, "can switch tabs");
|
96
98
|
|
97
99
|
assert
|
98
100
|
.dom(".message-actions button.solve")
|
@@ -108,7 +110,7 @@ module("Integration | Component | message-info", function(hooks) {
|
|
108
110
|
|
109
111
|
message.set("env", [
|
110
112
|
{ sd: "dx", application_version: "fsfdsf" },
|
111
|
-
{ vcv: "dxc" }
|
113
|
+
{ vcv: "dxc" },
|
112
114
|
]);
|
113
115
|
this.set("message", message);
|
114
116
|
assert
|
@@ -1,20 +1,21 @@
|
|
1
1
|
import { module, test } from "qunit";
|
2
2
|
import { setupRenderingTest } from "ember-qunit";
|
3
3
|
import hbs from "htmlbars-inline-precompile";
|
4
|
-
import { fillIn,
|
4
|
+
import { fillIn, findAll, render } from "@ember/test-helpers";
|
5
5
|
import Pattern from "client-app/models/pattern-item";
|
6
6
|
|
7
|
-
module("Integration | Component | patterns-list", function(hooks) {
|
7
|
+
module("Integration | Component | patterns-list", function (hooks) {
|
8
8
|
setupRenderingTest(hooks);
|
9
9
|
|
10
|
-
test("it renders", async function(assert) {
|
10
|
+
test("it renders", async function (assert) {
|
11
11
|
this.setProperties({
|
12
12
|
mutable: true,
|
13
|
-
patterns: []
|
13
|
+
patterns: [],
|
14
14
|
});
|
15
15
|
await render(
|
16
|
-
hbs
|
16
|
+
hbs`<PatternsList @patterns={{this.patterns}} @mutable={{this.mutable}} @key="suppression" />`
|
17
17
|
);
|
18
|
+
|
18
19
|
assert
|
19
20
|
.dom(".pattern-input")
|
20
21
|
.exists("It shows an input when patterns are emtpy");
|
@@ -25,7 +26,7 @@ module("Integration | Component | patterns-list", function(hooks) {
|
|
25
26
|
const pattern1 = Pattern.create({ value: "/somepattern/" });
|
26
27
|
const pattern2 = Pattern.create({ value: "/anotherpattern/" });
|
27
28
|
this.set("patterns", [pattern1, pattern2]);
|
28
|
-
assert.
|
29
|
+
assert.strictEqual(
|
29
30
|
findAll(".pattern-input").length,
|
30
31
|
3, // yes 3 because there is always an empty pattern input
|
31
32
|
"It correctly displays patterns"
|
@@ -34,15 +35,17 @@ module("Integration | Component | patterns-list", function(hooks) {
|
|
34
35
|
.dom(".btn.save")
|
35
36
|
.doesNotExist("No save buttons are shown when there is 0 buffer");
|
36
37
|
const counters = findAll("input.count");
|
37
|
-
assert.
|
38
|
+
assert.strictEqual(counters.length, 3, "counters shown for all patterns");
|
38
39
|
assert.ok(
|
39
|
-
counters.every(c => c.disabled),
|
40
|
+
counters.every((c) => c.disabled),
|
40
41
|
"counters are disabled"
|
41
42
|
);
|
42
43
|
|
43
44
|
pattern1.set("count", 6);
|
44
45
|
this.set("patterns", [pattern1, pattern2]);
|
45
|
-
const counterPresent = !!findAll("input.count").find(
|
46
|
+
const counterPresent = !!findAll("input.count").find(
|
47
|
+
(c) => c.value === "6"
|
48
|
+
);
|
46
49
|
assert.ok(counterPresent, "counter shows correct value");
|
47
50
|
assert.dom(".btn.reset").exists("Reset button is shown");
|
48
51
|
|
@@ -55,7 +58,7 @@ module("Integration | Component | patterns-list", function(hooks) {
|
|
55
58
|
.exists("Save buttons are shown when there is buffer");
|
56
59
|
assert.dom(".btn.trash").exists("Trash buttons are shown");
|
57
60
|
|
58
|
-
let disabled = inputs.every(inp => inp.disabled);
|
61
|
+
let disabled = inputs.every((inp) => inp.disabled);
|
59
62
|
assert.notOk(
|
60
63
|
disabled,
|
61
64
|
"All inputs are not disabled when the list is mutable"
|
@@ -64,7 +67,7 @@ module("Integration | Component | patterns-list", function(hooks) {
|
|
64
67
|
this.set("mutable", false);
|
65
68
|
|
66
69
|
inputs = findAll(".pattern-input");
|
67
|
-
disabled = inputs.every(inp => inp.disabled);
|
70
|
+
disabled = inputs.every((inp) => inp.disabled);
|
68
71
|
assert.ok(disabled, "All inputs are disabled when the list is immutable");
|
69
72
|
assert
|
70
73
|
.dom(".btn.trash")
|
@@ -1,8 +1,12 @@
|
|
1
|
-
import Application from
|
2
|
-
import config from
|
3
|
-
import
|
4
|
-
import {
|
1
|
+
import Application from "client-app/app";
|
2
|
+
import config from "client-app/config/environment";
|
3
|
+
import * as QUnit from "qunit";
|
4
|
+
import { setApplication } from "@ember/test-helpers";
|
5
|
+
import { setup } from "qunit-dom";
|
6
|
+
import { start } from "ember-qunit";
|
5
7
|
|
6
8
|
setApplication(Application.create(config.APP));
|
7
9
|
|
10
|
+
setup(QUnit.assert);
|
11
|
+
|
8
12
|
start();
|