How to use the protractor.browser.wait function in protractor

To help you get started, we’ve selected a few protractor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hetznercloud / protractor-test-helper / lib / waits.ts View on Github external
export function waitForTextToBe(
    target: ElementFinder | Locator | string,
    value: string,
    timeout: number = DEFAULT_TIMEOUT
): webdriver.promise.Promise {
    const e: ElementFinder = getElementFinder(target);

    // Don't use EC.textToBePresentInElement because it doesn't return a promise which we can catch
    return browser.wait(
        () => {
            return waitToBeDisplayed(e, timeout)
                .then(() => {
                    return getElementFinder(target).getText();
                })
                .then((text: string) => text === value, () => false);
        },
        timeout,
        `Error waiting for text in ${e.locator()} to be ${value}`
    );
}
github sillsdev / web-languageforge / test / app / scriptureforge / sfchecks / sf-checks-project-settings.e2e-spec.ts View on Github external
it('can add a new user as a member', () => {
      expect(projectSettingsPage.membersTab.list.count()).toBe(memberCount);
      projectSettingsPage.membersTab.addButton.click();
      browser.wait(ExpectedConditions.visibilityOf(projectSettingsPage.membersTab.newMember.input),
        Utils.conditionTimeout);
      projectSettingsPage.membersTab.newMember.input.sendKeys('du');

      // sendKeys is split to force correct button behaviour. IJH 2015-10
      projectSettingsPage.membersTab.newMember.input.sendKeys('de');
      projectSettingsPage.membersTab.newMember.button.click();
      projectSettingsPage.membersTab.waitForNewUserToLoad(memberCount);
      expect(projectSettingsPage.membersTab.list.count()).toBe(memberCount + 1);
    });
github SAP / cloud-commerce-spartacus-storefront / projects / storefrontapp-e2e / src / regression / register.e2e-spec.ts View on Github external
await LoginHelper.navigateToRegisterViaHeader();
    await registerPage.waitForReady();

    const testUserId = Date.now() - 1535535333333;
    const userEmail = `user${testUserId}@${LoginHelper.DEFAULT_USER_DOMAIN}`;
    const userPassword = LoginHelper.DEFAULT_PASSWORD;

    await registerPage.registerForm.fillInForm(
      LoginHelper.DEFAULT_TITLE,
      LoginHelper.DEFAULT_FIRST_NAME,
      LoginHelper.DEFAULT_LAST_NAME,
      userEmail,
      userPassword
    );
    await registerPage.registerForm.submit();
    await browser.wait(
      ExpectedConditions.urlIs('http://localhost:4200/'),
      5000
    );
    await LoginHelper.logOutViaHeader();

    // Let's fill the same
    await LoginHelper.navigateToRegisterViaHeader();
    await registerPage.waitForReady();
    await registerPage.registerForm.fillInForm(
      LoginHelper.DEFAULT_TITLE,
      LoginHelper.DEFAULT_FIRST_NAME,
      LoginHelper.DEFAULT_LAST_NAME,
      userEmail,
      userPassword
    );
    await registerPage.registerForm.submit();
github openshift / console / frontend / integration-tests / views / yaml.view.ts View on Github external
export const isLoaded = () =>
  browser
    .wait(until.and(waitForNone($$('.co-m-loader')), until.visibilityOf(saveButton)))
    .then(() => browser.sleep(1000));
github openshift / console / frontend / packages / operator-lifecycle-manager / integration-tests / scenarios / global-installmode.scenario.ts View on Github external
it('uninstalls Operator from the cluster', async () => {
    await operatorHubView.operatorModalUninstallBtn.click();
    await browser.wait(until.visibilityOf($('.co-catalog-install-modal')));
    await element(by.cssContainingText('#confirm-action', 'Remove')).click();
    await crudView.isLoaded();
    await browser.wait(until.invisibilityOf(crudView.rowForOperator('Jaeger Tracing')), 5000);

    expect(crudView.rowForOperator('Jaeger Tracing').isPresent()).toBe(false);
  });
});
github openshift / console / frontend / integration-tests / views / catalog.view.ts View on Github external
export const catalogDetailsLoaded = () =>
  browser.wait(until.presenceOf($('.modal-content')), 10000).then(() => browser.sleep(1000));
export const createServiceInstanceButton = $('.co-catalog-page__overlay-create');
github Alfresco / alfresco-content-app / e2e / components / info-drawer / info-drawer-comments-tab.ts View on Github external
async getCommentById(commentId?: string) {
    if (commentId) {
      return browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
    }
    return this.getCommentListItem();
  }
github ceph / ceph / src / pybind / mgr / dashboard / frontend / e2e / page-helper.po.ts View on Github external
getTitleText() {
    let title;
    return browser
      .wait(() => {
        title = $('.panel-title');
        return title.isPresent();
      })
      .then(() => title.getText());
  }
github bulktrade / SMSC / modules / admin / src / app / breadcrumb / breadcrumb.page.ts View on Github external
isPresentBreadcrumb() {
        browser.wait(EC.presenceOf(this.breadcrumbTag), 5000);
        return this.breadcrumbTag.isPresent();
    }
github Gapminder / gapminder-offline / e2e / pageObjects / components / header.e2e-component.ts View on Github external
} else {
      await _$$(`option[value*="year"]`).first().click();
      await _$$(`option[value*="year"]`).first().click();
    }

    const parsedPath = path.parse(absolutePath);
    const fileValue = await this.upload.getAttribute('value');

    if (fileValue) {
      await this.upload.safeClear();
      await this.upload.safeClear();
      await browser.wait(EC.textToBePresentInElementValue(this.upload, ''), 15000);
    }

    await this.upload.safeSendKeys(absolutePath);
    await browser.wait(EC.textToBePresentInElementValue(this.upload, parsedPath.base), 15000);
    await _$$('.ok-btn').first().safeClick();
    await waitForErrorMessage();
  }
}