2017-07-20 06:57:48 -05:00
|
|
|
const Application = require('./spectronSetup');
|
2017-07-05 04:22:06 -05:00
|
|
|
const path = require('path');
|
2018-09-11 22:09:57 -05:00
|
|
|
const WebActions = require('./spectronWebActions');
|
|
|
|
const ifc = require('./spectronInterfaces.js');
|
|
|
|
let mainApp = new Application({});
|
|
|
|
let app,webActions;
|
2017-07-05 04:22:06 -05:00
|
|
|
|
|
|
|
describe('Tests for clipboard', () => {
|
|
|
|
|
|
|
|
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
2017-07-06 06:36:16 -05:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
2017-07-05 04:22:06 -05:00
|
|
|
|
2018-09-11 22:09:57 -05:00
|
|
|
beforeAll(async (done) => {
|
|
|
|
try {
|
|
|
|
let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html');
|
|
|
|
app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false });
|
|
|
|
webActions = await new WebActions(app);
|
|
|
|
webActions.fillTagText("Test")
|
|
|
|
await done();
|
|
|
|
} catch (err) {
|
2018-03-13 05:20:32 -05:00
|
|
|
done.fail(new Error(`Unable to start application error: ${err}`));
|
2018-09-11 22:09:57 -05:00
|
|
|
};
|
2017-07-05 04:22:06 -05:00
|
|
|
});
|
|
|
|
|
2017-07-06 04:39:50 -05:00
|
|
|
afterAll((done) => {
|
2017-07-05 04:22:06 -05:00
|
|
|
if (app && app.isRunning()) {
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
2017-07-06 04:39:50 -05:00
|
|
|
app.stop().then(() => {
|
|
|
|
done();
|
|
|
|
}).catch((err) => {
|
|
|
|
done();
|
|
|
|
});
|
2017-07-05 04:22:06 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-09-11 22:09:57 -05:00
|
|
|
it('should verify electron clipboard', async () => {
|
|
|
|
let valueTag = await app.client.getValue(ifc.TAG_TEXTBOX);
|
|
|
|
await app.electron.clipboard.writeText(valueTag);
|
|
|
|
let clipboardText = await app.electron.clipboard.readText();
|
|
|
|
expect(clipboardText === valueTag).toBeTruthy();
|
|
|
|
let tempText = "Testing copy";
|
|
|
|
await app.electron.clipboard.writeText(tempText);
|
|
|
|
clipboardText = await app.electron.clipboard.readText();
|
|
|
|
await app.client.setValue(ifc.TAG_TEXTBOX, clipboardText);
|
|
|
|
valueTag = await app.client.getValue(ifc.TAG_TEXTBOX);
|
|
|
|
expect(clipboardText === valueTag).toBeTruthy();
|
|
|
|
|
|
|
|
});
|
2018-03-13 05:20:32 -05:00
|
|
|
});
|