<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>74</id><slug>testing-login-flows-end-to-end-part-4-74</slug><title>Testing login flows end to end, part 4</title><excerpt>Part 4 looks at what changes when the same technique has to run every day in production. A login form is a small piece of UI with a surprising number of paths through it: success, wrong password,…</excerpt><seriesName>Testing login flows end to end</seriesName><seriesPart>4</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>Part 4 looks at what changes when the same technique has to run every day in production. A login form is a small piece of UI with a surprising number of paths through it: success, wrong password, locked account, slow responses and expired forms.</item></paragraphs></item><item><heading>Putting it into practice</heading><paragraphs><item>Dynamic pages render content after the initial HTML arrives. A browser automation tool can wait for a specific element to appear, which is far more reliable than sleeping for a fixed amount of time.</item><item>Validate the data you extract. Prices without currencies, dates without time zones and empty fields are common sources of silent errors downstream.</item></paragraphs></item><item><heading>A practical approach</heading><paragraphs><item>Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.</item><item>Always identify your client honestly with a descriptive User-Agent, and keep your request rate modest. A crawler that behaves like a considerate visitor is far less likely to cause problems for the site operator.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Cover each account state with its own test, assert on visible messages and on the resulting URL, and give slow paths an explicit, generous timeout.</item></paragraphs></item></sections><authorId>8</authorId><authorName>Hannah Novak</authorName><authorSlug>hannah-novak</authorSlug><category>Testing</category><tags><item>selenium</item><item>ethics</item><item>scrapy</item></tags><publishedAt>2024-01-11T00:00:00.000Z</publishedAt><wordCount>180</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
