Class Mopo
java.lang.Object
in.virit.mopo.Mopo
General utilities for Playwright and Vaadin.
-
Constructor Summary
ConstructorsConstructorDescriptionMopo(com.microsoft.playwright.Page page) Constructs a new Mopo for given page -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.static voidassertNoJsErrors(com.microsoft.playwright.Page page) Deprecated.this method depends on dev mode, consider usingfailOnClientSideErrors()()} andtrackClientSideErrors()that use browser console.voidclick(com.microsoft.playwright.Locator locator) A shorthand to click the referenced locator and towaitForConnectionToSettle().voidA shorthand to click the referenced selector and towaitForConnectionToSettle().voidExecutes given task in a temporarily visible UI part, like a dialog or form.voidExecutes given task in a temporarily visible UI part, like a dialog or form.voidAsserts that there are no client-side errors in the console.Returns the list of console errors that have been logged since thetrackClientSideErrors()was called.getViewsReportedByDevMode(com.microsoft.playwright.Browser browser, String rootUrl) Returns a list of routes/views(URLs) that Vaadin app in development mode contains.voidStarts monitoring browser console and errors and collects those for further inspection (e.g.voidWaits until the client-server communication by Vaadin has settled.static voidwaitForConnectionToSettle(com.microsoft.playwright.Page page) Waits until the client-server communication by Vaadin has settled.static voidwaitForConnectionToSettle(com.microsoft.playwright.Page page, int minWait) Waits until the client-server communication by Vaadin has settled.
-
Constructor Details
-
Mopo
public Mopo(com.microsoft.playwright.Page page) Constructs a new Mopo for given page- Parameters:
page- the page use by this Mopo instance
-
-
Method Details
-
waitForConnectionToSettle
public static void waitForConnectionToSettle(com.microsoft.playwright.Page page) Waits until the client-server communication by Vaadin has settled.- Parameters:
page- the page on which Vaadin app is expected to be run
-
waitForConnectionToSettle
public static void waitForConnectionToSettle(com.microsoft.playwright.Page page, int minWait) Waits until the client-server communication by Vaadin has settled.- Parameters:
page- the page on which Vaadin app is expected to be runminWait- the minimum wait time spent to watch if client-server communication starts
-
assertNoJsErrors
Deprecated.this method depends on dev mode, consider usingfailOnClientSideErrors()()} andtrackClientSideErrors()that use browser console.Asserts that there are no JS errors in the dev console.- Parameters:
page- the page to be checked
-
trackClientSideErrors
public void trackClientSideErrors()Starts monitoring browser console and errors and collects those for further inspection (e.g. withgetClientSideErrors()orfailOnClientSideErrors()). -
getClientSideErrors
Returns the list of console errors that have been logged since thetrackClientSideErrors()was called.- Returns:
- a list of console messages that are errors
-
waitForConnectionToSettle
public void waitForConnectionToSettle()Waits until the client-server communication by Vaadin has settled. -
assertNoJsErrors
Deprecated.this method depends on dev mode, consider usingfailOnClientSideErrors()()} andtrackClientSideErrors()that use browser console.Asserts that there are no JS errors in the dev console. -
getViewsReportedByDevMode
public List<String> getViewsReportedByDevMode(com.microsoft.playwright.Browser browser, String rootUrl) Returns a list of routes/views(URLs) that Vaadin app in development mode contains.- Parameters:
browser- the browser instancerootUrl- relative URLs of the test server views that in development time lists- Returns:
- a list of URLs pointing to known routes
-
driveIn
Executes given task in a temporarily visible UI part, like a dialog or form. The UI part is expected to be detached after the task (implicitly asserted).- Parameters:
selector- a selector to the UI part to be accessed or a part within it (like a "Save" button)taskToRun- the task that should be performed in the temporarily visible component (composition)
-
driveIn
Executes given task in a temporarily visible UI part, like a dialog or form. The UI part is expected to be hidden after the task.- Parameters:
locator- a locator to the UI part or a part within it (like a "Save" button). This is used to verify that the component is shown before the given task is executed and hidden after the execution.taskToRun- the task that should be performed in the temporarily visible component (composition)
-
click
public void click(com.microsoft.playwright.Locator locator) A shorthand to click the referenced locator and towaitForConnectionToSettle(). This is a helper you can for example use for "Save" button in your form, that asynchronously changes content already present in the UI. When using this instead of the raw Playwright click, you can assert the changed content right away without further magic.- Parameters:
locator- the locator to click
-
click
A shorthand to click the referenced selector and towaitForConnectionToSettle(). This is a helper you can for example use for "Save" button in your form, that asynchronously changes content already present in the UI. When using this instead of the raw Playwright click, you can assert the changed content right away without further magic.- Parameters:
selector- the selector to click
-
failOnClientSideErrors
public void failOnClientSideErrors()Asserts that there are no client-side errors in the console. Throws a RuntimeException if there are any errors.
-
failOnClientSideErrors()()} andtrackClientSideErrors()that use browser console.