feat(aio): include more API results in search
By adding a more relaxed search on the title of docs, we are more likely to catch API docs. The additional search terms match anything with a word in the title that starts with the characters of the first term in the search. E.g. if the search is "ngCont guide" then search for "ngCont guide titleWords:ngCont*"
This commit is contained in:

committed by
Matias Niemelä

parent
c3907893c1
commit
c86e16db5f
@ -92,4 +92,10 @@ describe('site App', function() {
|
||||
// Todo: add test to confirm tracking URL when navigate.
|
||||
});
|
||||
|
||||
describe('search', () => {
|
||||
it('should find pages when searching by a partial word in the title', () => {
|
||||
page.enterSearch('ngCont');
|
||||
expect(page.getSearchResults().map(link => link.getText())).toContain('NgControl');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { browser, element, by, promise, ElementFinder } from 'protractor';
|
||||
import { browser, element, by, promise, ElementFinder, ExpectedConditions } from 'protractor';
|
||||
|
||||
const githubRegex = /https:\/\/github.com\/angular\/angular\//;
|
||||
|
||||
@ -50,6 +50,16 @@ export class SitePage {
|
||||
return browser.executeScript('window.scrollTo(0, document.body.scrollHeight)');
|
||||
}
|
||||
|
||||
enterSearch(query: string) {
|
||||
element(by.css('.search-container input[type=search]')).sendKeys(query);
|
||||
}
|
||||
|
||||
getSearchResults() {
|
||||
const results = element.all(by.css('.search-results li'));
|
||||
browser.wait(ExpectedConditions.presenceOf(results.first()), 8000);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the ambient Google Analytics tracker with homebrew spy
|
||||
* don't send commands to GA during e2e testing!
|
||||
|
Reference in New Issue
Block a user