|
| 1 | +import type { OpenFileInIdeQuery } from '../../src/generated/graphql-test' |
1 | 2 | import RelevantRunsDataSource_RunsByCommitShas from '../fixtures/gql-RelevantRunsDataSource_RunsByCommitShas.json'
|
2 | 3 |
|
3 | 4 | Cypress.on('window:before:load', (win) => {
|
@@ -31,27 +32,27 @@ describe('App - Debug Page', () => {
|
31 | 32 | it('all tests passed', () => {
|
32 | 33 | // This mocks all the responses so we can get deterministic
|
33 | 34 | // results to test the debug page.
|
34 |
| - cy.intercept('POST', '/__cypress/graphql/query-Debug', { |
| 35 | + cy.intercept('query-Debug', { |
35 | 36 | fixture: 'debug-Passing/gql-Debug.json',
|
36 | 37 | })
|
37 | 38 |
|
38 |
| - cy.intercept('POST', '/__cypress/graphql/query-CloudViewerAndProject_RequiredData', { |
| 39 | + cy.intercept('query-CloudViewerAndProject_RequiredData', { |
39 | 40 | fixture: 'debug-Passing/gql-CloudViewerAndProject_RequiredData.json',
|
40 | 41 | })
|
41 | 42 |
|
42 |
| - cy.intercept('POST', '/__cypress/graphql/query-MainAppQuery', { |
| 43 | + cy.intercept('query-MainAppQuery', { |
43 | 44 | fixture: 'debug-Passing/gql-MainAppQuery.json',
|
44 | 45 | })
|
45 | 46 |
|
46 |
| - cy.intercept('POST', '/__cypress/graphql/query-SideBarNavigationContainer', { |
| 47 | + cy.intercept('query-SideBarNavigationContainer', { |
47 | 48 | fixture: 'debug-Passing/gql-SideBarNavigationContainer',
|
48 | 49 | })
|
49 | 50 |
|
50 |
| - cy.intercept('POST', '/__cypress/graphql/query-HeaderBar_HeaderBarQuery', { |
| 51 | + cy.intercept('query-HeaderBar_HeaderBarQuery', { |
51 | 52 | fixture: 'debug-Passing/gql-HeaderBar_HeaderBarQuery',
|
52 | 53 | })
|
53 | 54 |
|
54 |
| - cy.intercept('POST', '/__cypress/graphql/query-SpecsPageContainer', { |
| 55 | + cy.intercept('query-SpecsPageContainer', { |
55 | 56 | fixture: 'debug-Passing/gql-SpecsPageContainer',
|
56 | 57 | })
|
57 | 58 |
|
@@ -86,30 +87,44 @@ describe('App - Debug Page', () => {
|
86 | 87 | })
|
87 | 88 |
|
88 | 89 | it('shows information about a failed spec', () => {
|
89 |
| - cy.intercept('POST', '/__cypress/graphql/query-Debug', { |
| 90 | + cy.intercept('query-Debug', { |
90 | 91 | fixture: 'debug-Failing/gql-Debug.json',
|
91 | 92 | })
|
92 | 93 |
|
93 |
| - cy.intercept('POST', '/__cypress/graphql/query-CloudViewerAndProject_RequiredData', { |
| 94 | + cy.intercept('query-CloudViewerAndProject_RequiredData', { |
94 | 95 | fixture: 'debug-Failing/gql-CloudViewerAndProject_RequiredData.json',
|
95 | 96 | })
|
96 | 97 |
|
97 |
| - cy.intercept('POST', '/__cypress/graphql/query-MainAppQuery', { |
| 98 | + cy.intercept('query-MainAppQuery', { |
98 | 99 | fixture: 'debug-Failing/gql-MainAppQuery.json',
|
99 | 100 | })
|
100 | 101 |
|
101 |
| - cy.intercept('POST', '/__cypress/graphql/query-SideBarNavigationContainer', { |
| 102 | + cy.intercept('query-SideBarNavigationContainer', { |
102 | 103 | fixture: 'debug-Failing/gql-SideBarNavigationContainer',
|
103 | 104 | })
|
104 | 105 |
|
105 |
| - cy.intercept('POST', '/__cypress/graphql/query-HeaderBar_HeaderBarQuery', { |
| 106 | + cy.intercept('query-HeaderBar_HeaderBarQuery', { |
106 | 107 | fixture: 'debug-Failing/gql-HeaderBar_HeaderBarQuery',
|
107 | 108 | })
|
108 | 109 |
|
109 |
| - cy.intercept('POST', '/__cypress/graphql/query-SpecsPageContainer', { |
| 110 | + cy.intercept('query-SpecsPageContainer', { |
110 | 111 | fixture: 'debug-Failing/gql-SpecsPageContainer',
|
111 | 112 | })
|
112 | 113 |
|
| 114 | + cy.intercept('query-OpenFileInIDE', (req) => { |
| 115 | + req.on('response', (res) => { |
| 116 | + const gqlData = res.body.data as OpenFileInIdeQuery |
| 117 | + |
| 118 | + gqlData.localSettings.preferences.preferredEditorBinary = 'code' |
| 119 | + }) |
| 120 | + }) |
| 121 | + |
| 122 | + cy.intercept('mutation-OpenFileInIDE_Mutation').as('openFileInIDE') |
| 123 | + |
| 124 | + cy.withCtx((ctx, { sinon }) => { |
| 125 | + sinon.stub(ctx.actions.file, 'openFile') |
| 126 | + }) |
| 127 | + |
113 | 128 | cy.visitApp()
|
114 | 129 |
|
115 | 130 | cy.findByTestId('sidebar-link-debug-page').click()
|
@@ -147,5 +162,11 @@ describe('App - Debug Page', () => {
|
147 | 162 | cy.findByTestId('test-row').contains('InfoPanel')
|
148 | 163 | cy.findByTestId('test-row').contains('renders')
|
149 | 164 | cy.findByTestId('run-failures').should('exist').should('have.attr', 'href', '#/specs/runner?file=src/components/InfoPanel/InfoPanel.cy.ts&mode=debug')
|
| 165 | + |
| 166 | + cy.findByLabelText('Open in IDE').click() |
| 167 | + cy.wait('@openFileInIDE') |
| 168 | + cy.withCtx((ctx) => { |
| 169 | + expect(ctx.actions.file.openFile).to.have.been.calledWith('src/components/InfoPanel/InfoPanel.cy.ts', 1, 1) |
| 170 | + }) |
150 | 171 | })
|
151 | 172 | })
|
0 commit comments