attempt to diagnose travis-only e2e issues

This commit is contained in:
Art Lowel
2020-01-27 17:33:54 +01:00
parent ed11cb9f01
commit cab971211f
3 changed files with 25 additions and 20 deletions

View File

@@ -1,3 +1,4 @@
import { by, element } from 'protractor';
import { ProtractorPage } from './app.po'; import { ProtractorPage } from './app.po';
describe('protractor App', () => { describe('protractor App', () => {
@@ -13,7 +14,8 @@ describe('protractor App', () => {
}); });
it('should contain a news section', () => { 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<any>(page.getHomePageNewsText()).toBeDefined(); expect<any>(page.getHomePageNewsText()).toBeDefined();
}); });
}); });

View File

@@ -11,6 +11,6 @@ export class ProtractorPage {
} }
getHomePageNewsText() { getHomePageNewsText() {
return element(by.xpath('//ds-home-news')).getText(); return element(by.css('ds-home-news')).getText();
} }
} }

View File

@@ -11,33 +11,36 @@ describe('protractor SearchPage', () => {
it('should contain query value when navigating to page with query parameter', () => { it('should contain query value when navigating to page with query parameter', () => {
const queryString = 'Interesting query string'; const queryString = 'Interesting query string';
page.navigateToSearchWithQueryParameter(queryString); page.navigateToSearchWithQueryParameter(queryString)
page.getCurrentQuery().then((query: string) => { .then(() => page.getCurrentQuery())
expect<string>(query).toEqual(queryString); .then((query: string) => {
}); expect<string>(query).toEqual(queryString);
});
}); });
it('should have right scope selected when navigating to page with scope parameter', () => { it('should have right scope selected when navigating to page with scope parameter', () => {
const scope: promise.Promise<string> = page.getRandomScopeOption(); page.navigateToSearch()
scope.then((scopeString: string) => { .then(() => page.getRandomScopeOption())
page.navigateToSearchWithScopeParameter(scopeString); .then((scopeString: string) => {
page.getCurrentScope().then((s: string) => { page.navigateToSearchWithScopeParameter(scopeString);
expect<string>(s).toEqual(scopeString); page.getCurrentScope().then((s: string) => {
expect<string>(s).toEqual(scopeString);
});
}); });
});
}); });
it('should redirect to the correct url when scope was set and submit button was triggered', () => { it('should redirect to the correct url when scope was set and submit button was triggered', () => {
const scope: promise.Promise<string> = page.getRandomScopeOption(); page.navigateToSearch()
scope.then((scopeString: string) => { .then(() => page.getRandomScopeOption())
page.setCurrentScope(scopeString); .then((scopeString: string) => {
page.submitSearchForm(); page.setCurrentScope(scopeString);
browser.wait(() => { page.submitSearchForm();
return browser.getCurrentUrl().then((url: string) => { browser.wait(() => {
return url.indexOf('scope=' + encodeURI(scopeString)) !== -1; 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', () => { it('should redirect to the correct url when query was set and submit button was triggered', () => {