FjolleJagt / kbhff_selenium_tests

2 stars 1 forks source link

Successful login test, waiting for redirect #2

Closed cleborys closed 5 years ago

cleborys commented 5 years ago

Successful login results in a redirect to a non-login-page, which we should not assume anything about. Currently, the tests waits 3 seconds, using time.sleep after submitting its data and then checks whether it is still on the login page after loading the current page. Without the wait, it evaluates too quickly and will still be on the login page, even if the login works. Rather than waiting 3 seconds manually, I would like the webdriver to wait for a redirect but couldn't figure out how to do that, yet.

FjolleJagt commented 5 years ago

I would be happy to make very basic assumptions about the redirect process - e.g. that after login we're taken to the main page, and then waitForLocation; or about the presence of a particular element on the page we're sent to. Then we can use selenium implicit waits. Are you unhappy with this because you feel it assumes too much?

cleborys commented 5 years ago

Currently you are not redirected to the main page, but to the "gdpr samtykke" page, and I'm not so sure whether that might change... We could compare that page and the login page though and see whether there is something basic to be detected there.

cleborys commented 5 years ago

This is no longer relevant, as we adapted waits and retries in asserts like assert_current_page and by assorting that the current page is not equal to the login page.