Skip to content

Commit 8941896

Browse files
committed
[ Refactor ] Simplify Test scripts based on PuppeteerBrowser
[ Optimize ] Update upstream libraries
1 parent 165b266 commit 8941896

File tree

16 files changed

+11661
-8521
lines changed

16 files changed

+11661
-8521
lines changed

build/TestHook.js

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
11
'use strict';
22

33

4-
exports.fileWrite = function (header) {
4+
exports.fileWrite = header => {
55

66
header.source = `
77
88
const Path = require('path');
99
10-
const TestKit = require(Path.relative(
10+
const { pageLoad } = require(Path.relative(
1111
Path.dirname( module.filename ),
12-
Path.join(process.cwd(), 'build/TestKit')
12+
Path.join(process.cwd(), 'test/TestKit')
1313
));
1414
15-
after( TestKit.exit.bind(null, 0) );
16-
`;
17-
};
1815
16+
var page;`.trim();
17+
};
1918

20-
exports.headerWrite = function (header) {
2119

22-
header.source = `
20+
exports.headerWrite = header => {
2321

24-
before( TestKit.pageLoad.bind(null, '${header.URI.replace(/\.\w+$/, '')}') );
25-
`;
22+
header.source = 'before(async () => page = await pageLoad())';
2623
};
2724

2825

29-
exports.itemWrite = function (item) {
26+
exports.itemWrite = item => {
3027

3128
item.source = `
3229
33-
it('${item.title}', function () {
34-
35-
return TestKit.chrome.evaluate(function () {
30+
it('${item.title}', () => page.evaluate(() => {
3631
3732
return ${item.script};
3833
39-
}).should.be.fulfilledWith( ${item.expected} );
40-
});
41-
`;
34+
}).should.be.fulfilledWith( ${item.expected} ));`;
4235
};

build/TestKit.js

-53
This file was deleted.

0 commit comments

Comments
 (0)