public class BrowserSteps extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLOSE_ALL_WINDOWS_AND_SWITCH_TO |
static String |
CLOSE_WINDOW_AND_SWITCH_TO |
static String |
GO_TO_URL_METHOD_NAME |
static String |
RESTART_WEB_DRIVER_AND_SWITCH_TO |
static String |
RESTART_WEB_DRIVER_METHOD_NAME |
Constructor and Description |
---|
BrowserSteps() |
Modifier and Type | Method and Description |
---|---|
void |
closeAllWindowsAndSwitchTo(String key)
Closes all windows except the given one.
|
void |
closeAllWindowsAndSwitchTo(String key,
List<GherkinStepCondition> conditions)
Closes all browser windows and switches to target window with conditions.
|
void |
closeWindowAndSwitchTo(String key,
List<GherkinStepCondition> conditions)
Closes window and switches to target window with conditions.
|
void |
closeWindowAndSwitchTo(String key,
String backTo)
Closes a specific window and go to the given url.
|
void |
goToUrl(String pageKey)
Go to Url.
|
void |
openNewWindow(List<GherkinStepCondition> conditions)
Open new window with conditions.
|
void |
openUrlIfDifferent(String pageKey,
List<GherkinStepCondition> conditions)
Open Url if different with conditions.
|
void |
restartWebDriver()
Restart WebDriver with a
Context.clear() . |
void |
restartWebDriverAndSwitchTo(String backTo)
Restart WebDriver with a
Context.clear() and go to the given url. |
void |
restartWebDriverAndSwitchTo(String backTo,
List<GherkinStepCondition> conditions)
Restart WebDriver with a
Context.clear() and switches to target window with conditions. |
void |
switchWindow(String windowKey,
List<GherkinStepCondition> conditions)
Switch window when the scenario contain more one windows (one more application for example).
|
public static final String CLOSE_WINDOW_AND_SWITCH_TO
public static final String CLOSE_ALL_WINDOWS_AND_SWITCH_TO
public static final String GO_TO_URL_METHOD_NAME
public static final String RESTART_WEB_DRIVER_METHOD_NAME
public static final String RESTART_WEB_DRIVER_AND_SWITCH_TO
@Quand(value="J\'ouvre une nouvelle fen\u00eatre(\\?)") @When(value="I open a new window(\\?)") public void openNewWindow(List<GherkinStepCondition> conditions) throws FailureException
openUrlIfDifferent
conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).FailureException
- if the scenario encounters a functional error@Lorsque(value="{string} est ouvert(\\?)") @Given(value="{string} is opened(\\?)") public void openUrlIfDifferent(String pageKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException
pageKey
- is the key of page (example: GOOGLE_HOME)conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_OPEN_APPLICATION" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional error@Et(value="Je retourne vers {string}") @And(value="I go back to {string}") public void goToUrl(String pageKey) throws TechnicalException, FailureException
pageKey
- is key corresponding to url of target.TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_OPEN_A_NEW_WINDOW" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional error@Quand(value="Je passe \u00e0 la fen\u00eatre {string}(\\?)") @When(value="I switch to {string} window(\\?)") public void switchWindow(String windowKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException
windowKey
- the key of window (popup, ...) Example: BAKERY.conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional error@Et(value="Je red\u00e9marre le web driver") @And(value="I restart the web driver") public void restartWebDriver()
Context.clear()
.@Lorsque(value="Je ferme la fen\u00eatre actuelle et passe \u00e0 la fen\u00eatre {string}(\\?)") @Then(value="I close current window and switch to {string} window(\\?)") public void closeWindowAndSwitchTo(String key, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException
key
- is the key of application (Ex: BAKERY).conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, no exception)FailureException
- if the scenario encounters a functional error@Lorsque(value="Je ferme toutes les fen\u00eatres sauf {string}(\\?)") @Then(value="I close all windows except {string}(\\?)") public void closeAllWindowsAndSwitchTo(String key, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException
key
- is the key of application (Ex: SALTO).conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, no exception)FailureException
- if the scenario encounters a functional error@Lorsque(value="Je red\u00e9marre le web driver et passe \u00e0 la fen\u00eatre {string}(\\?)") @Then(value="I restart the web driver and switch to {string} window(\\?)") public void restartWebDriverAndSwitchTo(String backTo, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException
Context.clear()
and switches to target window with conditions.backTo
- url to go back to.conditions
- list of 'expected' values condition and 'actual' values (GherkinStepCondition
).TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, with exception)
or "FAIL_MESSAGE_UNABLE_TO_OPEN_APPLICATION" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional errorpublic void closeWindowAndSwitchTo(String key, String backTo) throws TechnicalException, FailureException
key
- window key to keep.backTo
- url to go back to.TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, with exception)
or "FAIL_MESSAGE_UNABLE_TO_OPEN_APPLICATION" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional errorpublic void restartWebDriverAndSwitchTo(String backTo) throws TechnicalException, FailureException
Context.clear()
and go to the given url.
This method is called by reflexion from @see exceptions.ExceptionCallback#getCallBack(String).backTo
- url to go back to.TechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, with exception)
or "FAIL_MESSAGE_UNABLE_TO_OPEN_APPLICATION" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional errorpublic void closeAllWindowsAndSwitchTo(String key) throws TechnicalException, FailureException
key
- window key to keepTechnicalException
- is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with "FAIL_MESSAGE_UNABLE_TO_CLOSE_APP" message (with screenshot, with exception)FailureException
- if the scenario encounters a functional errorCopyright © 2023 NoraUi. All rights reserved.