2018-04-15 17:02:28 -04:00
|
|
|
import { browser } from 'protractor';
|
|
|
|
import { SitePage } from './site.po';
|
|
|
|
|
|
|
|
describe(browser.baseUrl, () => {
|
|
|
|
const page = new SitePage();
|
|
|
|
|
2019-01-22 17:33:41 -05:00
|
|
|
beforeAll(() => page.init());
|
2018-04-15 17:02:28 -04:00
|
|
|
|
|
|
|
beforeEach(() => browser.waitForAngularEnabled(false));
|
2019-01-22 17:43:53 -05:00
|
|
|
|
|
|
|
afterEach(async () => {
|
|
|
|
await page.unregisterSw();
|
|
|
|
await browser.waitForAngularEnabled(true);
|
|
|
|
});
|
2018-04-15 17:02:28 -04:00
|
|
|
|
|
|
|
describe('(smoke tests)', () => {
|
|
|
|
it('should show the home page', () => {
|
|
|
|
page.goTo('');
|
|
|
|
const text = page.getDocViewerText();
|
|
|
|
|
|
|
|
expect(text).toContain('one framework');
|
|
|
|
expect(text).toContain('mobile & desktop');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(marketing pages)', () => {
|
2019-04-24 08:27:24 -04:00
|
|
|
const textPerUrl: { [key: string]: string } = {
|
2018-04-15 17:02:28 -04:00
|
|
|
features: 'features & benefits',
|
|
|
|
docs: 'what is angular?',
|
|
|
|
events: 'events',
|
|
|
|
resources: 'explore angular resources',
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.keys(textPerUrl).forEach(url => {
|
|
|
|
it(`should show the page at '${url}'`, () => {
|
|
|
|
page.goTo(url);
|
2018-10-23 14:34:57 -04:00
|
|
|
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
|
|
|
|
2018-04-15 17:02:28 -04:00
|
|
|
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(docs pages)', () => {
|
2019-04-24 08:27:24 -04:00
|
|
|
const textPerUrl: { [key: string]: string } = {
|
2018-04-15 17:02:28 -04:00
|
|
|
api: 'api list',
|
|
|
|
'guide/architecture': 'architecture',
|
|
|
|
'guide/http': 'httpclient',
|
2018-10-22 08:34:59 -04:00
|
|
|
'guide/quickstart': 'getting started',
|
2018-04-15 17:02:28 -04:00
|
|
|
'guide/security': 'security',
|
|
|
|
tutorial: 'tutorial',
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.keys(textPerUrl).forEach(url => {
|
|
|
|
it(`should show the page at '${url}'`, () => {
|
|
|
|
page.goTo(url);
|
2018-10-23 14:34:57 -04:00
|
|
|
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
|
|
|
|
2018-04-15 17:02:28 -04:00
|
|
|
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(api docs pages)', () => {
|
2019-04-24 08:27:24 -04:00
|
|
|
const textPerUrl: { [key: string]: string } = {
|
2018-04-15 17:02:28 -04:00
|
|
|
/* Class */ 'api/core/Injector': 'class injector',
|
|
|
|
/* Const */ 'api/forms/NG_VALIDATORS': 'const ng_validators',
|
|
|
|
/* Decorator */ 'api/core/Component': '@component',
|
|
|
|
/* Directive */ 'api/common/NgIf': 'class ngif',
|
|
|
|
/* Enum */ 'api/core/ChangeDetectionStrategy': 'enum changedetectionstrategy',
|
|
|
|
/* Function */ 'api/animations/animate': 'animate(',
|
|
|
|
/* Interface */ 'api/core/OnDestroy': 'interface ondestroy',
|
|
|
|
/* Pipe */ 'api/common/JsonPipe': '| json',
|
|
|
|
/* Type-Alias */ 'api/common/http/HttpEvent': 'type httpevent',
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.keys(textPerUrl).forEach(url => {
|
|
|
|
it(`should show the page at '${url}'`, () => {
|
|
|
|
page.goTo(url);
|
2018-10-23 14:34:57 -04:00
|
|
|
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
|
|
|
|
2018-04-15 17:02:28 -04:00
|
|
|
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(search results)', () => {
|
|
|
|
beforeEach(() => page.goTo(''));
|
|
|
|
|
|
|
|
it('should find pages when searching by a partial word in the title', () => {
|
|
|
|
page.enterSearch('ngCont');
|
|
|
|
expect(page.getSearchResults()).toContain('NgControl');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should find API docs when searching for an instance member name', () => {
|
|
|
|
page.enterSearch('writeValue');
|
|
|
|
expect(page.getSearchResults()).toContain('ControlValueAccessor');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should find API docs when searching for a static member name', () => {
|
|
|
|
page.enterSearch('compose');
|
|
|
|
expect(page.getSearchResults()).toContain('Validators');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show relevant results on 404', () => {
|
|
|
|
page.goTo('http/router');
|
|
|
|
const results = page.getSearchResults();
|
|
|
|
|
|
|
|
expect(results).toContain('HttpClient');
|
|
|
|
expect(results).toContain('Router');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|