Skip to content

Commit f30df11

Browse files
authored
Fix integration tests and patch @graphiql/react (#1781)
1 parent 418f838 commit f30df11

File tree

5 files changed

+74
-13
lines changed

5 files changed

+74
-13
lines changed

examples/sveltekit/__integration-tests__/sveltekit.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('SvelteKit integration', () => {
109109
page.waitForResponse((res) => res.url().endsWith('/api/graphql'), {
110110
timeout: timings.waitForResponse
111111
}),
112-
page.click(`button[class="execute-button"]`)
112+
page.click(`.graphiql-execute-button`)
113113
]);
114114

115115
const json = await res.json();

packages/graphql-yoga/__integration-tests__/browser.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ describe('browser', () => {
148148
let browser: puppeteer.Browser
149149
let page: puppeteer.Page
150150

151-
const playButtonSelector = `[d="M 11 9 L 24 16 L 11 23 z"]`
152-
const stopButtonSelector = `[d="M 10 10 L 23 10 L 23 23 L 10 23 z"]`
151+
const playButtonSelector = `[aria-label^="Execute"]`
152+
const stopButtonSelector = `[aria-label^="Stop"]`
153153

154154
let port: number
155155
const server = createServer(yogaApp)
@@ -177,14 +177,14 @@ describe('browser', () => {
177177
})
178178

179179
const typeOperationText = async (text: string) => {
180-
await page.type('.query-editor .CodeMirror textarea', text)
180+
await page.type('.graphiql-query-editor .CodeMirror textarea', text)
181181
// TODO: figure out how we can avoid this wait
182182
// it is very likely that there is a delay from textarea -> react state update
183183
await new Promise((res) => setTimeout(res, 100))
184184
}
185185

186186
const typeVariablesText = async (text: string) => {
187-
await page.type('.variable-editor .CodeMirror textarea', text)
187+
await page.type('[aria-label="Variables"] .CodeMirror textarea', text)
188188
// TODO: figure out how we can avoid this wait
189189
// it is very likely that there is a delay from textarea -> react state update
190190
await new Promise((res) => setTimeout(res, 100))
@@ -210,7 +210,7 @@ describe('browser', () => {
210210
await page.goto(`http://localhost:${port}${endpoint}`)
211211
await typeOperationText('{ alwaysTrue }')
212212

213-
await page.click('.execute-button')
213+
await page.click('.graphiql-execute-button')
214214
const resultContents = await waitForResult()
215215

216216
expect(resultContents).toEqual(
@@ -232,7 +232,7 @@ describe('browser', () => {
232232
`mutation ($number: Int!) { setFavoriteNumber(number: $number) }`,
233233
)
234234
await typeVariablesText(`{ "number": 3 }`)
235-
await page.click('.execute-button')
235+
await page.click('.graphiql-execute-button')
236236
const resultContents = await waitForResult()
237237

238238
expect(resultContents).toEqual(
@@ -251,7 +251,7 @@ describe('browser', () => {
251251
test('execute SSE (subscription) operation', async () => {
252252
await page.goto(`http://localhost:${port}${endpoint}`)
253253
await typeOperationText(`subscription { count(to: 2) }`)
254-
await page.click('.execute-button')
254+
await page.click('.graphiql-execute-button')
255255

256256
await new Promise((res) => setTimeout(res, 50))
257257

@@ -299,7 +299,7 @@ describe('browser', () => {
299299
query,
300300
)}`,
301301
)
302-
await page.click('.execute-button')
302+
await page.click('.graphiql-execute-button')
303303
const resultContents = await waitForResult()
304304

305305
expect(resultContents).toEqual(
@@ -318,7 +318,7 @@ describe('browser', () => {
318318
test('should show BigInt correctly', async () => {
319319
await page.goto(`http://localhost:${port}${endpoint}`)
320320
await typeOperationText(`{ bigint }`)
321-
await page.click('.execute-button')
321+
await page.click('.graphiql-execute-button')
322322
const resultContents = await waitForResult()
323323

324324
expect(resultContents).toEqual(`{
@@ -330,7 +330,7 @@ describe('browser', () => {
330330
test('should show live queries correctly', async () => {
331331
await page.goto(`http://localhost:${port}${endpoint}`)
332332
await typeOperationText(`query @live { liveCounter }`)
333-
await page.click('.execute-button')
333+
await page.click('.graphiql-execute-button')
334334

335335
await new Promise((res) => setTimeout(res, 50))
336336

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/node_modules/@graphiql/react/dist/index.es.js b/node_modules/@graphiql/react/dist/index.es.js
2+
index f7ba535..752285c 100644
3+
--- a/node_modules/@graphiql/react/dist/index.es.js
4+
+++ b/node_modules/@graphiql/react/dist/index.es.js
5+
@@ -18839,11 +18839,9 @@ function ExecutionContextProvider(props2) {
6+
...rest
7+
};
8+
}
9+
- setIsFetching(false);
10+
setResponse(formatResult(fullResponse));
11+
} else {
12+
const response = formatResult(result);
13+
- setIsFetching(false);
14+
setResponse(response);
15+
}
16+
}, "handleResponse");
17+
@@ -21891,12 +21889,16 @@ function hasStringOrNullKey(obj, key) {
18+
}
19+
__name(hasStringOrNullKey, "hasStringOrNullKey");
20+
__name$c(hasStringOrNullKey, "hasStringOrNullKey");
21+
+window.g = {};
22+
function useSynchronizeActiveTabValues({
23+
queryEditor,
24+
variableEditor,
25+
headerEditor,
26+
responseEditor
27+
}) {
28+
+ window.g.resultComponent = {
29+
+ viewer: responseEditor,
30+
+ };
31+
return useCallback(
32+
(state2) => {
33+
var _a, _b, _c, _d, _e;

website/route-lockfile.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,32 @@
4545
/tutorial/basic/09-error-handling
4646
/tutorial/basic/10-filtering-and-pagination
4747
/tutorial/basic/11-summary
48+
/v3
49+
/v3/comparison
50+
/v3/features/apollo-federation
51+
/v3/features/automatic-persisted-queries
52+
/v3/features/context
53+
/v3/features/cors
54+
/v3/features/envelop-plugins
55+
/v3/features/error-masking
56+
/v3/features/file-uploads
57+
/v3/features/graphiql
58+
/v3/features/persisted-operations
59+
/v3/features/response-caching
60+
/v3/features/subscriptions
61+
/v3/features/testing
62+
/v3/integrations/integration-with-aws-lambda
63+
/v3/integrations/integration-with-bun
64+
/v3/integrations/integration-with-cloudflare-workers
65+
/v3/integrations/integration-with-deno
66+
/v3/integrations/integration-with-express
67+
/v3/integrations/integration-with-fastify
68+
/v3/integrations/integration-with-koa
69+
/v3/integrations/integration-with-nestjs
70+
/v3/integrations/integration-with-nextjs
71+
/v3/integrations/integration-with-sveltekit
72+
/v3/integrations/z-other-environments
73+
/v3/migration/migration-from-apollo-server
74+
/v3/migration/migration-from-express-graphql
75+
/v3/migration/migration-from-yoga-v1
76+
/v3/migration/migration-from-yoga-v2

website/src/pages/_app.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { AppProps } from 'next/app'
21
import '@theguild/components/style.css'
32

4-
export default function App({ Component, pageProps }: AppProps) {
3+
export default function App({ Component, pageProps }: any) {
54
return <Component {...pageProps} />
65
}
76

0 commit comments

Comments
 (0)