2021-09-28 11:21:14 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const SharedNotes = require('./sharednotes');
|
2020-10-09 03:25:35 +08:00
|
|
|
const { toMatchImageSnapshot } = require('jest-image-snapshot');
|
2021-09-28 11:21:14 +08:00
|
|
|
const { MAX_SHARED_NOTES_TEST_TIMEOUT } = require('../core/constants'); // core constants (Timeouts vars imported)
|
2020-10-09 03:25:35 +08:00
|
|
|
|
|
|
|
expect.extend({ toMatchImageSnapshot });
|
2020-08-06 02:44:17 +08:00
|
|
|
|
|
|
|
const sharedNotesTest = () => {
|
|
|
|
beforeEach(() => {
|
2021-02-17 04:57:10 +08:00
|
|
|
jest.setTimeout(MAX_SHARED_NOTES_TEST_TIMEOUT);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Open Shared notes', async () => {
|
|
|
|
const test = new SharedNotes();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
2021-02-17 04:57:10 +08:00
|
|
|
const testName = 'openSharedNotes';
|
2021-09-30 20:36:08 +08:00
|
|
|
await test.modPage1.logger('begin of ', testName);
|
|
|
|
await test.init(testName);
|
|
|
|
await test.modPage1.startRecording(testName);
|
|
|
|
await test.userPage1.startRecording(testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.test();
|
2021-09-30 20:36:08 +08:00
|
|
|
await test.modPage1.logger('end of ', testName);
|
|
|
|
await test.modPage1.stopRecording();
|
|
|
|
await test.userPage1.stopRecording();
|
|
|
|
screenshot = await test.modPage1.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
2021-09-30 20:36:08 +08:00
|
|
|
await test.modPage1.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.close();
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-10-01 02:45:59 +08:00
|
|
|
Page.checkRegression(0.1, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
};
|
2021-09-30 20:36:08 +08:00
|
|
|
|
|
|
|
module.exports = exports = sharedNotesTest;
|