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)', () => {
|
2020-11-18 05:36:06 -05:00
|
|
|
it('should show the home page', async () => {
|
|
|
|
await page.goTo('');
|
|
|
|
const text = await page.getDocViewerText();
|
2018-04-15 17:02:28 -04:00
|
|
|
|
2020-12-09 16:43:09 -05:00
|
|
|
expect(text).toContain('modern web');
|
|
|
|
expect(text).toContain('developer\'s platform');
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
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',
|
2019-04-02 02:12:55 -04:00
|
|
|
docs: 'introduction to the angular docs',
|
2018-04-15 17:02:28 -04:00
|
|
|
events: 'events',
|
|
|
|
resources: 'explore angular resources',
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.keys(textPerUrl).forEach(url => {
|
2020-11-18 05:36:06 -05:00
|
|
|
it(`should show the page at '${url}'`, async () => {
|
|
|
|
await page.goTo(url);
|
|
|
|
await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
2018-10-23 14:34:57 -04:00
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
expect(await page.getDocViewerText()).toContain(textPerUrl[url]);
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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',
|
|
|
|
'guide/security': 'security',
|
|
|
|
tutorial: 'tutorial',
|
2019-04-02 02:12:55 -04:00
|
|
|
start: 'getting started',
|
2018-04-15 17:02:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Object.keys(textPerUrl).forEach(url => {
|
2020-11-18 05:36:06 -05:00
|
|
|
it(`should show the page at '${url}'`, async () => {
|
|
|
|
await page.goTo(url);
|
|
|
|
await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
2018-10-23 14:34:57 -04:00
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
expect(await page.getDocViewerText()).toContain(textPerUrl[url]);
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(api docs pages)', () => {
|
2019-04-24 08:27:24 -04:00
|
|
|
const textPerUrl: { [key: string]: string } = {
|
2021-04-23 11:06:01 -04:00
|
|
|
/* Class */ 'api/core/Injector-0': 'class injector',
|
2018-04-15 17:02:28 -04:00
|
|
|
/* 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 => {
|
2020-11-18 05:36:06 -05:00
|
|
|
it(`should show the page at '${url}'`, async () => {
|
|
|
|
await page.goTo(url);
|
|
|
|
await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
|
2018-10-23 14:34:57 -04:00
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
expect(await page.getDocViewerText()).toContain(textPerUrl[url]);
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('(search results)', () => {
|
|
|
|
beforeEach(() => page.goTo(''));
|
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
it('should find pages when searching by a partial word in the title', async () => {
|
|
|
|
await page.enterSearch('ngCont');
|
|
|
|
expect(await page.getSearchResults()).toContain('NgControl');
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
it('should find API docs when searching for an instance member name', async () => {
|
|
|
|
await page.enterSearch('writeValue');
|
|
|
|
expect(await page.getSearchResults()).toContain('ControlValueAccessor');
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
it('should find API docs when searching for a static member name', async () => {
|
|
|
|
await page.enterSearch('compose');
|
|
|
|
expect(await page.getSearchResults()).toContain('Validators');
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-11-18 05:36:06 -05:00
|
|
|
it('should show relevant results on 404', async () => {
|
2021-03-29 17:02:54 -04:00
|
|
|
await page.goTo('common/http');
|
2020-11-18 05:36:06 -05:00
|
|
|
const results = await page.getSearchResults();
|
2018-04-15 17:02:28 -04:00
|
|
|
|
2021-03-29 17:02:54 -04:00
|
|
|
expect(results).toContain('common/http package');
|
2018-04-15 17:02:28 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|