diff --git a/e2e/app.e2e-spec.ts b/e2e/app.e2e-spec.ts index 6856a6f01b..a4cd4013c1 100644 --- a/e2e/app.e2e-spec.ts +++ b/e2e/app.e2e-spec.ts @@ -1,3 +1,4 @@ +import { by, element } from 'protractor'; import { ProtractorPage } from './app.po'; describe('protractor App', () => { @@ -13,7 +14,8 @@ describe('protractor App', () => { }); it('should contain a news section', () => { - page.navigateTo(); + page.navigateTo() + .then(() => element(by.css('.main-content')).getAttribute('innerHTML').then((v) => process.stdout.write(v))); expect(page.getHomePageNewsText()).toBeDefined(); }); }); diff --git a/e2e/app.po.ts b/e2e/app.po.ts index c76bef118f..2ee9a86201 100644 --- a/e2e/app.po.ts +++ b/e2e/app.po.ts @@ -11,6 +11,6 @@ export class ProtractorPage { } getHomePageNewsText() { - return element(by.xpath('//ds-home-news')).getText(); + return element(by.css('ds-home-news')).getText(); } } diff --git a/e2e/search-page/search-page.e2e-spec.ts b/e2e/search-page/search-page.e2e-spec.ts index cb9c92a87b..e2ab6de824 100644 --- a/e2e/search-page/search-page.e2e-spec.ts +++ b/e2e/search-page/search-page.e2e-spec.ts @@ -11,33 +11,36 @@ describe('protractor SearchPage', () => { it('should contain query value when navigating to page with query parameter', () => { const queryString = 'Interesting query string'; - page.navigateToSearchWithQueryParameter(queryString); - page.getCurrentQuery().then((query: string) => { - expect(query).toEqual(queryString); - }); + page.navigateToSearchWithQueryParameter(queryString) + .then(() => page.getCurrentQuery()) + .then((query: string) => { + expect(query).toEqual(queryString); + }); }); it('should have right scope selected when navigating to page with scope parameter', () => { - const scope: promise.Promise = page.getRandomScopeOption(); - scope.then((scopeString: string) => { - page.navigateToSearchWithScopeParameter(scopeString); - page.getCurrentScope().then((s: string) => { - expect(s).toEqual(scopeString); + page.navigateToSearch() + .then(() => page.getRandomScopeOption()) + .then((scopeString: string) => { + page.navigateToSearchWithScopeParameter(scopeString); + page.getCurrentScope().then((s: string) => { + expect(s).toEqual(scopeString); + }); }); - }); }); it('should redirect to the correct url when scope was set and submit button was triggered', () => { - const scope: promise.Promise = page.getRandomScopeOption(); - scope.then((scopeString: string) => { - page.setCurrentScope(scopeString); - page.submitSearchForm(); - browser.wait(() => { - return browser.getCurrentUrl().then((url: string) => { - return url.indexOf('scope=' + encodeURI(scopeString)) !== -1; + page.navigateToSearch() + .then(() => page.getRandomScopeOption()) + .then((scopeString: string) => { + page.setCurrentScope(scopeString); + page.submitSearchForm(); + browser.wait(() => { + return browser.getCurrentUrl().then((url: string) => { + return url.indexOf('scope=' + encodeURI(scopeString)) !== -1; + }); }); }); - }); }); it('should redirect to the correct url when query was set and submit button was triggered', () => {