-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathpreview.js
More file actions
66 lines (55 loc) · 2.14 KB
/
Copy pathpreview.js
File metadata and controls
66 lines (55 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* Functional test cases for question set
* @author rahul shukla <rahul.shukla@ilimi.in>
* @todo To use image diff we need to ignore options container in MCQ cause it always shuffle
* @link https://github.com/americanexpress/jest-image-snapshot#ignoring-parts-of-the-image-snapshot-if-using-puppeteer
*/
const timeout = 50000
const typingSpeed = 50
let jestscreenshot = require('@jeeyah/jestscreenshot');
const devices = require('puppeteer/DeviceDescriptors');
const { toMatchImageSnapshot } = require('jest-image-snapshot');
expect.extend({ toMatchImageSnapshot });
describe(
'Sunbird Player functional testing - preview testing',
() => {
let page
beforeAll(async () => {
jest.setTimeout(timeout)
page = await global.__BROWSER__.newPage()
await page.goto('http://127.0.0.1:3000')
await page.setViewport({width: 1280,height: 800})
// const metrics = await page.metrics();
// console.info(metrics);
let path = require('path');
let scriptName = path.basename(__filename).replace('.js', '');
let options = {
page: page,
dirName: __dirname,
scriptName: scriptName,
onlyFailures: true
};
await jestscreenshot.init(options);
}, timeout)
afterEach(async () => {
await page.waitFor(5000)
})
afterAll(async () => {
jestscreenshot.cleanup(function () {
if (browser) {
browser.close();
}
done();
});
await page.close()
})
it('Player shell loaded with fixture stories', async () => {
await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(3)')
})
it('Should open content player', async() => {
const playQuestion = await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(3)')
await playQuestion.click()
})
},
timeout
)