當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript protractor.promise類代碼示例

本文整理匯總了TypeScript中protractor.promise的典型用法代碼示例。如果您正苦於以下問題:TypeScript promise類的具體用法?TypeScript promise怎麽用?TypeScript promise使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了promise類的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;
      });
  }
開發者ID:marlonprudente,項目名稱:composer,代碼行數:26,代碼來源:test.ts

示例2: return

 return sortIcon.isPresent().then(present => {
     if (!present) {
         // Wrapping this in a promise for consistent return types.
         // necessary to avoid typescript warnings in the simplest possible way.
         return promise.fulfilled(SORT_TYPE.UNSORTED);
     }
     return sortIcon.getAttribute('class').then(className => {
         return (className.indexOf('ascending') > -1 ? SORT_TYPE.ASCENDING : SORT_TYPE.DESCENDING);
     });
 });
開發者ID:Droogans,項目名稱:encore-ui,代碼行數:10,代碼來源:rxSortableColumn.page.ts

示例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', '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');
  });
開發者ID:jhipster,項目名稱:jhipster-sample-app,代碼行數:11,代碼來源:label.spec.ts

示例4: 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);
    });
開發者ID:hmessafi,項目名稱:jhipster-sample-app,代碼行數:11,代碼來源:label.spec.ts

示例5:

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,
        };
    });
};
開發者ID:Droogans,項目名稱:encore-ui,代碼行數:13,代碼來源:rxMetadata.midway.ts

示例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');
        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);
    });
開發者ID:hmessafi,項目名稱:jhipster-sample-app,代碼行數:16,代碼來源:bank-account.spec.ts

示例7: 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');
  });
開發者ID:jhipster,項目名稱:jhipster-sample-app,代碼行數:16,代碼來源:bank-account.spec.ts

示例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');
        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);
    });
開發者ID:hmessafi,項目名稱:jhipster-sample-app,代碼行數:19,代碼來源:operation.spec.ts

示例9: 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');
  });
開發者ID:jhipster,項目名稱:jhipster-sample-app,代碼行數:19,代碼來源:operation.spec.ts

示例10: 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];
            });
        })
開發者ID:marlonprudente,項目名稱:composer,代碼行數:21,代碼來源:test.ts


注:本文中的protractor.promise類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。