aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-07-16 22:06:44 +0200
committerJulius Härtl <jus@bitgrid.net>2018-07-29 22:52:35 +0200
commitf7d2cdbd978d9af0fe53dc708b10bbf47670aecd (patch)
tree70cb99db373dfb26dc8ed1f77b67fcbbf86a245f
parent138a527cc42db4f24dd215cd9f1e2ccb78b0bf62 (diff)
downloadnextcloud-server-f7d2cdbd978d9af0fe53dc708b10bbf47670aecd.tar.gz
nextcloud-server-f7d2cdbd978d9af0fe53dc708b10bbf47670aecd.zip
Fix new settings and login tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--tests/ui-regression/config.js2
-rw-r--r--tests/ui-regression/helper.js7
-rw-r--r--tests/ui-regression/package.json6
-rw-r--r--tests/ui-regression/test/appsSpec.js2
-rw-r--r--tests/ui-regression/test/installSpec.js4
-rw-r--r--tests/ui-regression/test/loginSpec.js8
-rw-r--r--tests/ui-regression/test/publicSpec.js8
-rw-r--r--tests/ui-regression/test/settingsSpec.js8
8 files changed, 28 insertions, 17 deletions
diff --git a/tests/ui-regression/config.js b/tests/ui-regression/config.js
index c6519ba289d..bb0f20240b8 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 7168c80585b..ed2a58ea70a 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 979dfed3dec..8ab4cf530f2 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 b5e5a889e41..3a23c1df773 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 02577883aae..bfb063bd467 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 23f86737a76..8607bbabc84 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 843f8f50cef..0893adf9a42 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 560218c80f8..8b10b281fb6 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});
});