puppeteer/third_party/phantomjs/test/module/webpage/loading.js
Andrey Lushnikov 4372674c99 Improve Phantom_Shim to handle more scenarios. (#49)
This patch improves phantom_shim:
- introduce WebPage.loading/WebPage.loadingProgress
- improve compatibility of WebPage.onInitialized. This allows to
  pass phantomjs tests, even though the implementation is hacky.
- teach PhantomResponse about "stage" state which could be either
  "start" or "end"
- unskip a bunch of phantom webpage tests:
  - webpage/change-request-encoded-url
  - webpage/loading.js
  - webpage/long-running-javascript.js
  - webpage/modify-header.js
  - webpage/on-initialized.js
  - webpage/remove-header.js
2017-07-05 10:07:36 +03:00

22 lines
669 B
JavaScript

async_test(function () {
var webpage = require('webpage');
var page = webpage.create();
assert_type_of(page, 'object');
assert_type_of(page.loading, 'boolean');
assert_type_of(page.loadingProgress, 'number');
assert_is_false(page.loading);
assert_equals(page.loadingProgress, 0);
page.open(TEST_HTTP_BASE + 'hello.html',
this.step_func_done(function (status) {
assert_equals(status, 'success');
assert_equals(page.loading, false);
assert_equals(page.loadingProgress, 100);
}));
assert_is_true(page.loading);
assert_greater_than(page.loadingProgress, 0);
}, "page loading progress");