26 lines
1.1 KiB
C++
26 lines
1.1 KiB
C++
// Route: GET /voice (live voice conversation page, script embedded)
|
|||
|
|
#include "support/GoogleRig.hpp"
|
||
|
|
|
||
|
|
using namespace molo::example::test;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
GoogleRig rig;
|
||
|
|
Fixture f(rig.client);
|
||
|
|
auto page = f.client->get("/voice");
|
||
|
|
check(page.status == 200, "status 200");
|
||
|
|
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
|
||
|
|
check(contains(page.body, "id=\"v-toggle\""), "start/stop button");
|
||
|
|
check(contains(page.body, "id=\"v-lang\""), "language select");
|
||
|
|
check(contains(page.body, "id=\"v-log\""), "conversation log");
|
||
|
|
check(contains(page.body, "/embedded/voice.js"), "script linked");
|
||
|
|
check(contains(page.body, "width=device-width"), "responsive viewport");
|
||
|
|
auto js = f.client->get("/embedded/voice.js");
|
||
|
|
check(js.status == 200 && contains(js.body, "/voice/turn"),
|
||
|
|
"page script served from the bundle");
|
||
|
|
check(contains(js.body, "getUserMedia") && contains(js.body, "MediaRecorder"),
|
||
|
|
"script records the microphone");
|
||
|
|
check(f.client->post("/voice").status == 405, "post is 405");
|
||
|
|
check(rig.mock->send_count() == 0, "side effect: page makes no Google call");
|
||
|
|
return finish("voice/page");
|
||
|
|
}
|