timgremore's picture
feat: HomeLive.Index LiveView
83105f7
raw
history blame
1.39 kB
defmodule MedicalTranscriptionWeb.HomeLiveTest do
use MedicalTranscriptionWeb.ConnCase, async: true
import Phoenix.LiveViewTest
alias MedicalTranscriptionWeb.HomeLive.Index
describe "/" do
test "renders upload screen", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "<h1>Upload Transcription Audio</h1>"
{:ok, view, html} = live(conn)
assert html =~ "<h1>Upload Transcription Audio</h1>"
sample_file =
__DIR__
|> Path.join("../../../medasrdemo-Paul.mp3")
|> Path.expand()
audio =
file_input(view, "#audio-form", :audio, [
%{
last_modified: 1_594_171_879_000,
name: "sample.mp3",
content: File.read!(sample_file),
size: 992_980,
type: "audio/mp3"
}
])
assert audio
|> render_upload("sample.mp3") =~ "Submitted: sample.mp3"
refute view
|> form("#audio-form")
|> render_submit() =~ "Submitted: sample.mp3"
# |> render_async() =~ "Hello"
# |> render_submit() =~ "Submitted: sample.mp3"
# assert render_upload(audio, "sample.mp3") |> dbg() =~ "100%"
# 1. Find file input
# 2. Upload file
# 3. Click submit
# 4. Assert we see text
# 5. Assert we see codes alongside text
end
end
end