I'm using Electron + Nightmare.js to do unit tests.
I need to copy a string to the clibboard > focus a element > paste the content. Then the test is about if my JavaScript is handling behaving properly.
I read in the electron docs about the clipboard api,
and copy/paste in webview, but not sure how that integrates with the Nightmare.js API, probably in a .action
as suggested in this issue.
A example would be:
import nightmare from 'nightmare'
nightmare.action('copyPaste', function(name, options, parent, win, renderer, done) {
// some magic here
});
// and then
let res = await page
.wait('.my-element-to-render')
.copyPaste(blob)
.evaluate(() => {
return document.querySelector('.my-element').value;
}).end();
expect(res).to.equal('my pasted string');
Any pointers or experience with this?
From the arguments I get from nightmare.action
what is the equivalent to <webview>
so I can call its copy/paste method?
app
looking at npm I find a old module that is gone from Github. – Vivica