"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "aio/tests/e2e/src/app.po.ts" between
angular-11.0.1.tar.gz and angular-11.0.2.tar.gz

About: Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript.

app.po.ts  (angular-11.0.1):app.po.ts  (angular-11.0.2)
import { browser, element, by, promise, ElementFinder, ExpectedConditions } from 'protractor'; import { browser, element, by, ElementFinder, ExpectedConditions } from 'protrac tor';
const githubRegex = /https:\/\/github.com\/angular\/angular\//; const githubRegex = /https:\/\/github.com\/angular\/angular\//;
export class SitePage { export class SitePage {
links = element.all(by.css('md-toolbar a')); links = element.all(by.css('md-toolbar a'));
homeLink = element(by.css('a.home')); homeLink = element(by.css('a.home'));
docsMenuLink = element(by.cssContainingText('aio-top-menu a', 'Docs')); docsMenuLink = element(by.cssContainingText('aio-top-menu a', 'Docs'));
sidenav = element(by.css('mat-sidenav')); sidenav = element(by.css('mat-sidenav'));
docViewer = element(by.css('aio-doc-viewer')); docViewer = element(by.css('aio-doc-viewer'));
codeExample = element.all(by.css('aio-doc-viewer pre > code')); codeExample = element.all(by.css('aio-doc-viewer pre > code'));
ghLinks = this.docViewer ghLinks = this.docViewer
.all(by.css('a')) .all(by.css('a'))
.filter((a: ElementFinder) => a.getAttribute('href').then(href => githubRege x.test(href))); .filter(async a => githubRegex.test(await a.getAttribute('href')));
static setWindowWidth(newWidth: number) { static async setWindowWidth(newWidth: number) {
const win = browser.driver.manage().window(); const win = browser.driver.manage().window();
return win.getSize().then(oldSize => win.setSize(newWidth, oldSize.height)); const oldSize = await win.getSize();
await win.setSize(newWidth, oldSize.height);
} }
getNavItem(pattern: RegExp) { getNavItem(pattern: RegExp) {
return element.all(by.css('aio-nav-item .vertical-menu-item')) return element.all(by.css('aio-nav-item .vertical-menu-item'))
.filter(elementFinder => elementFinder.getText().then(text => pattern.test(text))) .filter(async elementFinder => pattern.test(await elementFinde r.getText()))
.first(); .first();
} }
getNavItemHeadings(parent: ElementFinder, level: number) { getNavItemHeadings(parent: ElementFinder, level: number) {
const targetSelector = `aio-nav-item .vertical-menu-item.heading.level-${lev el}`; const targetSelector = `aio-nav-item .vertical-menu-item.heading.level-${lev el}`;
return parent.all(by.css(targetSelector)); return parent.all(by.css(targetSelector));
} }
getNavItemHeadingChildren(heading: ElementFinder, level: number) { getNavItemHeadingChildren(heading: ElementFinder, level: number) {
const targetSelector = `.heading-children.level-${level}`; const targetSelector = `.heading-children.level-${level}`;
const script = `return arguments[0].parentNode.querySelector('${targetSelect or}');`; const script = `return arguments[0].parentNode.querySelector('${targetSelect or}');`;
return element(() => browser.executeScript(script, heading)); return element(() => browser.executeScript(script, heading));
} }
getTopMenuLink(path: string) { return element(by.css(`aio-top-menu a[href="${p ath}"]`)); } getTopMenuLink(path: string) { return element(by.css(`aio-top-menu a[href="${p ath}"]`)); }
ga() { return browser.executeScript('return window["ga"].q') as promise.Promis ga() { return browser.executeScript<any[][]>('return window["ga"].q'); }
e<any[][]>; } locationPath() { return browser.executeScript<string>('return document.locatio
locationPath() { return browser.executeScript('return document.location.pathna n.pathname'); }
me') as promise.Promise<string>; }
navigateTo(pageUrl: string) { async navigateTo(pageUrl: string) {
// Navigate to the page, disable animations, and wait for Angular. // Navigate to the page, disable animations, and wait for Angular.
return browser.get('/' + pageUrl) await browser.get(`/${pageUrl}`);
.then(() => browser.executeScript('document.body.classList.add(\'no-anim await browser.executeScript('document.body.classList.add(\'no-animations\')'
ations\')')) );
.then(() => browser.waitForAngular()); await browser.waitForAngular();
} }
getDocViewerText() { getDocViewerText() {
return this.docViewer.getText(); return this.docViewer.getText();
} }
getInnerHtml(elementFinder: ElementFinder) { getInnerHtml(elementFinder: ElementFinder) {
// `getInnerHtml` was removed from webDriver and this is the workaround. // `getInnerHtml` was removed from webDriver and this is the workaround.
// See https://github.com/angular/protractor/blob/master/CHANGELOG.md#breaki ng-changes // See https://github.com/angular/protractor/blob/master/CHANGELOG.md#breaki ng-changes
return browser.executeScript('return arguments[0].innerHTML;', elementFinder ); return browser.executeScript('return arguments[0].innerHTML;', elementFinder );
skipping to change at line 71 skipping to change at line 72
scrollTo(y: 'top' | 'bottom' | number) { scrollTo(y: 'top' | 'bottom' | number) {
const yExpr = (y === 'top') ? '0' : (y === 'bottom') ? 'document.body.scroll Height' : y; const yExpr = (y === 'top') ? '0' : (y === 'bottom') ? 'document.body.scroll Height' : y;
return browser.executeScript(` return browser.executeScript(`
window.scrollTo(0, ${yExpr}); window.scrollTo(0, ${yExpr});
window.dispatchEvent(new Event('scroll')); window.dispatchEvent(new Event('scroll'));
`); `);
} }
click(elementFinder: ElementFinder) { async click(elementFinder: ElementFinder) {
return elementFinder.click().then(() => browser.waitForAngular()); await elementFinder.click();
await browser.waitForAngular();
} }
enterSearch(query: string) { async enterSearch(query: string) {
const input = element(by.css('.search-container input[type=search]')); const input = element(by.css('.search-container input[type=search]'));
input.clear(); await input.clear();
input.sendKeys(query); await input.sendKeys(query);
} }
getSearchResults() { async getSearchResults() {
const results = element.all(by.css('.search-results li')); const results = element.all(by.css('.search-results li'));
browser.wait(ExpectedConditions.presenceOf(results.first()), 8000); await browser.wait(ExpectedConditions.presenceOf(results.first()), 8000);
return results.map(link => link && link.getText()); return results.map(link => link?.getText());
} }
getApiSearchResults() { async getApiSearchResults() {
const results = element.all(by.css('aio-api-list .api-item')); const results = element.all(by.css('aio-api-list .api-item'));
browser.wait(ExpectedConditions.presenceOf(results.first()), 2000); await browser.wait(ExpectedConditions.presenceOf(results.first()), 2000);
return results.map(elem => elem && elem.getText()); return results.map(elem => elem?.getText());
} }
clickDropdownItem(dropdown: ElementFinder, itemName: string){ async clickDropdownItem(dropdown: ElementFinder, itemName: string){
dropdown.element(by.css('.form-select-button')).click(); await dropdown.element(by.css('.form-select-button')).click();
const menuItem = dropdown.element(by.cssContainingText('.form-select-dropdow n li', itemName)); const menuItem = dropdown.element(by.cssContainingText('.form-select-dropdow n li', itemName));
menuItem.click(); await menuItem.click();
} }
} }
 End of changes. 17 change blocks. 
28 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)