Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
waitForApplicationPage() {
// return browser.wait(until.presenceOf(element(by.tagName('app-application-wall'))), 5000);
return browser.wait(until.presenceOf(element(by.tagName('app-dashboard-base'))), 5000);
}
private getTableRows(): ElementArrayFinder {
return this.locator.element(by.tagName('tbody')).all(by.tagName('tr'));
}
describe('Tour of Heroes (Observable)', function () {
let initialHeroCount = 4;
let newHeroName = 'Mr. IQ';
let heroCountAfterAdd = 5;
let heroListComp = element(by.tagName('hero-list'));
let addButton = heroListComp.element(by.tagName('button'));
let heroTags = heroListComp.all(by.tagName('li'));
let heroNameInput = heroListComp.element(by.tagName('input'));
it('should exist', function() {
expect(heroListComp).toBeDefined(' must exist');
});
it('should display ' + initialHeroCount + ' heroes after init', function () {
expect(heroTags.count()).toBe(initialHeroCount);
});
it('should not add hero with empty name', function () {
expect(addButton).toBeDefined('"Add Hero" button must be defined');
addButton.click().then(function() {
expect(heroTags.count()).toBe(initialHeroCount, 'No new hero should be added');
it('should display different background when set type', () => {
const typeList = element(by.id('type-list')).all(by.tagName('jigsaw-button'));
browser.sleep(300);
expect(typeList.get(0).getCssValue('background-color')).toBe('rgba(255, 255, 255, 1)');
expect(typeList.get(1).getCssValue('background-color')).toBe('rgba(65, 173, 220, 1)');
expect(typeList.get(2).getCssValue('background-color')).toBe('rgba(231, 143, 78, 1)');
expect(typeList.get(3).getCssValue('background-color')).toBe('rgba(236, 109, 109, 1)');
})
})
getWalletsWidthMoney() {
return element.all(by.tagName('#wallet option'))
.filter((opt) => {
return opt.getText().then((v) => {
return this._getSkyFromOptionString(v) > 0;
});
});
}
static readonly FIELD = 'Mr.';
static readonly FIRST_NAME = 'Winstoon';
static readonly LAST_NAME = 'Rumfoord';
static readonly ADDRESS_LINE_1 = 'Chrono-Synclastic Infundibulum';
static readonly ADDRESS_LINE_2 = 'Betelgeuse';
static readonly CITY = 'Tralfamadore';
static readonly PROVINCE = 'Connecticut';
static readonly POSTAL_CODE = '06247';
static readonly PHONE_NUMBER = '555 555 555';
constructor(
private parentElement: ElementFinder = element(by.tagName('body'))
) {}
readonly form: ElementFinder = this.parentElement.element(
by.tagName('cx-address-form')
);
readonly countrySelect: ElementFinder = this.form.element(
by.css('[bindValue="isocode"].country-select')
);
readonly titleSelect: ElementFinder = this.form.element(
by.css('[bindValue="code"]')
);
readonly firstName: ElementFinder = this.form.element(
by.css('[formcontrolname="firstName"]')
);
readonly lastName: ElementFinder = this.form.element(
by.css('[formcontrolname="lastName"]')
);
readonly addressLine1: ElementFinder = this.form.element(
by.css('[formcontrolname="line1"]')
);
);
readonly ratingStar: ElementArrayFinder = this.rating.all(by.css('.star'));
readonly reviewSubmitBtn: ElementFinder = this.writeReviewForm.element(
by.css('.btn-primary')
);
readonly reviewInputField: ElementArrayFinder = this.writeReviewForm.all(
by.tagName('input')
);
readonly reviewTextareaField: ElementArrayFinder = this.writeReviewForm.all(
by.tagName('textarea')
);
readonly reviewCancelBtn: ElementFinder = this.writeReviewForm.element(
by.css('.btn-secondary')
);
readonly itemCounterUpButton: ElementFinder = this.itemCounterComponent
.all(by.tagName('button'))
.get(1);
async navigateTo(productId: string) {
await browser.get('/product/' + productId);
await this.waitForReady();
}
async navigateToByAlias(productId: string, name: string) {
await browser.get(`product/${name}/${productId}`);
await this.waitForReady();
}
async waitForReady() {
await E2EUtil.wait4VisibleElement(this.page);
}
function testFavoriteHero(heroName: string, expectedLabel: string) {
let movieListComp = element(by.tagName('app-movie-list'));
let heroInput = movieListComp.element(by.tagName('input'));
let favoriteHeroLabel = movieListComp.element(by.tagName('h3'));
let resultLabel = movieListComp.element(by.css('span > p'));
heroInput.clear().then(function () {
heroInput.sendKeys(heroName || '');
expect(resultLabel.getText()).toBe(expectedLabel);
if (heroName) {
expect(favoriteHeroLabel.isDisplayed()).toBe(true);
expect(favoriteHeroLabel.getText()).toContain(heroName);
} else {
expect(favoriteHeroLabel.isDisplayed()).toBe(false);
}
});
}
});
import { by, element, ElementArrayFinder, ElementFinder } from 'protractor';
import { BasePo } from '../../base/base.po';
export class DataEntityListPage extends BasePo {
public contentHeader: ElementFinder = element(by.className('content-header'));
public heading: ElementFinder = this.contentHeader.element(by.tagName('h1'));
public subHeading: ElementFinder = this.contentHeader.element(by.tagName('h4'));
public dataEntityRow: ElementArrayFinder = element.all(by.className('data-entity-row'));
public name: ElementFinder = this.dataEntityRow.get(0).element(by.tagName('h4'));
public namespaceContainer: ElementFinder = this.dataEntityRow.get(0).element(by.tagName('h6'));
public namespaceLabel: ElementFinder = this.namespaceContainer.all(by.tagName('span')).get(0);
public namespace: ElementFinder = this.namespaceContainer.all(by.tagName('span')).get(1);
public link: ElementFinder = this.dataEntityRow.get(0).element(by.tagName('a'));
public searchBox = element(by.tagName('input'));
}
getParagraphText(): promise.Promise {
const captionElement = element(by.tagName('caption'));
return captionElement.getText();
}