angular/aio/tests/e2e/src/api.po.ts
Pete Bacon Darwin d1589604a8 build(docs-infra): ensure all overloads are shown in interfaces (#43614)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.
There is already a special case for abstract methods that do not have such an implementation overload.

But we were missing the case where the method was part of an interface. In interfaces none of the methods have implementation overloads.

Fixes #43001

PR Close #43614
2021-09-29 09:58:48 -07:00

43 lines
1.2 KiB
TypeScript

import { element, by } from 'protractor';
import { SitePage } from './app.po';
export class ApiPage extends SitePage {
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?.getText());
}
getOverview(docType: string) {
return element(by.css(`.${docType}-overview`));
}
getSection(cls: string) {
return element(by.css(`section.${cls}`));
}
getBadge(cls: string) {
return element(by.css('.api-status-label.' + cls));
}
getInstanceMethodOverloads(name: string) {
return element.all(by.css('.instance-method'))
.filter(async e => (await e.element(by.css('h3')).getText()).includes(name))
.all(by.css('.overload-info'));
}
}