本文整理汇总了TypeScript中protractor.ExpectedConditions.textToBePresentInElement方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ExpectedConditions.textToBePresentInElement方法的具体用法?TypeScript ExpectedConditions.textToBePresentInElement怎么用?TypeScript ExpectedConditions.textToBePresentInElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.ExpectedConditions
的用法示例。
在下文中一共展示了ExpectedConditions.textToBePresentInElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should display "Hello Foo!" via name attribute', function () {
const input = element(by.css('input[type=text]'));
input.sendKeys('Foo');
// Make tests less flaky on CI by waiting up to 5s for the element text to be updated.
browser.wait(EC.textToBePresentInElement(helloWorldEl, 'Hello Foo!'), 5000);
});
示例2: it
it('should greet', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
const elem = element(by.css(selector));
browser.wait(ExpectedConditions.textToBePresentInElement(elem, 'hello world!'), 5000);
expect(elem.getText()).toEqual('hello world!');
});
示例3: it
it('should run a 9-player individual', () => {
// expect to be logged-in from previous test -> to improve
browser.get('/');
element(by.css('button')).click();
element(by.css('input[name="name"]')).sendKeys('Test Individual');
element(by.cssContainingText('select[name="movement"]>option', 'Individual for 9 players')).click();
element(by.cssContainingText('select[name="scoring"]>option', 'IMP')).click();
element(by.css('input[name="dealsPerRound"]')).clear();
element(by.css('input[name="dealsPerRound"]')).sendKeys('1');
// fill in players
element(by.linkText('Players')).click();
for (let i = 1; i <= 9; i++)
element(by.css(`form div:nth-of-type(${i}) input`)).sendKeys(`Player ${i}`);
element(by.linkText('Infos')).click();
element(by.buttonText('Create')).click();
// apparently the new angular 2 HttpModule's Observable aren't waited by protractor, so :
browser.wait(ExpectedConditions.elementToBeClickable(element(by.buttonText('Start'))), 12000);
element(by.buttonText('Start')).click();
// polling for scores is done outside angular, so we can keep synchronization
// but after that, without synchronization, we should wait for the buttons...
element(by.linkText('Play')).click();
for (let round = 0; round < 27; round++) {
const north1 = Math.floor(round / 9) * 3 + (Math.floor(round / 3) + 1) % 3 + 1;
element(by.css(`select[name="currentPlayer"]>option:nth-of-type(${north1})`)).click();
randomScore();
const north2 = (north1 + 2) % 9 + 1;
element(by.css(`select[name="currentPlayer"]>option:nth-of-type(${north2})`)).click();
randomScore();
if (round < 26) {
// wait for Next Round button
browser.wait(ExpectedConditions.elementToBeClickable(element(by.buttonText('Next Round'))), 12000);
element(by.buttonText('Next Round')).click();
// then wait for next round to actually begin
const roundSummary = element(by.cssContainingText('h4', 'Round'));
browser.wait(ExpectedConditions.textToBePresentInElement(roundSummary, 'Round ' + (round + 2)), 12000);
}
}
browser.wait(ExpectedConditions.presenceOf(element(by.buttonText('Close'))), 12000);
element(by.buttonText('Close')).click();
expect(element(by.linkText('Play'))).toBeTruthy();
expect(element(by.linkText('Players'))).toBeTruthy();
element(by.linkText('Players')).click();
element(by.linkText('Player 1')).click();
element(by.linkText('4')).click(); // Player 1 skips deals 1-3
element(by.linkText('Previous')).click();
});
示例4: it
it('should bind to textarea value', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
waitForBootstrap();
const input = element(by.css(selector + ' textarea'));
input.sendKeys(VALUE);
const displayElem = element(by.css(selector + ' .textarea-val'));
const expectedVal = `Textarea val is ${VALUE}.`;
browser.wait(ExpectedConditions.textToBePresentInElement(displayElem, expectedVal), 5000);
expect(displayElem.getText()).toEqual(expectedVal);
});
示例5: it
it('should echo messages', () => {
const VALUE = 'Hi There';
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
waitForBootstrap();
const input = element.all(by.css('#echo_input')).first();
input.sendKeys(VALUE);
element(by.css('#send_echo')).click();
const area = element(by.css('#echo_result'));
browser.wait(ExpectedConditions.textToBePresentInElement(area, VALUE), 5000);
expect(area.getText()).toEqual(VALUE);
});
示例6: waitUntilTextVisible
waitUntilTextVisible(id: string, text: string) {
const el = element(by.id(id));
browser.wait(ExpectedConditions.textToBePresentInElement(el, text), 5000);
}
示例7:
By.partialButtonText('searchText');
By.repeater('repeatDescriptor');
By.exactRepeater('repeatDescriptor');
By.cssContainingText('cssSelector', 'searchText');
By.options('optionsDescriptor');
By.deepCss('selector');
By.className('className');
By.css('css');
By.id('id');
By.linkText('linkText');
By.js('js');
By.name('name');
By.partialLinkText('partialText');
By.tagName('tagName');
By.xpath('xpath');
ExpectedConditions.not(() => {});
ExpectedConditions.and(() => {});
ExpectedConditions.and(() => {},() => {});
ExpectedConditions.or(() => {});
ExpectedConditions.or(() => {},() => {});
ExpectedConditions.alertIsPresent();
ExpectedConditions.elementToBeClickable(element(by.css('')));
ExpectedConditions.textToBePresentInElement(element(by.css('')), 'text');
ExpectedConditions.textToBePresentInElementValue(element(by.css('')), 'text');
ExpectedConditions.titleContains('title');
ExpectedConditions.presenceOf(element(by.css('')));
ExpectedConditions.stalenessOf(element(by.css('')));
ExpectedConditions.visibilityOf(element(by.css('')));
ExpectedConditions.invisibilityOf(element(by.css('')));
ExpectedConditions.elementToBeSelected(element(by.css('')));