Skip to content

Commit f3ca3b5

Browse files
committed
Update e2e tests
1 parent fbea8ad commit f3ca3b5

2 files changed

Lines changed: 56 additions & 33 deletions

File tree

lib/live_debugger_web/components.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ defmodule LiveDebuggerWeb.Components do
55

66
use Phoenix.Component
77

8-
import Phoenix.HTML
9-
108
alias Phoenix.LiveView.JS
119

1210
@report_issue_url "https://github.com/software-mansion/live-debugger/issues/new/choose"

test/live_debugger/channel_dashboard_test.exs

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ defmodule LiveDebugger.ChannelDashboardTest do
1616
|> assert_has(assigns_entry(key: "counter", value: "0"))
1717
|> assert_has(traces(count: 2))
1818

19-
# Callback traces appear in debugger
2019
dev_app
2120
|> click(button("increment-button"))
2221
|> click(button("increment-button"))
@@ -77,35 +76,6 @@ defmodule LiveDebugger.ChannelDashboardTest do
7776
|> find(traces(count: 4))
7877
|> Enum.at(1)
7978
|> assert_has(css("span.text-error-text", text: "2.50 s"))
80-
81-
# Filtering callback traces by execution time works
82-
debugger
83-
|> click(toggle_tracing_button())
84-
|> click(filters_button())
85-
|> fill_in(text_field("exec_time_min"), with: 100)
86-
|> fill_in(text_field("exec_time_max"), with: 2_000_000)
87-
|> send_keys([:enter])
88-
|> find(traces(count: 1))
89-
|> find(css("span.text-warning-text"))
90-
|> Element.text()
91-
|> String.match?(~r"^40\d ms$")
92-
93-
debugger
94-
|> click(toggle_tracing_button())
95-
96-
dev_app
97-
|> click(button("increment-button"))
98-
|> click(button("slow-increment-button"))
99-
100-
Process.sleep(405)
101-
102-
debugger
103-
|> find(traces(count: 2))
104-
|> Enum.each(fn trace ->
105-
find(trace, css("span.text-warning-text"))
106-
|> Element.text()
107-
|> String.match?(~r"^40\d ms$")
108-
end)
10979
end
11080

11181
@sessions 2
@@ -144,7 +114,7 @@ defmodule LiveDebugger.ChannelDashboardTest do
144114
end
145115

146116
@sessions 2
147-
feature "user can filter callback traces", %{sessions: [dev_app, debugger]} do
117+
feature "user can filter traces by callback name", %{sessions: [dev_app, debugger]} do
148118
LiveDebugger.GenServers.CallbackTracingServer.ping!()
149119

150120
dev_app
@@ -228,6 +198,61 @@ defmodule LiveDebugger.ChannelDashboardTest do
228198
])
229199
end
230200

201+
@sessions 2
202+
feature "user can filter traces by execution time", %{sessions: [dev_app, debugger]} do
203+
LiveDebugger.GenServers.CallbackTracingServer.ping!()
204+
205+
dev_app
206+
|> visit(@dev_app_url)
207+
|> click(button("slow-increment-button"))
208+
209+
Process.sleep(405)
210+
211+
dev_app
212+
|> click(button("very-slow-increment-button"))
213+
214+
Process.sleep(2505)
215+
216+
debugger
217+
|> visit("/")
218+
|> click(first_link())
219+
|> assert_traces(6, [
220+
"render/1",
221+
"handle_event/3",
222+
"render/1",
223+
"handle_event/3",
224+
"render/1",
225+
"mount/3"
226+
])
227+
|> click(filters_button())
228+
|> set_value(select("min_unit"), "ms")
229+
|> fill_in(text_field("exec_time_min"), with: 100)
230+
|> set_value(select("max_unit"), "s")
231+
|> fill_in(text_field("exec_time_max"), with: 2)
232+
|> send_keys([:enter])
233+
|> find(traces(count: 1))
234+
|> find(css("span.text-warning-text"))
235+
|> Element.text()
236+
|> String.match?(~r"^40\d ms$")
237+
238+
debugger
239+
|> click(toggle_tracing_button())
240+
241+
dev_app
242+
|> click(button("increment-button"))
243+
|> click(button("slow-increment-button"))
244+
245+
Process.sleep(405)
246+
247+
debugger
248+
|> find(traces(count: 2))
249+
|> Enum.each(fn trace ->
250+
find(trace, css("span.text-warning-text"))
251+
|> Element.text()
252+
|> String.match?(~r"^40\d ms$")
253+
end)
254+
end
255+
231256
defp assert_traces(session, count, callback_names) do
232257
session
233258
|> find(traces(count: count))

0 commit comments

Comments
 (0)