当前位置: 首页>>代码示例>>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;未经允许,请勿转载。