Guide
Before moving on to the next examples, let's consider how to set some configuration parameters.
In the framework source files at
allurium-default.properties
there is the file allurium-default.properties
.
At the time of writing, it contains the following default parameters:
localization=en
step.detailing=2
highlighter.start=[
highlighter.end=]
page.load.strategy=normal
page.load.timeout=30000
retry.amount=10
retry.interval.ms=1000
Let's start by considering 4 of them:
page.load.strategy
page.load.timeout
retry.amount
retry.interval.ms
Assigning values:
page.load.strategy=normal
page.load.timeout=30000
is equivalent to calling in the code during test initialization:
Configuration.pageLoadStrategy = "normal"
Configuration.pageLoadTimeout = 30000
If you directly specify these values in your test code, they will take precedence and override the default values.
Next, the values:
retry.amount=10
retry.interval.ms=1000
This is a way to tell the framework the principle by which most of the waits, elements, values, and parameters are built. For example, if you need to find an element in a list, when calling the method employeesList.get("Robert")
it will perform 10 attempts with an interval of 1 second between each.
In the context of Selenide waits, this is equivalent to the code:
Configuration.timeout = retryAmount * retryIntervalMs;
Thus, Selenide waits and other waits constructed in the framework will be consistent. If you set your own value for Configuration.timeout
in the code, it will override the value from the file, while retry.amount
and retry.interval.ms
will retain their values. This can lead to desynchronization between the waits, so it is recommended to set values through the file.
The remaining parameters will be discussed in later examples, but first, let's cover how to use the properties
file.
As mentioned in the "Quick Start" description, it is enough to simply include the dependency in your pom.xml
or build.gradle
— and everything will work immediately. But you can also include your own allurium.properties
file in the project, which will override the built-in allurium-default.properties
file from the library.
To do this, you can download a sample from here: allurium.properties
The file name must be exactly allurium.properties
and it should be placed in the directory {your_project}/src/main/resources
.
If the allurium.properties
file exists, the framework will use the values from this file, and no additional configuration is needed.