Lines Matching refs:page

6 from telemetry.page import test_expectations
7 from telemetry.page.actions import action_runner as action_runner_module
27 """A class styled on unittest.TestCase for creating page-specific tests.
30 validation and page measurement as necessary.
33 def ValidateAndMeasurePage(self, page, tab, results):
37 page, 'body_children', 'count', body_child_count))
46 def ValidateAndMeasurePage(self, page, tab, results):
50 page, 'children', 'count', child_count))
53 action_name_to_run: This is the method name in telemetry.page.Page
55 discard_first_run: Discard the first run of this page. This is
60 max_failures: The number of page failures allowed before we stop
63 action_name_to_run is not empty but the page doesn't have that
64 action. The page will run (without any action) if
65 is_action_name_to_run_optional is True, otherwise the page
150 """Maximum number of failures allowed for the page set."""
163 """ Should the browser be restarted for the page?
166 browser for each page. It may be called before the browser is started.
170 def StopBrowserAfterPage(self, browser, page): # pylint: disable=W0613
171 """Should the browser be stopped after the page is run?
173 This is called after a page is run to decide whether the browser needs to
175 restarted to run the next page.
177 A test that overrides this can look at both the page and the browser to
185 def CustomizeBrowserOptionsForSinglePage(self, page, options):
186 """Set options specific to the test and the given page.
188 This will be called with the current page when the browser is (re)started.
190 restarted for each page. Note that if page has a startup_url, the browser
193 if page.startup_url:
194 options.browser_options.startup_url = page.startup_url
202 def CanRunForPage(self, page): # pylint: disable=W0613
203 """Override to customize if the test can be ran for the given page."""
205 return hasattr(page, self._action_name_to_run)
209 """Override to do operations before the page set(s) are navigated."""
213 """Override to do operations after all page set(s) are completed.
219 def WillNavigateToPage(self, page, tab):
220 """Override to do operations before the page is navigated, notably Telemetry
226 def DidNavigateToPage(self, page, tab):
227 """Override to do operations right after the page is navigated and after
230 def WillRunActions(self, page, tab):
231 """Override to do operations before running the actions on the page."""
233 def DidRunActions(self, page, tab):
234 """Override to do operations after running the actions on the page."""
236 def CleanUpAfterPage(self, page, tab):
241 any that may have been defined in the page set."""
244 def TabForPage(self, page, browser): # pylint: disable=W0613
245 """Override to select a different tab for the page. For instance, to
246 create a new tab for every page, return browser.tabs.New()."""
250 """Override to examine the page set before the test run. Useful for
253 def ValidateAndMeasurePage(self, page, tab, results):
265 def ValidateAndMeasurePage(self, page, tab, results):
270 page, 'two_plus_two', 'count', res))
273 page: A telemetry.page.Page instance.
279 self.ValidatePage(page, tab, results)
281 def ValidatePage(self, page, tab, results):
283 self.MeasurePage(page, tab, results)
285 def MeasurePage(self, page, tab, results):
288 def RunPage(self, page, tab, results):
292 tab, skip_waits=page.skip_waits)
293 self.WillRunActions(page, tab)
297 self._RunMethod(page, self._action_name_to_run, action_runner)
298 self.DidRunActions(page, tab)
300 self.ValidateAndMeasurePage(page, tab, results)
302 def _RunMethod(self, page, method_name, action_runner):
303 if hasattr(page, method_name):
304 run_method = getattr(page, method_name)
307 def RunNavigateSteps(self, page, tab):
308 """Navigates the tab to the page URL attribute.
310 Runs the 'navigate_steps' page attribute as a compound action.
313 tab, skip_waits=page.skip_waits)
314 page.RunNavigateSteps(action_runner)