Testing web apps with this JS framework

So i'm doing some contract work and need to test some small web apps. They are built with the jsPsych framework and bundled with Webpack. I don't know how to test these apps since I have no access to the UI. Here's an example of what I mean:
import {initJsPsych} from 'jspsych';
import htmlKeyboardResponse from '@jspsych/plugin-html-keyboard-response';

const jsPsych = initJsPsych();

const trial = {
type: htmlKeyboardResponse,
stimulus: 'Hello world!',
}

jsPsych.run([trial]);
import {initJsPsych} from 'jspsych';
import htmlKeyboardResponse from '@jspsych/plugin-html-keyboard-response';

const jsPsych = initJsPsych();

const trial = {
type: htmlKeyboardResponse,
stimulus: 'Hello world!',
}

jsPsych.run([trial]);
This is basically how the whole app is setup. You just define a trial object with the necessary parameters and then put them in an array for jsPsych to run. jsPsych spits out the html on the page. I saw this article: https://dev.to/thawkin3/how-to-unit-test-html-and-vanilla-javascript-without-a-ui-framework-4io on testing without UI framworks but I don't have an HTML file. The HTML file that comes out from the build dosen't have anything in the body since all the trials are rendered dynamically. How do I test this?
DEV Community
How to Unit Test HTML and Vanilla JavaScript Without a UI Framework
Recently I was curious about something: Is it possible to write unit tests for front end code that do...
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server