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


TypeScript browser.switchTo方法代碼示例

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


在下文中一共展示了browser.switchTo方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should show 2 alerts from Save w/prop button', async () => {
   await saveProp.click();
   expect(browser.switchTo().alert().getText()).toEqual('Saved.');
   browser.switchTo().alert().accept();
   expect(browser.switchTo().alert().getText()).toEqual('Saved.');
   browser.switchTo().alert().accept();
 });
開發者ID:BobChao87,項目名稱:angular,代碼行數:7,代碼來源:app.e2e-spec.ts

示例2: it

    it('shows', async () => {
        await builder.goForce();
        await force.clickStartButton();
        await builder.goForce();
        await force.clickStartButton();

        // hopefully we'll see at least one buildrequest by the time we get to
        // the pending build requests page
        await pendingBuildrequests.go();

        const isBulidrequestsVisible = async () => {
            let count = await pendingBuildrequests.getAllBuildrequestRows().count();
            return count > 0;
        };
        await browser.wait(isBulidrequestsVisible,
                           5000,
                           "did not find buildrequests");

        const br = pendingBuildrequests.getAllBuildrequestRows().first();
        expect(await br.element(By.css('td:nth-child(2) a')).getText()).toMatch('slowruntests');

        // kill remaining builds
        await builder.go();
        await force.clickCancelWholeQueue();

        await browser.wait(EC.alertIsPresent(),
                           5000,
                           "did not find confirmation alert");
        await browser.switchTo().alert().accept();
    });
開發者ID:ewongbb,項目名稱:buildbot,代碼行數:30,代碼來源:pendingbuildrequests.scenarios.ts

示例3:

 return browser.switchTo().frame(iframe).then( () => {
   let el = browser.driver.findElement(by.id('tinymce'));
   let text = el.getText();
   return browser.switchTo().defaultContent().then(()=>{
     return browser.waitForAngular().then(()=>{return text});
   });
 });              
開發者ID:dmacfarlane,項目名稱:ng2-mentions,代碼行數:7,代碼來源:app.po.ts

示例4: it

    it('should go through the checkout process', async() => {
      await pageElements.productListLinks.get(0).click();

      const checkoutLink = pageElements.topBarCheckoutLink;
      const productDetailsPage = pageElements.productDetailsPage;
      const buyButton = await productDetailsPage.element(by.css('button'));

      const cartPage = pageElements.cartPage;
      const inputFields = cartPage.all(by.css('form input'));

      const purchaseButton = await cartPage.element(by.css('button'));
      const nameField = inputFields.get(0);
      const addressField = inputFields.get(1);

      await buyButton.click();
      await browser.wait(EC.alertIsPresent(), 1000);
      await browser.switchTo().alert().accept();
      await checkoutLink.click();

      await nameField.sendKeys('Customer');
      await addressField.sendKeys('Address');
      await purchaseButton.click();

      const logs = await browser.manage().logs().get(logging.Type.BROWSER);
      const cartMessages = logs.filter(({ message }) => message.includes('Your order has been submitted'));

      expect(cartMessages.length).toBe(1);
    });
開發者ID:Cammisuli,項目名稱:angular,代碼行數:28,代碼來源:app.e2e-spec.ts

示例5: crisisCenterEdit

  async function crisisCenterEdit(index: number, save: boolean) {
    const page = getPageStruct();
    await page.crisisHref.click();
    let crisisEle = page.crisisList.get(index);
    let text = await crisisEle.getText();
    expect(text.length).toBeGreaterThan(0, 'crisis item text length');
    // remove leading id from text
    const crisisText = text.substr(text.indexOf(' ')).trim();

    await crisisEle.click();
    expect(page.crisisDetail.isPresent()).toBe(true, 'crisis detail present');
    expect(page.crisisDetailTitle.getText()).toContain(crisisText);
    let inputEle = page.crisisDetail.element(by.css('input'));
    await inputEle.sendKeys('-foo');

    let buttonEle = page.crisisDetail.element(by.buttonText(save ? 'Save' : 'Cancel'));
    await buttonEle.click();
    crisisEle = page.crisisList.get(index);
    if (save) {
      expect(crisisEle.getText()).toEqual(crisisText + '-foo');
    } else {
      await browser.wait(EC.alertIsPresent(), 4000);
      await browser.switchTo().alert().accept();
      expect(crisisEle.getText()).toEqual(crisisText);
    }
  }
開發者ID:SangKa,項目名稱:angular-cn,代碼行數:26,代碼來源:e2e-spec.ts

示例6:

        browser.getAllWindowHandles().then((handles) => {

            browser.switchTo().window(handles[1]).then(() => {
                browser.get(TestConfig.adf.url + '/activiti');
                processServicesPage.checkApsContainer();
                browser.get(TestConfig.adf.url + '/files');
                contentServicesPage.checkAcsContainer();
            });
        });
開發者ID:Alfresco,項目名稱:alfresco-ng2-components,代碼行數:9,代碼來源:login-component.e2e.ts

示例7: it

    it('should get error on leaving when name is changed.', async function () {
        await browser.setLocation(`/${tribe.id}/player/${player1._id}`);
        expect(browser.getCurrentUrl()).toBe(`${hostName}/${tribe.id}/player/${player1._id}/`);
        element(By.id('player-name')).clear();
        element(By.id('player-name')).sendKeys('completely different name');
        element(By.css(`.tribe-card img`)).click();
        await browser.wait(() => browser.switchTo().alert().then(() => true, () => false), 5000);

        const alertDialog = await browser.switchTo().alert();
        expect(alertDialog.getText())
            .toEqual('You have unsaved data. Would you like to save before you leave?');
        alertDialog.dismiss();
    });
開發者ID:robertfmurdock,項目名稱:Coupling,代碼行數:13,代碼來源:edit-player.e2e.ts

示例8: it

        it('can be deleted', async function () {
            const pairAssignmentSetElements = element.all(by.className('pair-assignments'));
            const deleteButton = pairAssignmentSetElements.get(0).element(By.css('.delete-button'));

            deleteButton.click();
            const alert = await browser.switchTo().alert();

            alert.accept();

            await browser.wait(async () => await pairAssignmentSetElements.count() === 1, 2000);

            expect(pairAssignmentSetElements.count()).toBe(1);
        });
開發者ID:robertfmurdock,項目名稱:Coupling,代碼行數:13,代碼來源:history.e2e.ts

示例9: it

            it('should have an alert when the message is dismissed', () => {
                // https://git.io/vKHN1
                if (browserName !== 'chrome') {
                    rxNotify.byStack('custom').byText(msgText).dismiss();

                    let EC = ExpectedConditions;
                    browser.wait(EC.alertIsPresent());
                    browser.switchTo().alert().then(alertBox => {
                        let msg = 'We are dismissing the message: Testing On Dismiss Method';
                        expect(alertBox.getText()).to.eventually.equal(msg);
                        alertBox.accept();
                    });
                }
            });
開發者ID:Droogans,項目名稱:encore-ui,代碼行數:14,代碼來源:rxNotify.midway.ts


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