owncast/test/automated/admin.test.js
Gabe Kangas 5dff6f32fc
End to end automated tests run on Github workflows (#384)
* WIP for automated integration test

* See if it runs under a workflow

* Support running test locally as well as a workflow

* Use already downloaded repo to build. Do not re-clone

* Add comments

* Update to support new default config file

* Split out different test suites

* Add test for chat

* Always run test with config-default and ignore local config file

* Remove the build workflow because the end to end test does that now
2020-11-24 00:28:54 -08:00

49 lines
2.2 KiB
JavaScript

var request = require('supertest');
request = request('http://127.0.0.1:8080');
test('stream details are correct', (done) => {
request.get('/api/admin/status').auth('admin', 'abc123').expect(200)
.then((res) => {
expect(res.body.broadcaster.streamDetails.width).toBe(320);
expect(res.body.broadcaster.streamDetails.height).toBe(180);
expect(res.body.broadcaster.streamDetails.framerate).toBe(24);
expect(res.body.broadcaster.streamDetails.videoBitrate).toBe(1269);
expect(res.body.broadcaster.streamDetails.videoCodec).toBe('H.264');
expect(res.body.broadcaster.streamDetails.audioCodec).toBe('AAC');
expect(res.body.online).toBe(true);
done();
});
});
test('admin configuration is correct', (done) => {
request.get('/api/admin/serverconfig').auth('admin', 'abc123').expect(200)
.then((res) => {
expect(res.body.instanceDetails.name).toBe('Owncast');
expect(res.body.instanceDetails.title).toBe('Owncast');
expect(res.body.instanceDetails.summary).toBe('This is brief summary of whom you are or what your stream is. You can edit this description in your config file.');
expect(res.body.instanceDetails.logo).toBe('/img/logo.svg');
expect(res.body.instanceDetails.tags).toStrictEqual(['music', 'software', 'streaming']);
expect(res.body.videoSettings.segmentLengthSeconds).toBe(4);
expect(res.body.videoSettings.numberOfPlaylistItems).toBe(5);
expect(res.body.videoSettings.videoQualityVariants[0].framerate).toBe(24);
expect(res.body.videoSettings.videoQualityVariants[0].encoderPreset).toBe('veryfast');
expect(res.body.videoSettings.numberOfPlaylistItems).toBe(5);
expect(res.body.yp.enabled).toBe(false);
expect(res.body.streamKey).toBe('abc123');
done();
});
});
test('correct number of log entries exist', (done) => {
request.get('/api/admin/logs').auth('admin', 'abc123').expect(200)
.then((res) => {
expect(res.body).toHaveLength(4);
done();
});
});