当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser.executeAsyncScript方法代码示例

本文整理汇总了TypeScript中protractor.browser.executeAsyncScript方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.executeAsyncScript方法的具体用法?TypeScript browser.executeAsyncScript怎么用?TypeScript browser.executeAsyncScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在protractor.browser的用法示例。


在下文中一共展示了browser.executeAsyncScript方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('should jump scroll position down and slowly scroll back up', async () => {
      // The estimate of the total content size is exactly correct, so we wind up scrolled to the
      // same place as if we slowly scrolled down.
      await browser.executeAsyncScript(scrollViewportTo, viewport, 2000);
      const offScreen = element(by.css('.demo-virtual-scroll-uniform-size [data-index="39"]'));
      const onScreen = element(by.css('.demo-virtual-scroll-uniform-size [data-index="40"]'));
      expect(await isVisibleInViewport(offScreen, viewport)).toBe(false);
      expect(await isVisibleInViewport(onScreen, viewport)).toBe(true);

      // As we slowly scroll back up we should wind up back at the start of the content.
      await browser.executeAsyncScript(smoothScrollViewportTo, viewport, 0);
      const first = element(by.css('.demo-virtual-scroll-uniform-size [data-index="0"]'));
      expect(await isVisibleInViewport(first, viewport)).toBe(true);
    });
开发者ID:Nodarii,项目名称:material2,代码行数:14,代码来源:virtual-scroll.e2e.spec.ts

示例2: it

  it('should measure performance', function() {
    browser.sleep(3000);  // wait for extension to load

    browser.driver.get(TEST_URL);

    browser.executeScript('window.startProfiler()').then(function() {
      console.log('started measuring perf');
    });

    browser.executeAsyncScript('setTimeout(arguments[0], 1000);');
    browser.executeScript('window.forceGC()');

    browser.executeAsyncScript('var cb = arguments[0]; window.getProfile(cb);')
        .then(function(profile: any) {
          assertEventsContainsName(profile, 'gc');
          assertEventsContainsName(profile, 'script');
        });
  });
开发者ID:AlmogShaul,项目名称:angular,代码行数:18,代码来源:spec.ts

示例3:

 const goTo = async url => {
   // Go to the specified URL and then unregister the ServiceWorker
   // to ensure subsequent requests are passed through to the server.
   await browser.get(url);
   await browser.executeAsyncScript(cb => navigator.serviceWorker
       .getRegistrations()
       .then(regs => Promise.all(regs.map(reg => reg.unregister())))
       .then(cb));
 };
开发者ID:DallanQ,项目名称:rxjs,代码行数:9,代码来源:testDeployedRedirection.e2e-spec.ts

示例4:

 const whenAllStable = (): promise.Promise<any> => {
   return browser.executeAsyncScript('window.frameworkStabilizers[0](arguments[0]);');
 };
开发者ID:AlmogShaul,项目名称:angular,代码行数:3,代码来源:async_spec.ts


注:本文中的protractor.browser.executeAsyncScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。