diff --git a/protractor.conf.js b/protractor.conf.js index 40168254..8840af64 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -13,6 +13,9 @@ let config = { // load APIs.guru list return loadJson('https://apis-guru.github.io/api-models/api/v1/list.json').then((list) => { global.apisGuruList = list; + return browser.getCapabilities().then(function (cap) { + browser.isIE = cap.caps_.browserName === 'internet explorer'; + }); }); }, //directConnect: true, @@ -20,10 +23,20 @@ let config = { jasmineNodeOpts: { showTiming: true, showColors: true, - defaultTimeoutInterval: 60000, + defaultTimeoutInterval: 120000, print: function() {} }, - multiCapabilities: [{ + multiCapabilities: [ + { browserName: 'chrome' }, + { browserName: 'firefox' } + ] +}; + +if (travis) { + config.sauceUser = process.env.SAUCE_USERNAME; + config.sauceKey = process.env.SAUCE_ACCESS_KEY; + config.sauceSeleniumAddres = 'localhost:4445/wd/hub'; + config.multiCapabilities = [{ browserName: 'chrome', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, build: process.env.TRAVIS_BUILD_NUMBER, @@ -45,14 +58,8 @@ let config = { version: '11.0', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, build: process.env.TRAVIS_BUILD_NUMBER, - name: 'Redoc Firefox Latest/Win build ' + process.env.TRAVIS_BUILD_NUMBER - }] -}; - -if (travis) { - config.sauceUser = process.env.SAUCE_USERNAME; - config.sauceKey = process.env.SAUCE_ACCESS_KEY; - config.sauceSeleniumAddres = 'localhost:4445/wd/hub'; + name: 'Redoc IE11/Win build ' + process.env.TRAVIS_BUILD_NUMBER + }]; } else { config.directConnect = true; } diff --git a/tests/e2e/helpers.js b/tests/e2e/helpers.js index 901557b7..0b570074 100644 --- a/tests/e2e/helpers.js +++ b/tests/e2e/helpers.js @@ -30,12 +30,25 @@ const LogLevel = { const MAX_ERROR_MESSAGE_SYMBOLS = 128; //copied from angular/modules/angular2/src/testing/e2e_util.ts function verifyNoBrowserErrors() { + // IE doesn't support logs method + if (browser.isIE) { + let err = browser.executeScript('return window.redocError'); + expect(err).toBeNull(); + return; + } + // Bug in ChromeDriver: Need to execute at least one command // so that the browser logs can be read out! browser.executeScript('1+1'); browser.manage().logs().get('browser').then(function(browserLog) { let filteredLog = browserLog.filter((logEntry) => { let message = logEntry.message; + + // skip browser-sync errors + if (message.indexOf('browser-sync') > -1) return false; + // skip firefox-specific warning + if (message.indexOf('mutating the [[Prototype]]') > -1) return false; + if (logEntry.level.value >= LogLevel.INFO) { if (message.length > MAX_ERROR_MESSAGE_SYMBOLS) { message = message.substr(0, MAX_ERROR_MESSAGE_SYMBOLS) + '...'; @@ -43,8 +56,6 @@ function verifyNoBrowserErrors() { console.log('>> ' + message); } - // skip browser-sync errors - if (message.indexOf('browser-sync') > -1) return false; return logEntry.level.value > LogLevel.WARNING; }); expect(filteredLog.length).toEqual(0, `Found ${filteredLog.length} browser errors`); @@ -60,8 +71,20 @@ function scrollToEl(selector) { return browser.driver.executeScript(script); } +function fixFFTest(done) { + // firefox issue. the first try to access something from webpage fails + // but the second works fine. So skipping first error + $('body').isPresent().then(()=> { + done(); + }, () => { + //error skipped + done(); + }) +} + module.exports = { loadJson: loadJson, verifyNoBrowserErrors: verifyNoBrowserErrors, - scrollToEl: scrollToEl + scrollToEl: scrollToEl, + fixFFTest: fixFFTest } diff --git a/tests/e2e/index.html b/tests/e2e/index.html index efe1225a..1adf5db4 100644 --- a/tests/e2e/index.html +++ b/tests/e2e/index.html @@ -1,19 +1,23 @@
+