mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Added more thens to e2e tests
This commit is contained in:
@@ -8,12 +8,14 @@ describe('protractor App', () => {
|
||||
});
|
||||
|
||||
it('should display translated title "DSpace Angular :: Home"', () => {
|
||||
page.navigateTo();
|
||||
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home');
|
||||
page.navigateTo()
|
||||
.then(() =>
|
||||
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home'));
|
||||
});
|
||||
|
||||
it('should contain a news section', () => {
|
||||
page.navigateTo()
|
||||
.then(() => expect<any>(page.getHomePageNewsText()).toBeDefined());
|
||||
.then(() =>
|
||||
page.getHomePageNewsText().then((text) => expect<any>(text).toBeDefined()));
|
||||
});
|
||||
});
|
||||
|
@@ -22,10 +22,11 @@ describe('protractor SearchPage', () => {
|
||||
page.navigateToSearch()
|
||||
.then(() => page.getRandomScopeOption())
|
||||
.then((scopeString: string) => {
|
||||
page.navigateToSearchWithScopeParameter(scopeString);
|
||||
page.getCurrentScope().then((s: string) => {
|
||||
expect<string>(s).toEqual(scopeString);
|
||||
});
|
||||
page.navigateToSearchWithScopeParameter(scopeString)
|
||||
.then(() => page.getCurrentScope())
|
||||
.then((s: string) => {
|
||||
expect<string>(s).toEqual(scopeString);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,13 +34,15 @@ describe('protractor SearchPage', () => {
|
||||
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;
|
||||
});
|
||||
});
|
||||
page.setCurrentScope(scopeString)
|
||||
.then(() => page.submitSearchForm())
|
||||
.then(() => () => {
|
||||
browser.wait(() => {
|
||||
return browser.getCurrentUrl().then((url: string) => {
|
||||
return url.indexOf('scope=' + encodeURI(scopeString)) !== -1;
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -27,7 +27,7 @@ export class ProtractorPage {
|
||||
}
|
||||
|
||||
setCurrentScope(scope: string) {
|
||||
element(by.css('#search-form option[value="' + scope + '"]')).click();
|
||||
return element(by.css('#search-form option[value="' + scope + '"]')).click();
|
||||
}
|
||||
|
||||
setCurrentQuery(query: string) {
|
||||
@@ -35,7 +35,7 @@ export class ProtractorPage {
|
||||
}
|
||||
|
||||
submitSearchForm() {
|
||||
element(by.css('#search-form button.search-button')).click();
|
||||
return element(by.css('#search-form button.search-button')).click();
|
||||
}
|
||||
|
||||
getRandomScopeOption(): promise.Promise<string> {
|
||||
|
Reference in New Issue
Block a user