|
3 | 3 | import workflowRunningFixture from '../fixtures/workflow-running.json';
|
4 | 4 | import workflowCompletedFixture from '../fixtures/workflow-completed.json';
|
5 | 5 |
|
6 |
| -const { workflowId, runId } = |
7 |
| - workflowCompletedFixture.workflowExecutionInfo.execution; |
| 6 | +describe('Stack Trace With Completed Workflow', () => { |
| 7 | + const { workflowId, runId } = |
| 8 | + workflowCompletedFixture.workflowExecutionInfo.execution; |
8 | 9 |
|
9 |
| -describe('Stack Trace', () => { |
10 | 10 | beforeEach(() => {
|
11 | 11 | cy.interceptApi();
|
12 | 12 |
|
13 | 13 | cy.intercept(
|
14 | 14 | Cypress.env('VITE_API_HOST') +
|
15 |
| - `/api/v1/namespaces/default/workflows/*/runs/*/events/reverse*`, |
| 15 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?maximumPageSize=20`, |
16 | 16 | { fixture: 'event-history-completed.json' },
|
17 |
| - ).as('event-history-api'); |
| 17 | + ).as('event-history-start'); |
18 | 18 |
|
19 |
| - cy.visit('/namespaces/default/workflows'); |
20 |
| - |
21 |
| - cy.wait('@workflows-api'); |
22 |
| - cy.wait('@namespaces-api'); |
23 |
| - }); |
| 19 | + cy.intercept( |
| 20 | + Cypress.env('VITE_API_HOST') + |
| 21 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?maximumPageSize=20`, |
| 22 | + { fixture: 'event-history-completed-reverse.json' }, |
| 23 | + ).as('event-history-end'); |
24 | 24 |
|
25 |
| - it('should show No Stack Trace for completed workflow', () => { |
26 |
| - cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
| 25 | + cy.intercept( |
| 26 | + Cypress.env('VITE_API_HOST') + |
| 27 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`, |
| 28 | + { fixture: 'event-history-completed-reverse.json' }, |
| 29 | + ).as('event-history-descending'); |
27 | 30 |
|
28 | 31 | cy.intercept(
|
29 | 32 | Cypress.env('VITE_API_HOST') +
|
30 | 33 | `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
|
31 | 34 | { fixture: 'workflow-completed.json' },
|
32 | 35 | ).as('workflow-api');
|
33 | 36 |
|
34 |
| - cy.wait('@workflow-api'); |
35 |
| - cy.wait('@event-history-api'); |
| 37 | + it('should show No Stack Trace for completed workflow', () => { |
| 38 | + cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
36 | 39 |
|
37 |
| - cy.get('[data-cy=stack-trace-tab]').click(); |
| 40 | + cy.wait('@workflow-api'); |
| 41 | + cy.wait('@event-history-start'); |
| 42 | + cy.wait('@event-history-end'); |
| 43 | + cy.wait('@event-history-descending'); |
38 | 44 |
|
39 |
| - cy.get('[data-cy="query-stack-trace-empty"]').contains( |
40 |
| - 'No Stack Traces Found', |
41 |
| - ); |
| 45 | + cy.get('[data-cy=stack-trace-tab]').click(); |
| 46 | + |
| 47 | + cy.wait('@workflow-api'); |
| 48 | + |
| 49 | + cy.get('[data-cy="query-stack-trace-empty"]').contains( |
| 50 | + 'No Stack Traces Found', |
| 51 | + ); |
| 52 | + }); |
42 | 53 | });
|
43 | 54 |
|
44 |
| - it('should show stack trace for running workflow', () => { |
| 55 | + describe('Stack Trace with Running Workflow', () => { |
45 | 56 | const { workflowId, runId } =
|
46 | 57 | workflowRunningFixture.workflowExecutionInfo.execution;
|
47 | 58 |
|
48 |
| - cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
| 59 | + beforeEach(() => { |
| 60 | + cy.interceptApi(); |
49 | 61 |
|
50 |
| - cy.intercept( |
51 |
| - Cypress.env('VITE_API_HOST') + |
52 |
| - `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`, |
53 |
| - { fixture: 'workflow-running.json' }, |
54 |
| - ).as('workflow-api'); |
| 62 | + cy.intercept( |
| 63 | + Cypress.env('VITE_API_HOST') + |
| 64 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?maximumPageSize=20`, |
| 65 | + { fixture: 'event-history-completed.json' }, |
| 66 | + ).as('event-history-start'); |
55 | 67 |
|
56 |
| - cy.wait('@workflow-api'); |
57 |
| - cy.wait('@event-history-api'); |
| 68 | + cy.intercept( |
| 69 | + Cypress.env('VITE_API_HOST') + |
| 70 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?maximumPageSize=20`, |
| 71 | + { fixture: 'event-history-completed-reverse.json' }, |
| 72 | + ).as('event-history-end'); |
58 | 73 |
|
59 |
| - cy.get('[data-cy=stack-trace-tab]').click(); |
| 74 | + cy.intercept( |
| 75 | + Cypress.env('VITE_API_HOST') + |
| 76 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`, |
| 77 | + { fixture: 'event-history-completed-reverse.json' }, |
| 78 | + ).as('event-history-descending'); |
60 | 79 |
|
61 |
| - cy.wait('@query-api'); |
| 80 | + cy.intercept( |
| 81 | + Cypress.env('VITE_API_HOST') + |
| 82 | + `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`, |
| 83 | + { fixture: 'workflow-running.json' }, |
| 84 | + ).as('workflow-api'); |
62 | 85 |
|
63 |
| - cy.get('[data-cy="query-stack-trace"]').contains('go.temporal.io/sdk'); |
64 |
| - }); |
| 86 | + it('should show stack trace for running workflow', () => { |
| 87 | + cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
65 | 88 |
|
66 |
| - it('should handle errors when the stack trace is not formatted as we expect', () => { |
67 |
| - const { workflowId, runId } = |
68 |
| - workflowRunningFixture.workflowExecutionInfo.execution; |
| 89 | + cy.wait('@workflow-api'); |
| 90 | + cy.wait('@event-history-start'); |
| 91 | + cy.wait('@event-history-end'); |
| 92 | + cy.wait('@event-history-descending'); |
69 | 93 |
|
70 |
| - cy.intercept( |
71 |
| - Cypress.env('VITE_API_HOST') + |
72 |
| - `/api/v1/namespaces/default/workflows/*/runs/*/query*`, |
73 |
| - { fixture: 'query-stack-trace-error.json' }, |
74 |
| - ).as('query-api-error'); |
| 94 | + cy.get('[data-cy=stack-trace-tab]').click(); |
75 | 95 |
|
76 |
| - cy.intercept( |
77 |
| - Cypress.env('VITE_API_HOST') + |
78 |
| - `/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`, |
79 |
| - { fixture: 'workflow-running.json' }, |
80 |
| - ).as('workflow-api'); |
| 96 | + cy.wait('@workflow-api'); |
| 97 | + cy.wait('@query-api'); |
| 98 | + |
| 99 | + cy.get('[data-cy="query-stack-trace"]').contains('go.temporal.io/sdk'); |
| 100 | + }); |
| 101 | + |
| 102 | + it('should handle errors when the stack trace is not formatted as we expect', () => { |
| 103 | + cy.intercept( |
| 104 | + Cypress.env('VITE_API_HOST') + |
| 105 | + `/api/v1/namespaces/default/workflows/*/runs/*/query*`, |
| 106 | + { fixture: 'query-stack-trace-error.json' }, |
| 107 | + ).as('query-api-error'); |
81 | 108 |
|
82 |
| - cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
| 109 | + cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`); |
83 | 110 |
|
84 |
| - cy.wait('@workflow-api'); |
85 |
| - cy.wait('@event-history-api'); |
| 111 | + cy.wait('@workflow-api'); |
| 112 | + cy.wait('@event-history-start'); |
| 113 | + cy.wait('@event-history-end'); |
| 114 | + cy.wait('@event-history-descending'); |
86 | 115 |
|
87 |
| - cy.get('[data-cy=stack-trace-tab]').click(); |
| 116 | + cy.get('[data-cy=stack-trace-tab]').click(); |
88 | 117 |
|
89 |
| - cy.wait('@query-api-error'); |
| 118 | + cy.wait('@workflow-api'); |
| 119 | + cy.wait('@query-api-error'); |
90 | 120 |
|
91 |
| - cy.get('[data-cy="query-stack-trace"]').contains('[{"an":"error"}]'); |
| 121 | + cy.get('[data-cy="query-stack-trace"]').contains('[{"an":"error"}]'); |
| 122 | + }); |
| 123 | + }); |
92 | 124 | });
|
93 | 125 | });
|
0 commit comments