From 117d5bf9ec92ce4ca701de6b75542f038e93ef2e Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sat, 28 Jan 2017 13:26:45 +0200 Subject: [PATCH] Upgrade to protractor 5 --- package.json | 2 +- tests/e2e/helpers.js | 7 ++++++- tests/e2e/redoc.e2e.js | 13 +++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e4c6c4b5e0..8f35097f8c 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "ngc-webpack": "^1.1.0", "node-sass": "^4.1.1", "phantomjs-prebuilt": "^2.1.7", - "protractor": "^4.0.10", + "protractor": "^5.0.0", "raw-loader": "^0.5.1", "rimraf": "^2.5.4", "rxjs": "^5.0.1", diff --git a/tests/e2e/helpers.js b/tests/e2e/helpers.js index 4c00744b3b..f846ec01cf 100644 --- a/tests/e2e/helpers.js +++ b/tests/e2e/helpers.js @@ -99,10 +99,15 @@ function eachNth(obj, n) { return res; } +function getInnerHtml(locator) { + return browser.executeScript("return arguments[0].innerHTML;", $(locator)); +} + module.exports = { loadJson: loadJson, verifyNoBrowserErrors: verifyNoBrowserErrors, scrollToEl: scrollToEl, fixFFTest: fixFFTest, - eachNth: eachNth + eachNth: eachNth, + getInnerHtml: getInnerHtml } diff --git a/tests/e2e/redoc.e2e.js b/tests/e2e/redoc.e2e.js index c3abfb08a1..c0fb08df92 100644 --- a/tests/e2e/redoc.e2e.js +++ b/tests/e2e/redoc.e2e.js @@ -3,6 +3,7 @@ const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors; const scrollToEl = require('./helpers').scrollToEl; const fixFFTest = require('./helpers').fixFFTest; const eachNth = require('./helpers').eachNth; +const getInnerHtml = require('./helpers').getInnerHtml; const URL = 'index.html'; @@ -56,17 +57,17 @@ describe('Scroll sync', () => { it('should update active menu entries on page scroll forwards', () => { scrollToEl('[section="tag/store"]').then(() => { - expect($('.menu-item.menu-item-depth-1.active > .menu-item-header').getInnerHtml()).toContain('store'); - expect($('.selected-tag').getInnerHtml()).toContain('store'); + expect(getInnerHtml('.menu-item.menu-item-depth-1.active > .menu-item-header')).toContain('store'); + expect(getInnerHtml('.selected-tag')).toContain('store'); }); }); it('should update active menu entries on page scroll backwards', () => { scrollToEl('[operation-id="getPetById"]').then(() => { - expect($('.menu-item.menu-item-depth-1.active .menu-item-header').getInnerHtml()).toContain('pet'); - expect($('.selected-tag').getInnerHtml()).toContain('pet'); - expect($('.menu-item.menu-item-depth-2.active .menu-item-header').getInnerHtml()).toContain('Find pet by ID'); - expect($('.selected-endpoint').getInnerHtml()).toContain('Find pet by ID'); + expect(getInnerHtml('.menu-item.menu-item-depth-1.active .menu-item-header')).toContain('pet'); + expect(getInnerHtml('.selected-tag')).toContain('pet'); + expect(getInnerHtml('.menu-item.menu-item-depth-2.active .menu-item-header')).toContain('Find pet by ID'); + expect(getInnerHtml('.selected-endpoint')).toContain('Find pet by ID'); }); }); });