I have a test that clicks on a button in my WEB-app and it causes opening a new page in the new browser tab. I want to make sure that it opens the expected site. URL of this new page contains generated part so I'm using urlContaining() method which checks that the URL contains expected string:
lkPage.videoCheckButton.click();
webdriver().shouldHave(numberOfWindows(2));
switchTo().window(1);
webdriver().shouldHave(urlContaining("https://webinar.test.online/"));
If I run this test on my local environment, it performs with no issue. But sometimes when I launch it on a remote machine (GitLab runner), I get strange log - test fails despite it shouldn't:
webdriver should have url containing https://webinar.test.online/
Actual value: https://webinar.test.online/b/m1r-7gk-gf7-jcu
That's not the first time I meet such issue. Couple of month ago I tried to write similiar test but used shouldHave(url()) instead of shouldHave(urlContaining()) (URL didn't contain generated part), so I got fail log like:
webdriver should have url https://webinar.test.online/123
Actual value: https://webinar.test.online/123
What's wrong with my code or with this method?