2017-03-13 21:08:23 -04:00
|
|
|
import { browser, element, by, promise } from 'protractor';
|
2017-01-27 03:20:51 -05:00
|
|
|
import { SitePage } from './app.po';
|
|
|
|
|
|
|
|
describe('site App', function() {
|
|
|
|
let page: SitePage;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
page = new SitePage();
|
2017-02-09 20:22:08 -05:00
|
|
|
page.navigateTo();
|
2017-01-27 03:20:51 -05:00
|
|
|
});
|
|
|
|
|
2017-02-02 15:10:47 -05:00
|
|
|
it('should show features text after clicking "Features"', () => {
|
2017-03-21 03:02:58 -04:00
|
|
|
page.getLink('features').click().then(() => {
|
2017-03-14 17:19:19 -04:00
|
|
|
expect(page.getDocViewerText()).toMatch(/Progressive web apps/i);
|
2017-02-09 20:22:08 -05:00
|
|
|
});
|
2017-01-27 03:20:51 -05:00
|
|
|
});
|
2017-02-07 15:57:18 -05:00
|
|
|
|
2017-03-21 03:02:58 -04:00
|
|
|
it('should show the tutorial index page at `/tutorial/`', () => {
|
|
|
|
// check that we can navigate directly to the tutorial page
|
|
|
|
page.navigateTo('tutorial/');
|
|
|
|
expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i);
|
|
|
|
|
|
|
|
// navigate to a different page
|
|
|
|
page.getLink('features').click();
|
|
|
|
|
|
|
|
// check that we can navigate to the tutorial page via a link in the navigation
|
|
|
|
const heading = page.getNavHeading(/tutorial/i);
|
|
|
|
expect(heading.getText()).toMatch(/tutorial/i);
|
|
|
|
heading.click();
|
|
|
|
page.getLink('tutorial/').click();
|
|
|
|
expect(page.getDocViewerText()).toMatch(/Tutorial: Tour of Heroes/i);
|
|
|
|
});
|
|
|
|
|
2017-03-22 16:24:40 -04:00
|
|
|
it('should render `{@example}` dgeni tags as `<code-example>` elements with HTML escaped content', () => {
|
|
|
|
page.navigateTo('guide/component-styles');
|
|
|
|
const codeExample = element.all(by.css('code-example')).first();
|
|
|
|
expect(page.getInnerHtml(codeExample))
|
|
|
|
.toContain('@Component({\n selector: \'hero-app\',\n template: `\n <h1>Tour of Heroes</h1>');
|
|
|
|
});
|
2017-03-13 21:08:23 -04:00
|
|
|
|
2017-03-17 19:02:03 -04:00
|
|
|
describe('api-docs', () => {
|
|
|
|
it('should show a link to github', () => {
|
|
|
|
page.navigateTo('api/common/NgClass');
|
|
|
|
expect(page.ghLink.getAttribute('href'))
|
|
|
|
.toMatch(/https:\/\/github.com\/angular\/angular\/tree\/.+\/packages\/common\/src\/directives\/ng_class\.ts/);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-03-13 21:08:23 -04:00
|
|
|
describe('google analytics', () => {
|
|
|
|
beforeEach(done => page.gaReady.then(done));
|
|
|
|
|
|
|
|
it('should call ga', done => {
|
|
|
|
page.ga()
|
|
|
|
.then(calls => {
|
|
|
|
expect(calls.length).toBeGreaterThan(2, 'ga calls');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should call ga with initial URL', done => {
|
|
|
|
let path: string;
|
|
|
|
|
|
|
|
page.locationPath()
|
|
|
|
.then(p => path = p)
|
|
|
|
.then(() => page.ga().then(calls => {
|
|
|
|
expect(calls.length).toBeGreaterThan(2, 'ga calls');
|
|
|
|
expect(calls[1]).toEqual(['set', 'page', path]);
|
|
|
|
done();
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Todo: add test to confirm tracking URL when navigate.
|
|
|
|
});
|
|
|
|
|
2017-01-27 03:20:51 -05:00
|
|
|
});
|