Urgent.News

What's breaking now, across thousands of outlets.

Tech

Cloudflare Turnstile in Playwright tests: what test keys cover and when you need real keys

Put a Cloudflare Turnstile widget on a signup form and your Playwright suite will start failing in ways that have nothing to do with your code. Cloudflare's own testing docs say it directly: automated suites such as Selenium, Cypress and Playwright are detected as bots. The widget may block, show a challenge, or behave differently from run to run. Cloudflare's answer is a set of dummy keys. They…

Cloudflare's Turnstile widget can cause issues in automated Playwright tests, such as Selenium, Cypress, and Playwright, as these are detected as bots. To solve this problem, Cloudflare provides dummy keys that can help most of the time. However, there are certain checks that require real keys.

A Playwright setup can be configured to use test keys by entering them into environment variables. Playwright's webServer option can be used to start the application before running tests and accept environment blocks, allowing tests to run with test keys.

There are four pairs of test keys provided by Cloudflare: one for always passing, one for always failing, one for passing/failing invisible widgets, and one for forcing an interactive challenge. The test sitekeys produce a dummy token XXXX.DUMMY.TOKEN.XXXX, which only passes with the production secret keys.

When using test keys, it's essential to cover different scenarios, including the form showing a useful message, keeping the user's input, and offering a retry when the widget fails. Another scenario is when the server rejects the form, indicating that the backend checks the success instead of relying on the token. Lastly, there's the interactive challenge, which is useful for manual checks when the challenge appears, but should be excluded from CI runs.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Relevance Of Software Engineering In Web Apps

We live in the golden age of "vibe coding." Coined to describe the workflow of prompting an LLM, accepting diffs without reading them, and iterating purely on natural language until the UI looks…

  • AI-generated coding simplifies web app creation but poses risks.
  • Software engineering addresses design, security, testing, scaling, and maintenance.

Hot experts, cold RAM: a big MoE on a box with more memory than VRAM

Two budgets, and only one of them is expensive Every local deployment spends against two budgets at once: the size of the model and the price of the memory holding it.

  • Strata is a memory-efficient inference engine for Mixture of Experts (MoE) models
  • It retains only active experts in memory, leaving others idle
  • DDR system memory is used for model weights during idle periods, instead of expensive VRAM

More from Thursday 12 November →