Skip to content

Commit

Permalink
Fix/tests (#4451)
Browse files Browse the repository at this point in the history
* WiP: Minor fixes to the functional tests

* Restructure functional test execution

* Fix some functional tests

* Add broadpeak to contributors in reference UI

* Add progress reporter for browserstack tests

* Use mocha in functional tests as reporter

* Change multiperiod stream in smoke vectors
  • Loading branch information
dsilhavy committed Apr 11, 2024
1 parent c5e4687 commit a8e2d39
Show file tree
Hide file tree
Showing 27 changed files with 289 additions and 1,083 deletions.
26 changes: 17 additions & 9 deletions .circleci/config.yml
Expand Up @@ -85,15 +85,18 @@ commands:

run_test_suite:
parameters:
testconfig:
default: ""
streamsfile:
default: "single"
type: string
configfile:
default: "browserstack"
type: string
steps:
- run:
name: Run functional tests <<parameters.testconfig>>
name: Run functional tests <<parameters.configfile>> - <<parameters.streamsfile>>
when: always
command:
node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=<<parameters.testconfig>>
node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=<<parameters.configfile>> --streamsfile=<<parameters.streamsfile>>
build_samples:
# parameters:
# samples:
Expand Down Expand Up @@ -155,33 +158,38 @@ jobs:
- run_testbuild
- functional_test_setup
- run_test_suite:
testconfig: browserstack/single
streamsfile: single
configfile: browserstack
- run_test_suite:
testconfig: browserstack/smoke
streamsfile: smoke
configfile: browserstack
- process_test_results

functional-tests-full-part-1:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
testconfig: browserstack/drm_emsg_eptdelta_gaps
streamsfile: drm_emsg_eptdelta_gaps
configfile: browserstack
- process_test_results

functional-tests-full-part-2:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
testconfig: browserstack/multiperiod_subtitle_vendor
streamsfile: multiperiod_subtitle_vendor
configfile: browserstack
- process_test_results

functional-tests-full-part-3:
executor: dashjs-executor
steps:
- functional_steps
- run_test_suite:
testconfig: browserstack/vod_live_lowlatency_mss_multiaudio
streamsfile: vod_live_lowlatency_mss_multiaudio
configfile: browserstack
- process_test_results

workflows:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -14,7 +14,7 @@
"build": "tsc && npm run test && npm run lint && npm run webpack-build",
"doc": "jsdoc -c build/jsdoc/jsdoc_conf.json -d docs/jsdoc",
"test": "karma start test/unit/config/karma.unit.conf.cjs",
"test-functional": "karma start test/functional/config/karma.functional.conf.cjs --configfile=local/smoke",
"test-functional": "karma start test/functional/config/karma.functional.conf.cjs --configfile=local --streamsfile=smoke",
"prepare": "node githook.cjs",
"webpack-build": "rimraf dist && webpack --config build/webpack.prod.cjs"
},
Expand Down
5 changes: 5 additions & 0 deletions samples/dash-if-reference-player/app/contributors.json
Expand Up @@ -63,6 +63,11 @@
"name": "Unified Streaming",
"logo": "app/img/US-logo-petrol-rgb.jpg",
"link": "https://www.unified-streaming.com/"
},
{
"name": "Broadpeak",
"logo": "app/img/broadpeak.png",
"link": "https://broadpeak.tv/"
}
]
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/dash-if-reference-player/app/sources.json
Expand Up @@ -371,7 +371,7 @@
},
{
"name": "TTML Sideloaded XML Subtitles",
"url": "https://livesim2.dashif.org/vod/testpic_2s/xml_subs.mpd",
"url": "https://livesim2.dashif.org/vod/testpic_2s/ttml_subs.mpd",
"provider": "dashif"
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/functional/adapter/DashJsAdapter.js
Expand Up @@ -489,7 +489,7 @@ class DashJsAdapter {
resolve(res);
}
const _onTimeout = () => {
_onComplete(null);
_onComplete({});
}
const _onEvent = (e) => {
if (e.request.type === 'MediaSegment') {
Expand Down
38 changes: 16 additions & 22 deletions test/functional/config/karma.functional.conf.cjs
Expand Up @@ -7,16 +7,18 @@ module.exports = function (config) {
const argv = yargs(hideBin(process.argv)).parse()
// Find the settings JSON object in the command arguments
const configFileName = argv.configfile
const streamsFileName = argv.streamsfile

if (!configFileName) {
return
}

const testConfiguration = JSON.parse(fs.readFileSync(`test/functional/config/test-configurations/${configFileName}.json`, 'utf-8'))
const includedTestfiles = _getIncludedTestfiles(testConfiguration)
const excludedTestfiles = _getExcludedTestfiles(testConfiguration)
const testConfiguration = JSON.parse(fs.readFileSync(`test/functional/config/test-configurations/${configFileName}.json`, 'utf-8'));
const streamsConfiguration = JSON.parse(fs.readFileSync(`test/functional/config/test-configurations/streams/${streamsFileName}.json`, 'utf-8'));
const includedTestfiles = _getIncludedTestfiles(streamsConfiguration)
const excludedTestfiles = _getExcludedTestfiles(streamsConfiguration)
const customContextFile = testConfiguration.customContextFile ? testConfiguration.customContextFile : 'test/functional/view/index.html';
const testvectors = testConfiguration.testvectors
const testvectors = streamsConfiguration.testvectors

config.set({

Expand All @@ -29,16 +31,8 @@ module.exports = function (config) {
frameworks: ['mocha', 'chai', 'webpack'],

plugins: [
'karma-webpack',
'karma-mocha',
'karma-chai',
'karma-coverage',
'karma-mocha-reporter',
'karma-junit-reporter',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-htmlfile-reporter',
'karma-browserstack-launcher'
'karma-*', // default plugins
'@*/karma-*', // default scoped plugins
],

// list of files / patterns to load in the browser
Expand All @@ -59,7 +53,7 @@ module.exports = function (config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'html', 'progress', 'junit', 'coverage', 'BrowserStack'],
reporters: testConfiguration.reporters,

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
Expand All @@ -82,7 +76,7 @@ module.exports = function (config) {
},

htmlReporter: {
outputFile: 'test/functional/results/test/karma/htmlreporter/out.html',
outputFile: `test/functional/results/test/karma/htmlreporter/${Date.now()}.html`,
pageTitle: 'dash.js',
subPageTitle: 'Functional Tests',
groupSuites: true,
Expand Down Expand Up @@ -152,11 +146,11 @@ module.exports = function (config) {
'os_version': '11',
},
bs_safari_mac: {
'base' : 'BrowserStack',
'browser_version' : 'latest',
'os' : 'OS X',
'os_version' : 'Ventura',
'browser' : 'safari',
'base': 'BrowserStack',
'browser_version': 'latest',
'os': 'OS X',
'os_version': 'Ventura',
'browser': 'safari',
},
chrome_custom: {
base: 'Chrome',
Expand Down Expand Up @@ -185,7 +179,7 @@ function _getIncludedTestfiles(testConfiguration) {
}

if (!testConfiguration.testfiles.included || testConfiguration.testfiles.included.indexOf('all') >= 0) {
return { pattern: `test/functional/test/**/*.js`, watched: false }
return [{ pattern: `test/functional/test/**/*.js`, watched: false }]
}

return testConfiguration.testfiles.included.map((entry) => {
Expand Down
10 changes: 10 additions & 0 deletions test/functional/config/test-configurations/browserstack.json
@@ -0,0 +1,10 @@
{
"browsers": [
"bs_chrome_win_11"
],
"reporters": [
"mocha",
"junit",
"BrowserStack"
]
}

This file was deleted.

0 comments on commit a8e2d39

Please sign in to comment.