Checking Verifications
Alumnium can verify statements on the web page when you instruct it to check something. It analyzes the current state of the web page, optionally including its screenshot, and decides whether the verification successfully passes or fails.
For example, after performing a Google search for “Selenium”, you might want to check that search results contain a link to the Selenium browser automation tool:
If the search results don’t contain a link to selenium.dev
, Alumnium raises an assertion error and explains:
Specific Verifications
Similarly to actions, Alumnium works better when the verifications are concrete.
For example, if you are writing a test for completing tasks in the To-Do application and you don’t check the exact task’s state, you might end up with contradictory verifications passing at the same time!
To avoid false positives in the tests, write more concrete verifications:
Vision
Occasionally, the web page state is not enough for Alumnium to perform the check. In this case, instruct it to take a screenshot of the page and include it in the verification decision. This is useful when you need to check the visual representation of elements or their spatial relationships.
For example, in your test for the To-Do application, you might need a check that a completed task is shown with a strikethrough style.
Without a screenshot, this assertion can fail because there is no indication of font style in the web page itself:
To make the check more reliable, add a screenshot to it:
Keep in mind, that the screenshot is taken for the visible part of the page.
Flakiness
Alumnium automatically retries verification upon an assertion error if the page content is still loading. This is usually sufficient to handle common scenarios like checking for an element that is not yet displayed on the page