Migrate acceptance tests to taiko
I played around with https://taiko.dev and it's great! It's made for modern web applications, which selenium/behave-webdriver struggle with. I.e., we needed to create a behave-webdriver step definition for switching to an iframe, because behave-webdriver didn't support it natively and is also unmaintained.
The whole nextcloud onlyoffice inegration can get tested with this little code snippet (and taiko installed as only dependency):
const { openBrowser, goto, textBox, into, write, click, below, link, press, button, closeBrowser } = require('taiko');
const assert = require('assert').strict;
(async () => {
try {
var url = process.env.NC_URL;
var pw = process.env.NC_ADMIN_PW;
await openBrowser();
await goto(url);
await write("admin", into(textBox('Username')));
await write(pw, into(textBox('Password')));
await click('Log in');
await click(link(below('Files')));
await click(link('Document'));
await press('Enter');
await button({id:'id-toolbar-btn-bold'}).exists();
assert.doesNotMatch(await button({id:'id-toolbar-btn-bold'}).attribute('class'))
await click(button({id:'id-toolbar-btn-bold'}));
assert.match(await button({id:'id-toolbar-btn-bold'}).attribute('class'), /active/)
} catch (error) {
console.error(error);
} finally {
await closeBrowser();
}
})();
We could also use https://gauge.org/ as a test wrapper which is similar to behave as it defines steps in a language (in markdown) that a user would understand.
There are a lot of videos about taiko+gauge, I watched https://www.youtube.com/watch?v=RxASYh94JOs which was a good introduction.