You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/turnstile/tutorials/excluding-turnstile-from-e2e-tests.mdx
+31-30Lines changed: 31 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,21 +18,22 @@ This tutorial explains how to handle Turnstile in your end-to-end (E2E) tests by
18
18
19
19
When running E2E tests, you often want to bypass or simplify the Turnstile verification process. Cloudflare provides official test credentials that always pass verification, making them perfect for testing environments:
20
20
21
-
- Test Sitekey: `1x00000000000000000000AA`
22
-
- Test Secret Key: `1x0000000000000000000000000000000AA`
21
+
- Test sitekey: `1x00000000000000000000AA`
22
+
- Test secret key: `1x0000000000000000000000000000000AA`
23
23
24
-
For more details, see the [testing documentation](/turnstile/troubleshooting/testing/).
24
+
For more details, refer to the [testing documentation](/turnstile/troubleshooting/testing/).
25
25
26
-
## ⚠️ Important Security Warning
26
+
:::caution
27
27
28
-
Never use test credentials in production! Always ensure:
29
-
1. Test credentials are only used in test environments
30
-
2. Production credentials are properly protected
31
-
3. Your deployment process prevents test credentials from reaching production
28
+
Never use test credentials in production. Always ensure:
29
+
- Test credentials are only used in test environments.
30
+
- Production credentials are properly protected.
31
+
- Your deployment process prevents test credentials from reaching production.
32
+
:::
32
33
33
-
## Implementation Strategy
34
+
## Implementation
34
35
35
-
The key to implementing test-environment detection is identifying test requests server-side. Here's a simple approach:
36
+
The key to implementing test-environment detection is identifying test requests server-side. Here is a simple approach:
36
37
37
38
```typescript
38
39
// Detect test environments using IP addresses or headers
@@ -60,7 +61,7 @@ function getTurnstileCredentials(request) {
60
61
}
61
62
```
62
63
63
-
## Server-side Integration
64
+
## Server-side integration
64
65
65
66
When rendering your page, inject the appropriate sitekey based on the environment:
0 commit comments