mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +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"', () => {
|
it('should display translated title "DSpace Angular :: Home"', () => {
|
||||||
page.navigateTo();
|
page.navigateTo()
|
||||||
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home');
|
.then(() =>
|
||||||
|
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain a news section', () => {
|
it('should contain a news section', () => {
|
||||||
page.navigateTo()
|
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()
|
page.navigateToSearch()
|
||||||
.then(() => page.getRandomScopeOption())
|
.then(() => page.getRandomScopeOption())
|
||||||
.then((scopeString: string) => {
|
.then((scopeString: string) => {
|
||||||
page.navigateToSearchWithScopeParameter(scopeString);
|
page.navigateToSearchWithScopeParameter(scopeString)
|
||||||
page.getCurrentScope().then((s: string) => {
|
.then(() => page.getCurrentScope())
|
||||||
expect<string>(s).toEqual(scopeString);
|
.then((s: string) => {
|
||||||
});
|
expect<string>(s).toEqual(scopeString);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,13 +34,15 @@ describe('protractor SearchPage', () => {
|
|||||||
page.navigateToSearch()
|
page.navigateToSearch()
|
||||||
.then(() => page.getRandomScopeOption())
|
.then(() => page.getRandomScopeOption())
|
||||||
.then((scopeString: string) => {
|
.then((scopeString: string) => {
|
||||||
page.setCurrentScope(scopeString);
|
page.setCurrentScope(scopeString)
|
||||||
page.submitSearchForm();
|
.then(() => page.submitSearchForm())
|
||||||
browser.wait(() => {
|
.then(() => () => {
|
||||||
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;
|
||||||
});
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ export class ProtractorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCurrentScope(scope: string) {
|
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) {
|
setCurrentQuery(query: string) {
|
||||||
@@ -35,7 +35,7 @@ export class ProtractorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
submitSearchForm() {
|
submitSearchForm() {
|
||||||
element(by.css('#search-form button.search-button')).click();
|
return element(by.css('#search-form button.search-button')).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
getRandomScopeOption(): promise.Promise<string> {
|
getRandomScopeOption(): promise.Promise<string> {
|
||||||
|
Reference in New Issue
Block a user