Skip to content
All articles

Automated Login Testing Against a Staging URL, and Where It Breaks

Demola AdebayoNovember 22, 20263 min read9 views

Most teams without a dedicated QA function test login by hand, once, before a release. It is the highest-risk path in the product and the least automated. This is what an automated version looks like, and honestly where it stops working.

What the flow does

The workflow takes five inputs: a login URL, an email, a password, a page to visit after signing in, and a string the authenticated page should contain. It then:

  1. opens the login page in a real browser,
  2. types the credentials into the email and password fields,
  3. clicks the submit control,
  4. waits for navigation, then visits the post-login page,
  5. asserts the expected text is present,
  6. captures a screenshot at each stage and writes a report.

Because it is a real browser rather than an HTTP client, it also exercises whatever JavaScript the login page runs. That is the part a request-level test misses and the part that usually breaks.

Where it actually breaks

Being specific here because this is the useful part.

Finding the submit control

The default selector targets a submit button by type or a button whose text looks like sign in. That is a heuristic and heuristics fail. If your button is a div with an onclick handler, or its label is localised, or it sits inside a web component with a shadow root, the selector will not match and the step times out.

We have hit exactly this: two runs against a real site both failed at the click with a 20 second timeout because the control was not where the heuristic looked. The fix is to pass an explicit selector, which the workflow accepts.

Waiting for the right thing

Single page apps often change the URL without a full navigation, and sometimes render the authenticated shell before the data arrives. Waiting for navigation is not the same as waiting for content, so the assertion step is what actually confirms the login worked.

Credentials

Passwords are supplied per run, held in memory, interpolated into the step, and redacted from the stored step output. They are never written to the database. That is the right default, and it also means a run cannot be replayed from history without supplying the password again.

What this is not

It is not a replacement for a test suite. It does not run in CI, it does not assert on your application state beyond page text, and it does not give you a pass or fail that ladders into a build gate.

What it is: a way to answer 'is login broken on staging right now' without opening a browser yourself, with a screenshot to prove what the page looked like at each stage.

Making it reliable

  • Pass an explicit selector for the submit control. Do not rely on the heuristic.
  • Assert on text that only appears once authenticated, not on the URL.
  • Use a dedicated test account with data that will not change under you.
  • Expect to need help the first time it fails. Diagnosing a selector problem is developer work.

The workflow is listed here: workflow catalogue. If you want to run it against your own staging URL, the free tier covers it.

Share this article