Skip to content

Commit 766ce33

Browse files
authored
Merge pull request #19947 from mozilla/add-ci-header-for-waf
feat(ci): add header to identify CI on stage
2 parents a116e09 + d597f82 commit 766ce33

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/functional-tests/playwright.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ import { TargetNames } from './lib/targets';
1010
import { getFirefoxUserPrefs } from './lib/targets/firefoxUserPrefs';
1111

1212
const CI = !!process.env.CI;
13+
const CI_WAF_TOKEN = process.env.CI_WAF_TOKEN;
14+
15+
/**
16+
* Returns a header used for WAF bypass on stage domain.
17+
* Production ignores this header.
18+
* Requires CI_WAF_TOKEN to be set in CircleCI.
19+
*/
20+
function getCIHeader(): Record<string, string> {
21+
return CI && CI_WAF_TOKEN ? { 'fxa-ci': CI_WAF_TOKEN } : {};
22+
}
1323

1424
// If using the CircleCI parallelism feature, assure that the JUNIT XML report
1525
// has a unique name
@@ -64,6 +74,7 @@ export default defineConfig<PlaywrightTestConfig<TestOptions, WorkerOptions>>({
6474

6575
use: {
6676
viewport: { width: 1280, height: 720 },
77+
extraHTTPHeaders: getCIHeader(),
6778
},
6879
projects: [
6980
...TargetNames.map(

0 commit comments

Comments
 (0)