diff --git a/tests/ui-regression/config.js b/tests/ui-regression/config.js index c6519ba289..bb0f20240b 100644 --- a/tests/ui-regression/config.js +++ b/tests/ui-regression/config.js @@ -54,4 +54,6 @@ module.exports = { */ headless: true, + slowMo: 0, + }; diff --git a/tests/ui-regression/helper.js b/tests/ui-regression/helper.js index 7168c80585..ed2a58ea70 100644 --- a/tests/ui-regression/helper.js +++ b/tests/ui-regression/helper.js @@ -47,7 +47,8 @@ module.exports = { } this.browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'], - headless: config.headless + headless: config.headless, + slowMo: config.slowMo, }); this.pageBase = await this.browser.newPage(); this.pageCompare = await this.browser.newPage(); @@ -65,6 +66,7 @@ module.exports = { }, performLogin: async function (page, baseUrl) { + await page.bringToFront(); await page.goto(baseUrl + '/index.php/login', {waitUntil: 'networkidle0'}); await page.type('#user', 'admin'); await page.type('#password', 'admin'); @@ -96,6 +98,7 @@ module.exports = { deviceScaleFactor: options.viewport.scale }) ]); + await this.delay(100); } let fileName = test.test.title if (route !== undefined) { @@ -113,7 +116,7 @@ module.exports = { } catch (err) { failed = err; } - await this.delay(500); + await this.delay(100); await Promise.all([ this.pageBase.screenshot({ path: `${this._outputDirectory}/${fileName}.base.png`, diff --git a/tests/ui-regression/package.json b/tests/ui-regression/package.json index 979dfed3de..8ab4cf530f 100644 --- a/tests/ui-regression/package.json +++ b/tests/ui-regression/package.json @@ -8,14 +8,14 @@ }, "author": "", "dependencies": { - "fs": "0.0.1-security", "chai": "^4.1.2", - "mocha": "^5.0.0", + "fs": "0.0.1-security", + "mocha": "^5.2.0", "mocha-json-report": "0.0.2", "pixelmatch": "^4.0.2", "png-js": "^0.1.1", "pngjs2": "^2.0.0", "polyserve": "^0.23.0", - "puppeteer": "^1.0.0" + "puppeteer": "^1.6.1" } } diff --git a/tests/ui-regression/test/appsSpec.js b/tests/ui-regression/test/appsSpec.js index b5e5a889e4..3a23c1df77 100644 --- a/tests/ui-regression/test/appsSpec.js +++ b/tests/ui-regression/test/appsSpec.js @@ -39,7 +39,7 @@ describe('apps', function () { }, {viewport: resolution, waitUntil: 'networkidle2'}); }); - ['installed', 'enabled', 'disabled', 'app-bundles'].forEach(function(endpoint) { + ['your-apps', 'enabled', 'disabled', 'app-bundles'].forEach(function(endpoint) { it('apps.' + endpoint + '.' + resolution.title, async function () { return helper.takeAndCompare(this, undefined, async function (page) { try { diff --git a/tests/ui-regression/test/installSpec.js b/tests/ui-regression/test/installSpec.js index 02577883aa..bfb063bd46 100644 --- a/tests/ui-regression/test/installSpec.js +++ b/tests/ui-regression/test/installSpec.js @@ -31,7 +31,7 @@ describe('install', function () { config.resolutions.forEach(function (resolution) { it('show-page.' + resolution.title, async function () { // (test, route, prepare, action, options - return helper.takeAndCompare(this, '/index.php', async (page) => { + return helper.takeAndCompare(this, 'index.php', async (page) => { await helper.delay(100); await page.$eval('body', function (e) { $('#adminlogin').blur(); @@ -61,7 +61,7 @@ describe('install', function () { helper.pageBase.setDefaultNavigationTimeout(5*60*1000); helper.pageCompare.setDefaultNavigationTimeout(5*60*1000); // just run for one resolution since we can only install once - return helper.takeAndCompare(this, '/index.php', async function (page) { + return helper.takeAndCompare(this, 'index.php', async function (page) { const login = await page.type('#adminlogin', 'admin'); const password = await page.type('#adminpass', 'admin'); const inputElement = await page.$('input[type=submit]'); diff --git a/tests/ui-regression/test/loginSpec.js b/tests/ui-regression/test/loginSpec.js index 23f86737a7..8607bbabc8 100644 --- a/tests/ui-regression/test/loginSpec.js +++ b/tests/ui-regression/test/loginSpec.js @@ -62,11 +62,17 @@ describe('login', function () { this.timeout(30000); await helper.resetBrowser(); return helper.takeAndCompare(this, '/', async function (page) { + await page.waitForSelector('input#user'); await page.type('#user', 'admin'); await page.type('#password', 'admin'); const inputElement = await page.$('input[type=submit]'); await inputElement.click(); - await page.waitForNavigation({waitUntil: 'networkidle0'}); + await page.waitForNavigation({waitUntil: 'networkidle2'}); + await page.waitForSelector('#header'); + await page.$eval('body', function (e) { + // force relative timestamp to fixed value, since it breaks screenshot diffing + $('.live-relative-timestamp').removeClass('live-relative-timestamp').text('5 minutes ago'); + }); return await helper.delay(100); }, {viewport: resolution}); }) diff --git a/tests/ui-regression/test/publicSpec.js b/tests/ui-regression/test/publicSpec.js index 843f8f50ce..0893adf9a4 100644 --- a/tests/ui-regression/test/publicSpec.js +++ b/tests/ui-regression/test/publicSpec.js @@ -37,7 +37,7 @@ describe('public', function () { */ config.resolutions.forEach(function (resolution) { it('file-share-invalid.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/s/invalid', async function () { + return helper.takeAndCompare(this, 'index.php/s/invalid', async function () { }, {waitUntil: 'networkidle2', viewport: resolution}); }); }); @@ -48,7 +48,7 @@ describe('public', function () { var shareLink = {}; it('file-share-link', async function () { - return helper.takeAndCompare(this, '/index.php/apps/files', async function (page) { + return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) { const element = await page.$('[data-file="welcome.txt"] .action-share'); await element.click('[data-file="welcome.txt"] .action-share'); await page.waitForSelector('input.linkCheckbox'); @@ -71,7 +71,7 @@ describe('public', function () { config.resolutions.forEach(function (resolution) { it('file-share-valid.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/apps/files', async function (page) { + return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) { await page.goto(shareLink[page.url()]); await helper.delay(500); }, {waitUntil: 'networkidle2', viewport: resolution}); @@ -89,7 +89,7 @@ describe('public', function () { }); it('file-unshare', async function () { - return helper.takeAndCompare(this, '/index.php/apps/files', async function (page) { + return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) { const element = await page.$('[data-file="welcome.txt"] .action-share'); await element.click('[data-file="welcome.txt"] .action-share'); await page.waitForSelector('input.linkCheckbox'); diff --git a/tests/ui-regression/test/settingsSpec.js b/tests/ui-regression/test/settingsSpec.js index 560218c80f..8b10b281fb 100644 --- a/tests/ui-regression/test/settingsSpec.js +++ b/tests/ui-regression/test/settingsSpec.js @@ -33,24 +33,24 @@ describe('settings', function () { config.resolutions.forEach(function (resolution) { it('personal.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/settings/user', async function (page) { + return helper.takeAndCompare(this, 'index.php/settings/user', async function (page) { }, {viewport: resolution}); }); it('admin.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/settings/admin', async function (page) { + return helper.takeAndCompare(this, 'index.php/settings/admin', async function (page) { }, {viewport: resolution}); }); ['sharing', 'security', 'theming', 'encryption', 'additional', 'tips-tricks'].forEach(function(endpoint) { it('admin.' + endpoint + '.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/settings/admin/' + endpoint, async function (page) { + return helper.takeAndCompare(this, 'index.php/settings/admin/' + endpoint, async function (page) { }, {viewport: resolution, waitUntil: 'networkidle2'}); }); }); it('usermanagement.' + resolution.title, async function () { - return helper.takeAndCompare(this, '/index.php/settings/users', async function (page) { + return helper.takeAndCompare(this, 'index.php/settings/users', async function (page) { }, {viewport: resolution}); });