當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。