本文整理汇总了TypeScript中protractor.promise.all方法的典型用法代码示例。如果您正苦于以下问题:TypeScript promise.all方法的具体用法?TypeScript promise.all怎么用?TypeScript promise.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.promise
的用法示例。
在下文中一共展示了promise.all方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: retrieveRegistryItem
// Get the current list of ids and data from opened registry section
static retrieveRegistryItem() {
let idsPromise = OperationsHelper.retrieveMatchingElementsByCSS('.resource-list', '.resource-container .id', 0)
.map((elm) => {
browser.executeScript(scrollMe, elm);
return OperationsHelper.retrieveTextFromElement(elm);
});
let dataPromise = OperationsHelper.retrieveMatchingElementsByCSS('.resource-list', '.resource-container .data', 0)
.map((elm) => {
browser.executeScript(scrollMe, elm);
return OperationsHelper.retrieveTextFromElement(elm);
});
let promises = [idsPromise, dataPromise];
return promise.all(promises)
.then((values) => {
let ids = values[0];
let data = values[1];
let result = ids.map((val, index) => {
return { id: val, data: data[index] };
});
return result;
});
}
示例2: it
it('should create and save Labels', async () => {
const nbButtonsBeforeCreate = await labelComponentsPage.countDeleteButtons();
await labelComponentsPage.clickOnCreateButton();
await promise.all([labelUpdatePage.setLabelInput('label')]);
expect(await labelUpdatePage.getLabelInput()).to.eq('label', 'Expected Label value to be equals to label');
await labelUpdatePage.save();
expect(await labelUpdatePage.getSaveButton().isPresent(), 'Expected save button disappear').to.be.false;
expect(await labelComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1, 'Expected one more entry in the table');
});
示例3: it
it('should create and save Labels', async () => {
const nbButtonsBeforeCreate = await labelComponentsPage.countDeleteButtons();
await labelComponentsPage.clickOnCreateButton();
await promise.all([labelUpdatePage.setLabelInput('label')]);
expect(await labelUpdatePage.getLabelInput()).to.eq('label');
await labelUpdatePage.save();
expect(await labelUpdatePage.getSaveButton().isPresent()).to.be.false;
expect(await labelComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1);
});
示例4:
let transformDataAndLink = (definition: ElementFinder) => {
let promises = [definition.getText(), definition.$('a').getAttribute('href')];
return promise.all(promises).then(results => {
// 'Some data (Link)' -> ['Some data', 'link']
let text = results[0].split('(')[0].trim();
let linkText = results[0].split('(')[1].replace(')', '');
return {
text,
href: results[1],
linkText,
};
});
};
示例5: it
it('should create and save BankAccounts', async () => {
const nbButtonsBeforeCreate = await bankAccountComponentsPage.countDeleteButtons();
await bankAccountComponentsPage.clickOnCreateButton();
await promise.all([
bankAccountUpdatePage.setNameInput('name'),
bankAccountUpdatePage.setBalanceInput('5'),
bankAccountUpdatePage.userSelectLastOption()
]);
expect(await bankAccountUpdatePage.getNameInput()).to.eq('name');
expect(await bankAccountUpdatePage.getBalanceInput()).to.eq('5');
await bankAccountUpdatePage.save();
expect(await bankAccountUpdatePage.getSaveButton().isPresent()).to.be.false;
expect(await bankAccountComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1);
});
示例6: it
it('should create and save BankAccounts', async () => {
const nbButtonsBeforeCreate = await bankAccountComponentsPage.countDeleteButtons();
await bankAccountComponentsPage.clickOnCreateButton();
await promise.all([
bankAccountUpdatePage.setNameInput('name'),
bankAccountUpdatePage.setBalanceInput('5'),
bankAccountUpdatePage.userSelectLastOption()
]);
expect(await bankAccountUpdatePage.getNameInput()).to.eq('name', 'Expected Name value to be equals to name');
expect(await bankAccountUpdatePage.getBalanceInput()).to.eq('5', 'Expected balance value to be equals to 5');
await bankAccountUpdatePage.save();
expect(await bankAccountUpdatePage.getSaveButton().isPresent(), 'Expected save button disappear').to.be.false;
expect(await bankAccountComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1, 'Expected one more entry in the table');
});
示例7: it
it('should create and save Operations', async () => {
const nbButtonsBeforeCreate = await operationComponentsPage.countDeleteButtons();
await operationComponentsPage.clickOnCreateButton();
await promise.all([
operationUpdatePage.setDateInput('01/01/2001' + protractor.Key.TAB + '02:30AM'),
operationUpdatePage.setDescriptionInput('description'),
operationUpdatePage.setAmountInput('5'),
operationUpdatePage.bankAccountSelectLastOption()
// operationUpdatePage.labelSelectLastOption(),
]);
expect(await operationUpdatePage.getDateInput()).to.contain('2001-01-01T02:30');
expect(await operationUpdatePage.getDescriptionInput()).to.eq('description');
expect(await operationUpdatePage.getAmountInput()).to.eq('5');
await operationUpdatePage.save();
expect(await operationUpdatePage.getSaveButton().isPresent()).to.be.false;
expect(await operationComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1);
});
示例8: it
it('should create and save Operations', async () => {
const nbButtonsBeforeCreate = await operationComponentsPage.countDeleteButtons();
await operationComponentsPage.clickOnCreateButton();
await promise.all([
operationUpdatePage.setDateInput('01/01/2001' + protractor.Key.TAB + '02:30AM'),
operationUpdatePage.setDescriptionInput('description'),
operationUpdatePage.setAmountInput('5'),
operationUpdatePage.bankAccountSelectLastOption()
// operationUpdatePage.labelSelectLastOption(),
]);
expect(await operationUpdatePage.getDateInput()).to.contain('2001-01-01T02:30', 'Expected date value to be equals to 2000-12-31');
expect(await operationUpdatePage.getDescriptionInput()).to.eq('description', 'Expected Description value to be equals to description');
expect(await operationUpdatePage.getAmountInput()).to.eq('5', 'Expected amount value to be equals to 5');
await operationUpdatePage.save();
expect(await operationUpdatePage.getSaveButton().isPresent(), 'Expected save button disappear').to.be.false;
expect(await operationComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1, 'Expected one more entry in the table');
});
示例9: Error
.then((items) => {
let promises = [];
for (let i = 0; i < items.length; i++) {
let id = items[0].element(by.css('.id'));
promises.push(OperationsHelper.retrieveTextFromElement(id));
}
return promise.all(promises).then((texts) => {
let id = -1;
texts.forEach((text, index) => {
if (text === identifier) {
id = index;
}
});
if (id === -1) {
throw new Error('Particpant not found: ' + identifier);
}
return items[id];
});
})
示例10: isFocused
/**
* Whether or not the tag is currently focused.
*
* @example
*
* it('should focus on the last tag when clicking it', function () {
* new rxTags($('rx-tags')).addTag('Banana').then(function (tag) {
* expect(tag.isFocused()).to.eventually.be.false;
* tag.click();
* expect(tag.isFocused()).to.eventually.be.true;
* });
* });
*/
isFocused(): Promise<boolean> {
let active = browser.switchTo().activeElement().getId();
return promise.all([active, this.getId()]).then(ids => ids[0] === ids[1]);
}