diff --git a/aio/tests/e2e/src/api-list.e2e-spec.ts b/aio/tests/e2e/src/api-list.e2e-spec.ts new file mode 100644 index 0000000000..d5d3f2d7db --- /dev/null +++ b/aio/tests/e2e/src/api-list.e2e-spec.ts @@ -0,0 +1,52 @@ +import { by, element } from 'protractor'; +import { SitePage } from './app.po'; + +describe('api-list', () => { + const apiSearchInput = element(by.css('aio-api-list .form-search input')); + const apiStatusDropdown = element(by.css('aio-api-list aio-select[label="Status:"]')); + const apiTypeDropdown = element(by.css('aio-api-list aio-select[label="Type:"]')); + let page: SitePage; + + beforeEach(() => { + page = new SitePage(); + page.navigateTo('api'); + }); + + it('should find AnimationSequenceMetadata when searching by partial word anima', () => { + expect(page.getApiSearchResults()).toContain('HttpEventType'); + + apiSearchInput.clear(); + apiSearchInput.sendKeys('anima'); + + expect(page.getApiSearchResults()).not.toContain('HttpEventType'); + expect(page.getApiSearchResults()).toContain('AnimationSequenceMetadata'); + }); + + it('should find getLocaleDateTimeFormat when searching by partial word date', () => { + expect(page.getApiSearchResults()).toContain('formatCurrency'); + + apiSearchInput.clear(); + apiSearchInput.sendKeys('date'); + + expect(page.getApiSearchResults()).not.toContain('formatCurrency'); + expect(page.getApiSearchResults()).toContain('getLocaleDateTimeFormat'); + }); + + it('should find LowerCasePipe when searching for type pipe', () => { + expect(page.getApiSearchResults()).toContain('getLocaleDateTimeFormat'); + + page.clickDropdownItem(apiTypeDropdown, 'Pipe'); + + expect(page.getApiSearchResults()).not.toContain('getLocaleDateTimeFormat'); + expect(page.getApiSearchResults()).toContain('LowerCasePipe'); + }); + + it('should find ElementRef when searching for status Security Risk', () => { + expect(page.getApiSearchResults()).toContain('getLocaleDateTimeFormat'); + + page.clickDropdownItem(apiStatusDropdown, 'Security Risk'); + + expect(page.getApiSearchResults()).not.toContain('getLocaleDateTimeFormat'); + expect(page.getApiSearchResults()).toContain('ElementRef'); + }); +}); diff --git a/aio/tests/e2e/src/api.e2e-spec.ts b/aio/tests/e2e/src/api-pages.e2e-spec.ts similarity index 100% rename from aio/tests/e2e/src/api.e2e-spec.ts rename to aio/tests/e2e/src/api-pages.e2e-spec.ts diff --git a/aio/tests/e2e/src/app.po.ts b/aio/tests/e2e/src/app.po.ts index 95bca28562..76a7725d63 100644 --- a/aio/tests/e2e/src/app.po.ts +++ b/aio/tests/e2e/src/app.po.ts @@ -83,4 +83,16 @@ export class SitePage { browser.wait(ExpectedConditions.presenceOf(results.first()), 8000); return results.map(link => link && link.getText()); } + + getApiSearchResults() { + const results = element.all(by.css('aio-api-list .api-item')); + browser.wait(ExpectedConditions.presenceOf(results.first()), 2000); + return results.map(elem => elem && elem.getText()); + } + + clickDropdownItem(dropdown: ElementFinder, itemName: string){ + dropdown.element(by.css('.form-select-button')).click(); + const menuItem = dropdown.element(by.cssContainingText('.form-select-dropdown li', itemName)); + menuItem.click(); + } }