Skip to content

Commit

Permalink
Add server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyBelym committed Jan 16, 2019
1 parent 52de73d commit 9dc1600
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/errors/runtime/message.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions test/server/cli-argument-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,16 @@ describe('CLI argument parser', function () {
});
});

it('Should parse video recording options', () => {
return parse(`--video /home/user/video --video-options singleFile=true,failedOnly=true --video-encoding-options c:v=x264`)
.then(parser => {
expect(parser.opts.video).eql('/home/user/video');
expect(parser.opts.videoOptions.singleFile).eql(true);
expect(parser.opts.videoOptions.failedOnly).eql(true);
expect(parser.opts.videoEncodingOptions['c:v']).eql('x264');
});
});

it('Should parse reporters and their output file paths and ensure they exist', function () {
const cwd = process.cwd();
const filePath = path.join(tmp.dirSync().name, 'my/reports/report.json');
Expand Down
30 changes: 30 additions & 0 deletions test/server/runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,36 @@ describe('Runner', () => {
});
});

describe('.video()', () => {
it('Should throw an error if video options are specified without a base video path', () => {
return runner
.browsers(connection)
.video(void 0, { failedOnly: true })
.src('test/server/data/test-suites/basic/testfile2.js')
.run()
.then(() => {
throw new Error('Promise rejection expected');
})
.catch(err => {
expect(err.message).eql('Cannot set the video and video encoding options without a base video path specified.');
});
});

it('Should throw an error if video encoding options are specified without a base video path', () => {
return runner
.browsers(connection)
.video(void 0, null, { 'c:v': 'x264' })
.src('test/server/data/test-suites/basic/testfile2.js')
.run()
.then(() => {
throw new Error('Promise rejection expected');
})
.catch(err => {
expect(err.message).eql('Cannot set the video and video encoding options without a base video path specified.');
});
});
});

describe('.src()', () => {
it('Should accept source files in different forms', () => {
const cwd = process.cwd();
Expand Down

0 comments on commit 9dc1600

Please sign in to comment.