Created
July 18, 2011 18:27
-
-
Save brikis98/1090246 to your computer and use it in GitHub Desktop.
Frontier component example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Sample Frontier JSP. Shows how to pull in the common "chrome", specify components (data) the JSP depends on and how to render this data. --> | |
| <chrome:base/> | |
| <component:set> | |
| <component:decl id="lastModifiedComponent" class="com.linkedin.fronttest.component.LastModifiedComponent" /> | |
| </component:set> | |
| <html> | |
| <head> | |
| <title>Last Modified Component</title> | |
| </head> | |
| <body id="fronttest-component-misc-last-modified-mode"> | |
| Last Modified header set to: <span id="last- modified">${lastModifiedComponent.derived.lastModified}</span> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * Sample Frontier Component. These are reusable blocks of functionality that can be used to fetch data from databases, | |
| * external services, etc in parallel. This example just sets the lastModified date in the header and adds it to the | |
| * derived data for the JSP. | |
| * | |
| */ | |
| @MinimumAuthenticationLevel(AuthenticationLevel.identified) | |
| public class LastModifiedComponent extends FrontierComponent implements FrontierLifecycleAware | |
| { | |
| @Override | |
| public void onStart() | |
| { | |
| long lastModified = new Random().nextInt(Integer.MAX_VALUE); | |
| addDerivedData("lastModified", new Date(lastModified).toGMTString()); | |
| getRequestState().setLastModifiedResponseHeader(lastModified); | |
| } | |
| @Override | |
| public void onEnd() | |
| { | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Sample selenium test script for checking UI elements | |
| # | |
| @env.selenium.stop | |
| browser.start_new_browser_session(:captureNetworkTraffic => true) | |
| browser.open_link(@app_home_link) | |
| frontier_home_page.last_modified_component_link.click_and_wait | |
| browser.open_link(link + "&ef=f&doTiming=true") | |
| sign_in_page.assert_presence | |
| sign_in_page.pagekey.wait_for_presence | |
| #Assert Cookies and headers | |
| frontier_helper.verify_all_cookies | |
| puts("All cookies asserted") | |
| assert_equal(frontier_helper.verify_all_headers(:link_to_check => link + "&ef=f&doTiming=true"), true) | |
| puts("All headers asserted") | |
| puts("Frontier Last Modified component in Guest case") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See Testing Frontier, LinkedIn's Web Framework for more information.