Advanced configuration for Pull Request Reviews can be set using a .calibre/config.yml file. This configuration file allows you to customize authentication, headers, cookies, and branch-specific settings.
There are two top-level properties you must specify:
There are two versions of the Calibre configuration file.
You can set the version by specifying the version number as the value of the version key:
1version: 22pullRequestReviews:
Calibre will automatically copy authentication settings from each Site to each Pull Request Review test. The authentication URL will be updated to use the same host as the pull request deployment.
If you require specific authentication details for Pull Request Reviews, you can set them using config.yml. This is helpful when your Pull Request environment has different authentication than the main Site.
The following configuration will be used for authentication:
1version: 22pullRequestReviews:3 - authentication:4 url: https://different-domain.com/login5 username: user@email.com6 password: mysecretpassword7 formSelector: form8 usernameSelector: input[name=email]9 passwordSelector: input[type=password]
1version: 12pullRequestReviews:3 authentication:4 url: https://different-domain.com/login5 username: user@email.com6 password: mysecretpassword7 formSelector: form8 usernameSelector: input[name=email]9 passwordSelector: input[type=password]
Providers like Netlify and Vercel have the option to password protect preview deployments. By omitting the authentication URL and only setting the password fields, the Calibre Agent will login to the deployment URL with a password before each Snapshot:
1version: 22pullRequestReviews:3 - authentication:4 password: mysecretpassword5 passwordSelector: input[type=password]
1version: 12pullRequestReviews:3 authentication:4 password: mysecretpassword5 passwordSelector: input[type=password]
You can specify headers and cookies for each Pull Request Review test.
Test Profiles can override cookies and headers set in Pull Request Review configuration. Calibre applies cookies and headers in the following order: Test Profile cookies and headers, Cookies and headers set in .calibre/config.yml, then Test Agent cookies and headers.
1version: 22pullRequestReviews:3 # Headers4 - headers:5 - name: X-Calibre-Test6 value: Pull Request7 - name: User-Agent8 value: Calibre910 # Cookies11 - cookies:12 - name: seen-cookie-notice13 value: true14 - name: uid15 value: 116 domain: calibreapp.com17 path: /18 secure: true19 httpOnly: true2021 # Specify headers and cookies for branches prefixed with `stage-`22 - headers:23 - name: X-Environment24 value: staging25 cookies:26 - name: staging-cookie27 value: true28 branches:29 - stage-*
You can specify configuration blocks for different branches using positive and negative patterns.
The order branch patterns are defined matters. The last matching pattern will determine if the branch is included or excluded.
The following configuration will apply authentication settings for all preview- branches except for preview-public as the last matching pattern for this branch does not require authentication.
1version: 22pullRequestReviews:3 - branches:4 - preview-*5 authentication:6 password: mysecretpassword7 formSelector: form8 passwordSelector: input[type=password]9 required: true10 - branches:11 - preview-public12 authentication:13 required: false
Here's a comprehensive example showing all available configuration options:
1version: 22pullRequestReviews:3 # Default configuration for all branches4 - authentication:5 url: https://auth.example.com/login6 username: test@example.com7 password: secretpassword8 formSelector: form.login9 usernameSelector: input[name=email]10 passwordSelector: input[type=password]11 required: true12 headers:13 - name: X-Environment14 value: preview15 - name: Authorization16 value: Bearer token12317 cookies:18 - name: session-id19 value: abc12320 domain: example.com21 path: /22 secure: true23 httpOnly: true2425 # Configuration for staging branches26 - branches:27 - staging/*28 - stage-*29 authentication:30 password: stagingpassword31 passwordSelector: input[type=password]32 headers:33 - name: X-Environment34 value: staging35 cookies:36 - name: staging-mode37 value: true3839 # Configuration for public preview branches (no auth required)40 - branches:41 - public-*42 authentication:43 required: false44 headers:45 - name: X-Environment46 value: public-preview
On this page