Upgrade to protractor 5

This commit is contained in:
Roman Hotsiy 2017-01-28 13:26:45 +02:00
parent ce9d9b5ff0
commit 117d5bf9ec
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 14 additions and 8 deletions

View File

@ -87,7 +87,7 @@
"ngc-webpack": "^1.1.0", "ngc-webpack": "^1.1.0",
"node-sass": "^4.1.1", "node-sass": "^4.1.1",
"phantomjs-prebuilt": "^2.1.7", "phantomjs-prebuilt": "^2.1.7",
"protractor": "^4.0.10", "protractor": "^5.0.0",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"rxjs": "^5.0.1", "rxjs": "^5.0.1",

View File

@ -99,10 +99,15 @@ function eachNth(obj, n) {
return res; return res;
} }
function getInnerHtml(locator) {
return browser.executeScript("return arguments[0].innerHTML;", $(locator));
}
module.exports = { module.exports = {
loadJson: loadJson, loadJson: loadJson,
verifyNoBrowserErrors: verifyNoBrowserErrors, verifyNoBrowserErrors: verifyNoBrowserErrors,
scrollToEl: scrollToEl, scrollToEl: scrollToEl,
fixFFTest: fixFFTest, fixFFTest: fixFFTest,
eachNth: eachNth eachNth: eachNth,
getInnerHtml: getInnerHtml
} }

View File

@ -3,6 +3,7 @@ const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors;
const scrollToEl = require('./helpers').scrollToEl; const scrollToEl = require('./helpers').scrollToEl;
const fixFFTest = require('./helpers').fixFFTest; const fixFFTest = require('./helpers').fixFFTest;
const eachNth = require('./helpers').eachNth; const eachNth = require('./helpers').eachNth;
const getInnerHtml = require('./helpers').getInnerHtml;
const URL = 'index.html'; const URL = 'index.html';
@ -56,17 +57,17 @@ describe('Scroll sync', () => {
it('should update active menu entries on page scroll forwards', () => { it('should update active menu entries on page scroll forwards', () => {
scrollToEl('[section="tag/store"]').then(() => { scrollToEl('[section="tag/store"]').then(() => {
expect($('.menu-item.menu-item-depth-1.active > .menu-item-header').getInnerHtml()).toContain('store'); expect(getInnerHtml('.menu-item.menu-item-depth-1.active > .menu-item-header')).toContain('store');
expect($('.selected-tag').getInnerHtml()).toContain('store'); expect(getInnerHtml('.selected-tag')).toContain('store');
}); });
}); });
it('should update active menu entries on page scroll backwards', () => { it('should update active menu entries on page scroll backwards', () => {
scrollToEl('[operation-id="getPetById"]').then(() => { scrollToEl('[operation-id="getPetById"]').then(() => {
expect($('.menu-item.menu-item-depth-1.active .menu-item-header').getInnerHtml()).toContain('pet'); expect(getInnerHtml('.menu-item.menu-item-depth-1.active .menu-item-header')).toContain('pet');
expect($('.selected-tag').getInnerHtml()).toContain('pet'); expect(getInnerHtml('.selected-tag')).toContain('pet');
expect($('.menu-item.menu-item-depth-2.active .menu-item-header').getInnerHtml()).toContain('Find pet by ID'); expect(getInnerHtml('.menu-item.menu-item-depth-2.active .menu-item-header')).toContain('Find pet by ID');
expect($('.selected-endpoint').getInnerHtml()).toContain('Find pet by ID'); expect(getInnerHtml('.selected-endpoint')).toContain('Find pet by ID');
}); });
}); });
}); });