angular-cn/aio/tests/e2e/api.po.ts
Pete Bacon Darwin d509bd6849 build(aio): improve the API Pipe pages (#22702)
This change adds:

* an impure badge for Pipes that are marked as  `pure: false`
* a pipe specific overview that shows the syntax for using a pipe in a template.
* an "input value" section describing the type of the value that the pipe expects.
* a "pipe params" section describing any additional params that a pipe expects.

PR Close #22702
2018-03-14 14:21:11 -07:00

43 lines
1.0 KiB
TypeScript

import { element, by } from 'protractor';
import { SitePage } from './app.po';
export class ApiPage extends SitePage {
constructor(url: string) {
super();
this.navigateTo(url);
}
getDescendants(docType: string, onlyDirect = false) {
// This selector is horrible because we have potentially recursive HTML lists
//
// ul
// li
// code
// ul
// li
// code
// ul
// li
// code
// li
// code
//
// and we want to be able to pull out the code elements from only the first level
// if `onlyDirect` is set to `true`.
const selector = `.descendants.${docType} ${onlyDirect ? '>' : ''} ul > li > code`;
return element.all(by.css(selector)).map<string>(item => item && item.getText());
}
getOverview(docType) {
return element(by.css(`.${docType}-overview`));
}
getSection(cls) {
return element(by.css(`section.${cls}`));
}
getBadge(cls) {
return element(by.css('.api-status-label.' + cls));
}
}