protractor#ElementArrayFinder TypeScript Examples

The following examples show how to use protractor#ElementArrayFinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: chat-flow.e2e.ts    From avid-covider with MIT License 6 votes vote down vote up
async function selectRandomOptionMulti(
  options: ElementArrayFinder,
  confirmElement: ElementFinder,
  nextAnswer: AnswerTestDataType
) {
  const lastOptionIndex = (await options.count()) - 1;
  let optionIndex;

  // multi-select option
  const howManyOptionsToClick = 1; // change to test multiple clicking - may require changes in answers array
  for (let i = 0; i < howManyOptionsToClick; i++) {
    // click randomally (same option may be clicked multiple times)
    optionIndex = getValidOptionIndex(lastOptionIndex, nextAnswer);
    const optionElement = options.get(optionIndex);

    const optionText = await reverseStr(optionElement.getText());
    log(`Answer using multi-select option - click button index: ${optionIndex} of ${lastOptionIndex} (${optionText})`);
    await safeClick(optionElement);
    await safeClick(confirmElement);
  }
}
Example #2
Source File: list-item.po.ts    From scion-microfrontend-platform with Eclipse Public License 2.0 5 votes vote down vote up
public readonly actionsFinder: ElementArrayFinder;
Example #3
Source File: app.po.ts    From avid-covider with MIT License 5 votes vote down vote up
// == options ==
  private getActiveHtlSingleOptions(useIndex?: number): ElementArrayFinder {
    const index = this.answersCounter.optionsSingle;
    return element.all(by.css('htl-messages htl-message-options'))
      .get(index)
      .all(by.css('.options button'));
  }
Example #4
Source File: app.po.ts    From avid-covider with MIT License 5 votes vote down vote up
private getActiveHtlMultiOptions(useIndex?: number): ElementArrayFinder {
    // get all options without 'other' class ('other' is confirm button)
    const index = this.answersCounter.optionsMulti;
    return element.all(by.css('htl-messages htl-message-multi-options'))
      .get(index)
      .all(by.css('button:not(.other)'));
  }
Example #5
Source File: chat-flow.e2e.ts    From avid-covider with MIT License 5 votes vote down vote up
async function selectRandomOptionSingle(options: ElementArrayFinder, nextAnswer: AnswerTestDataType) {
  const lastOptionIndex = (await options.count()) - 1;
  const optionIndex = getValidOptionIndex(lastOptionIndex, nextAnswer);
  const optionElement = options.get(optionIndex);
  const optionText = await reverseStr(optionElement.getText());
  log(`Answer using single-select option - click button index: ${optionIndex} of ${lastOptionIndex} (${optionText})`);
  await safeClick(optionElement);
}