SWI-Prolog / swipl-wasm

Run SWI-Prolog in your browser using WebAssemply
74 stars 5 forks source link

Automated tests #6

Open rla opened 5 years ago

rla commented 5 years ago

It would be nice to have automated tests for the WebAssembly API. This is complicated issue right now as the --preload-file does not support Node.js environment and that an headless browser should be used. Setting up headless browser environment without heavy dependencies is not possible (chrome --headless does not provide enough control without the debug protocol and using the debug protocol requires further dependencies).

At first, the tests will be semi-automatic, requiring a web server (it seems like loading .wasm files is complicated over the file:// protocol).

After loading the test HTML file, it initializes the swi instance, runs some tests, and writes result (PASS/FAIL) to the page. Loading and inspection of results has to be done manually for now.

JanWielemaker commented 5 years ago

For pengines I used phantomjs, but this is broken and discontinued. I switched to slimerjs, but this node module seems to be hard to synchronise with the latest firefox ... A good, easy to install and robust alternative is more than welcome ...

rla commented 5 years ago

@JanWielemaker where could I see the tests? They do not seem to be in swipl-devel nor in the pengines repo. The headless Chrome/Chromium approach will require Node as a dependency (for wasm build I might be able to use one that comes with Emskripten) but if the slimerjs required it as well, it's not a so big deal.

rla commented 5 years ago

I have some basic automated test setup working using Puppeteer. After I have some actual tests, I will submit PR to swipl-devel.