Merge pull request #24872 from nextcloud/tests/jsunit-chromium

Run jsunit with chromium/puppeteer
This commit is contained in:
Roeland Jago Douma 2020-12-29 10:59:49 +01:00 committed by GitHub
commit 50d5229c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1076 additions and 2274 deletions

View File

@ -1,27 +1,4 @@
kind: pipeline
name: jsunit
steps:
- name: jsunit
image: nextcloudci/jsunit:jsunit-5
environment:
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
commands:
- ./autotest-js.sh
- curl -o codecov.sh https://codecov.io/bash
- bash codecov.sh -C $DRONE_COMMIT
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
---
kind: pipeline
name: checkers
steps:

View File

@ -49,6 +49,17 @@ jobs:
- name: Test
run: npm run test
jsunit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Test
run: ./autotest-js.sh
handlebars:
runs-on: ubuntu-latest
strategy:

3246
build/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,21 +9,20 @@
"private": true,
"homepage": "https://github.com/nextcloud/",
"contributors": [],
"dependencies": {},
"devDependencies": {
"handlebars": "^4.7.6",
"jasmine-core": "~2.5.2",
"jasmine-sinon": "^0.4.0",
"jsdoc": "^3.6.6",
"karma": "^3.1.4",
"karma": "^5.2.3",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "2.0.1",
"karma-jasmine": "^1.1.2",
"karma-jasmine-sinon": "^1.0.4",
"karma-junit-reporter": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-spec-reporter": "^0.0.32",
"karma-viewport": "^1.0.7",
"node-sass": "~4.14.1",
"phantomjs-prebuilt": "*",
"puppeteer": "^5.5.0",
"sinon": "<= 5.0.7"
},
"engine": "node >= 6.9"

View File

@ -2,15 +2,6 @@
"libraries": [
],
"modules": [
"share.js",
"sharetemplates.js",
"sharesocialmanager.js",
"shareconfigmodel.js",
"shareitemmodel.js",
"sharedialogview.js",
"sharedialoglinkshareview.js",
"sharedialogresharerinfoview.js",
"sharedialogshareelistview.js",
"public/publicpage.js",
"setupchecks.js",
"mimetype.js",

View File

@ -117,6 +117,7 @@ window.Snap.prototype = {
};
window.isPhantom = /phantom/i.test(navigator.userAgent);
document.documentElement.lang = navigator.language;
// global setup for all tests
(function setupTests() {

View File

@ -38,8 +38,8 @@ describe('jquery.avatar tests', function() {
it('undefined', function() {
$div.avatar('foo');
expect($div.height()).toEqual(64);
expect($div.width()).toEqual(64);
expect(Math.round($div.height())).toEqual(64);
expect(Math.round($div.width())).toEqual(64);
});
it('undefined but div has height', function() {
@ -49,8 +49,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled();
window.Image().onerror();
expect($div.height()).toEqual(9);
expect($div.width()).toEqual(9);
expect(Math.round($div.height())).toEqual(9);
expect(Math.round($div.width())).toEqual(9);
});
it('undefined but data size is set', function() {
@ -60,8 +60,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled();
window.Image().onerror();
expect($div.height()).toEqual(10);
expect($div.width()).toEqual(10);
expect(Math.round($div.height())).toEqual(10);
expect(Math.round($div.width())).toEqual(10);
});
@ -71,8 +71,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled();
window.Image().onerror();
expect($div.height()).toEqual(8);
expect($div.width()).toEqual(8);
expect(Math.round($div.height())).toEqual(8);
expect(Math.round($div.width())).toEqual(8);
});
});

View File

@ -33,6 +33,10 @@
* preprocessor, which is needed to be able to debug tests properly in a browser.
*/
if (!process.env.CHROMIUM_BIN) {
process.env.CHROMIUM_BIN = require('puppeteer').executablePath()
}
/* jshint node: true */
module.exports = function(config) {
function findApps() {
@ -56,7 +60,6 @@ module.exports = function(config) {
'apps/files_sharing/js/dist/files_sharing_tab.js',
'apps/files_sharing/js/dist/files_sharing.js',
'apps/files_sharing/js/dist/main.js',
'apps/files_sharing/js/dist/sidebar.js',
'apps/files_sharing/js/files_drop.js',
'apps/files_sharing/js/public.js',
'apps/files_sharing/js/sharedfilelist.js',
@ -189,12 +192,6 @@ module.exports = function(config) {
included: false,
served: true
});
files.push({
pattern: 'core/css/images/*',
watched: false,
included: false,
served: true
});
// include core CSS
files.push({
@ -237,12 +234,22 @@ module.exports = function(config) {
'/base/tests/css/': 'http://localhost:9876/base/core/css/',
'/base/core/css/images/': 'http://localhost:9876/base/core/css/images/',
'/actions/': 'http://localhost:9876/base/core/img/actions/',
'/base/core/fonts/': 'http://localhost:9876/base/core/fonts/'
'/base/core/fonts/': 'http://localhost:9876/base/core/fonts/',
'/svg/': '../core/img/'
},
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['dots', 'junit', 'coverage'],
reporters: ['spec'],
specReporter: {
maxLogLines: 5,
suppressErrorSummary: false,
suppressFailed: false,
suppressPassed: true,
suppressSkipped: true,
showSpecTiming: false,
},
junitReporter: {
outputFile: 'tests/autotest-results-js.xml'
@ -281,16 +288,8 @@ module.exports = function(config) {
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
// use PhantomJS_debug for extra local debug
browsers: ['PhantomJS'],
browsers: ['ChromiumHeadless'],
plugins: [
'karma-phantomjs-launcher',
'karma-coverage',
'karma-jasmine',
'karma-jasmine-sinon',
'karma-viewport',
'karma-junit-reporter'
],
// you can define custom flags
customLaunchers: {
PhantomJS_debug: {