* Wait for all AMP loader indicators to disappear. * * @param {!puppeteer.Page} page page to wait on. * @param {string} testName the full name of the test. * @param {number} timeoutMillis how long to retry. * @return {Promise } * @throws {Error} an encountered error.
( page, testName, timeoutMillis = CSS_SELECTOR_TIMEOUT_MS )
| 105 | * @throws {Error} an encountered error. |
| 106 | */ |
| 107 | async function waitForPageLoad( |
| 108 | page, |
| 109 | testName, |
| 110 | timeoutMillis = CSS_SELECTOR_TIMEOUT_MS |
| 111 | ) { |
| 112 | const allLoadersGone = await waitForElementVisibility( |
| 113 | page, |
| 114 | '[class~="i-amphtml-loader"], [class~="i-amphtml-loading"]', |
| 115 | {hidden: true}, |
| 116 | timeoutMillis |
| 117 | ); |
| 118 | if (!allLoadersGone) { |
| 119 | throw new Error( |
| 120 | `${cyan(testName)} still has the AMP loader dot ` + |
| 121 | `after ${CSS_SELECTOR_TIMEOUT_MS} ms` |
| 122 | ); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Wait until the element is either hidden or visible or until timed out. |
no test coverage detected