Class AbstractTestCriticalResources
java.lang.Object
com.atlassian.jira.pageobjects.JiraWebDriverTest
com.atlassian.jira.pageobjects.BaseJiraWebTest
com.atlassian.jira.webtest.webdriver.tests.frontend.resources.AbstractTestCriticalResources
- Direct Known Subclasses:
TestCriticalCSS
,TestCriticalJS
Abstract test class for detecting whether resources loaded during page load are in fact used. This class helps to
prevent adding unnecessary stylesheets and javascript files to HEAD section of document.
On test failure, a developer can either fix it by deferring resource loading or adding an entry to the appropriate exempt resource list file. Instructions for either option are listed in the test failure message.
- Since:
- 7.0, 8.0 keeping common resources separately, following DRY when it comes to updating AUI, for example
-
Field Summary
FieldsFields inherited from class com.atlassian.jira.pageobjects.BaseJiraWebTest
jiraWebTestClassRules, webTestRule
Fields inherited from class com.atlassian.jira.pageobjects.JiraWebDriverTest
backdoor, jira, logger, mailHelper, pageBinder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertCriticalNetworkRequests
(CriticalResources.ResourceType resourceType, List<String> expected) Verifies that scripts or stylesheets that were drained on the page load match the given list (such resources block further processing and take part in the critical path).protected String
protected void
verifyResources
(String exemptResourceFile, CriticalResources.ResourceType resourceType) protected void
verifyResources
(String exemptResourceFile, CriticalResources.ResourceType resourceType, boolean includeCommonResources) protected void
Methods inherited from class com.atlassian.jira.pageobjects.JiraWebDriverTest
getBackdoor, getBaseClassRule, getBaseRule
-
Field Details
-
COMMON_JS
- See Also:
-
COMMON_CSS
- See Also:
-
-
Constructor Details
-
AbstractTestCriticalResources
public AbstractTestCriticalResources()
-
-
Method Details
-
visitPage
-
verifyResources
protected void verifyResources(String exemptResourceFile, CriticalResources.ResourceType resourceType) throws IOException - Throws:
IOException
-
verifyResources
protected void verifyResources(String exemptResourceFile, CriticalResources.ResourceType resourceType, boolean includeCommonResources) throws IOException - Throws:
IOException
-
getCommonPageURL
-
assertCriticalNetworkRequests
protected void assertCriticalNetworkRequests(CriticalResources.ResourceType resourceType, List<String> expected) Verifies that scripts or stylesheets that were drained on the page load match the given list (such resources block further processing and take part in the critical path).- Parameters:
resourceType
- look either for Scripts or Stylesheetsexpected
- the list of critical resources (in the format of "[context|resource]:[name]")
-