|
1 | 1 | import { test, expect } from '../../../fixtures/base'; |
2 | 2 |
|
3 | | -test.describe('Webhook Origin Isolation', { |
4 | | - annotation: [ |
5 | | - { type: 'owner', description: 'Catalysts' }, |
6 | | - ], |
7 | | -}, () => { |
8 | | - test.beforeAll(async ({ api }) => { |
9 | | - await api.workflows.importWorkflowFromFile('webhook-origin-isolation.json', { |
10 | | - makeUnique: false, |
| 3 | +test.describe( |
| 4 | + 'Webhook Origin Isolation', |
| 5 | + { |
| 6 | + annotation: [{ type: 'owner', description: 'Catalysts' }], |
| 7 | + }, |
| 8 | + () => { |
| 9 | + test.beforeAll(async ({ api }) => { |
| 10 | + await api.workflows.importWorkflowFromFile('webhook-origin-isolation.json', { |
| 11 | + makeUnique: false, |
| 12 | + }); |
11 | 13 | }); |
12 | | - }); |
13 | 14 |
|
14 | | - const webhookPaths = [ |
15 | | - 'webhook-response-data-text-html', |
16 | | - 'webhook-response-data-wo-content-type', |
17 | | - 'webhook-last-node-no-content-type-header', |
18 | | - 'webhook-last-node-text-html-header', |
19 | | - 'webhook-last-node-text-html-content-type', |
20 | | - 'webhook-response-data-csp-header', |
21 | | - 'webhook-last-node-csp-header', |
22 | | - 'webhook-last-node-binary-text-html', |
23 | | - 'webhook-last-node-binary-no-content-type', |
24 | | - 'webhook-last-node-binary-csp-header', |
25 | | - 'respond-to-webhook-text-no-content-type', |
26 | | - 'respond-to-webhook-text-content-type-text-html', |
27 | | - 'respond-to-webhook-text-csp-header', |
28 | | - 'respond-to-webhook-json-as-text-html', |
29 | | - ]; |
| 15 | + const webhookPaths = [ |
| 16 | + 'webhook-response-data-text-html', |
| 17 | + 'webhook-response-data-wo-content-type', |
| 18 | + 'webhook-last-node-no-content-type-header', |
| 19 | + 'webhook-last-node-text-html-header', |
| 20 | + 'webhook-last-node-text-html-content-type', |
| 21 | + 'webhook-response-data-csp-header', |
| 22 | + 'webhook-last-node-csp-header', |
| 23 | + 'webhook-last-node-binary-text-html', |
| 24 | + 'webhook-last-node-binary-no-content-type', |
| 25 | + 'webhook-last-node-binary-csp-header', |
| 26 | + 'respond-to-webhook-text-no-content-type', |
| 27 | + 'respond-to-webhook-text-content-type-text-html', |
| 28 | + 'respond-to-webhook-text-csp-header', |
| 29 | + 'respond-to-webhook-json-as-text-html', |
| 30 | + ]; |
30 | 31 |
|
31 | | - const expectedCSP = |
32 | | - 'sandbox allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols'; |
| 32 | + const expectedCSP = |
| 33 | + 'sandbox allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols'; |
33 | 34 |
|
34 | | - for (const webhookPath of webhookPaths) { |
35 | | - test(`Webhook responses should include the correct response headers for ${webhookPath}`, async ({ |
36 | | - api, |
37 | | - }) => { |
38 | | - const webhookResponse = await api.webhooks.trigger(`/webhook/${webhookPath}`); |
39 | | - expect(webhookResponse.ok()).toBe(true); |
| 35 | + for (const webhookPath of webhookPaths) { |
| 36 | + test(`Webhook responses should include the correct response headers for ${webhookPath}`, async ({ |
| 37 | + api, |
| 38 | + }) => { |
| 39 | + const webhookResponse = await api.webhooks.trigger(`/webhook/${webhookPath}`); |
| 40 | + expect(webhookResponse.ok()).toBe(true); |
40 | 41 |
|
41 | | - const headers = webhookResponse.headers(); |
42 | | - expect(headers['content-security-policy']).toBe(expectedCSP); |
43 | | - }); |
44 | | - } |
45 | | -}); |
| 42 | + const headers = webhookResponse.headers(); |
| 43 | + expect(headers['content-security-policy']).toBe(expectedCSP); |
| 44 | + }); |
| 45 | + } |
| 46 | + }, |
| 47 | +); |
0 commit comments