diff --git a/test/e2e-app-template/www/index.js b/test/e2e-app-template/www/index.js index 86d8cd4..016fded 100644 --- a/test/e2e-app-template/www/index.js +++ b/test/e2e-app-template/www/index.js @@ -10,12 +10,12 @@ const app = { var onlyFlaggedTests = []; var enabledTests = []; - + tests.forEach(function (test) { if (test.only) { onlyFlaggedTests.push(test); } - + if (!test.disabled) { enabledTests.push(test); } @@ -50,6 +50,16 @@ const app = { }; }, + skip: function (content) { + document.getElementById('statusInput').value = 'finished'; + app.printResult('result - skipped', content); + + app.lastResult = { + type: 'skipped', + data: content + }; + }, + throw: function (error) { document.getElementById('statusInput').value = 'finished'; app.printResult('result - throwed', error.message); @@ -126,7 +136,7 @@ const app = { const execTest = function () { try { - testDefinition.func(app.resolve, app.reject); + testDefinition.func(app.resolve, app.reject, app.skip); } catch (error) { app.throw(error); } diff --git a/test/e2e-tooling/test.js b/test/e2e-tooling/test.js index c34917d..343c7e1 100644 --- a/test/e2e-tooling/test.js +++ b/test/e2e-tooling/test.js @@ -49,11 +49,15 @@ describe('Advanced HTTP e2e test suite', function () { }); const defineTestForMocha = (test, index) => { - it(index + ': ' + test.description, async () => { + it(index + ': ' + test.description, async function() { await clickNext(driver); await validateTestIndex(driver, index); await validateTestTitle(driver, test.description); await waitToBeFinished(driver, test.timeout || 10000); + var skipped = await checkSkipped(driver); + if(skipped){ + this.skip(); + } await validateResult(driver, test.validationFunc, targetInfo); }); }; @@ -117,6 +121,11 @@ async function validateResult(driver, validationFunc, targetInfo) { validationFunc(driver, result, targetInfo); } +async function checkSkipped(driver) { + const result = await driver.safeExecute('app.lastResult'); + return result.type === 'skipped'; +} + function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }