Skip to content

Commit 4ddcc26

Browse files
committed
Fix tests for new editor
1 parent 55b3e0c commit 4ddcc26

File tree

3 files changed

+13
-54
lines changed

3 files changed

+13
-54
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ public/sitemap.xml
6363
out/
6464

6565
tsconfig.tsbuildinfo
66+
67+
playwright-report/

src/globals.css

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -112,52 +112,10 @@ div[id^="headlessui-menu-items"] {
112112
}
113113
}
114114

115-
.CodeMirror-selected {
116-
@apply !bg-primary/50 dark:bg-primary/40;
117-
}
118-
119-
.CodeMirror-cursor {
120-
@apply dark:border-white;
121-
}
122-
123-
.CodeMirror {
124-
@apply p-2;
125-
}
126-
127115
::selection {
128116
@apply bg-pri-base/25 dark:bg-pri-light/50;
129117
}
130118

131-
@media (prefers-color-scheme: dark) {
132-
body {
133-
/*background: linear-gradient(*/
134-
/* 125deg,*/
135-
/* rgba(234, 117, 195, 0.3) -10%,*/
136-
/* rgba(234, 117, 195, 0) 8%*/
137-
/* ),*/
138-
/* linear-gradient(*/
139-
/* -125deg,*/
140-
/* rgba(234, 117, 195, 0.3) -10%,*/
141-
/* rgba(234, 117, 195, 0) 8%*/
142-
/* ),*/
143-
/* linear-gradient(0deg, #05031c, #05031c);*/
144-
/*@apply bg-gradient-to-b from-primary/10 to-[#05031c]*/
145-
146-
/*background:*/
147-
/* !*linear-gradient(0deg, #05031c, #05031c),*!*/
148-
/* linear-gradient(*/
149-
/* 125.93deg,*/
150-
/* rgba(234, 117, 195, 0.7) -10.45%,*/
151-
/* rgba(234, 117, 195, 0) 28.49%*/
152-
/* ),*/
153-
/* linear-gradient(*/
154-
/* -125.93deg,*/
155-
/* rgba(234, 117, 195, 0.7) -33.25%,*/
156-
/* rgba(234, 117, 195, 0) 26.45%*/
157-
/* );*/
158-
}
159-
}
160-
161119
.donts-images ul {
162120
gap: 0 3em;
163121
@apply flex flex-wrap;

test/e2e/graphql-interactive.spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ test.describe("interactive examples", () => {
55
page,
66
}) => {
77
await page.goto("/learn")
8-
await page.waitForSelector(".CodeMirror", { timeout: 10000 })
8+
await page.waitForSelector(".cm-editor", { timeout: 10000 })
99

10-
const editors = page.locator(".miniGraphiQL")
10+
const editors = page.locator(".cm-editor")
1111
let heroEditor: Locator | null = null
1212

1313
for (let i = 0; i < (await editors.count()); i++) {
@@ -23,12 +23,7 @@ test.describe("interactive examples", () => {
2323
throw new Error("Could not find hero GraphQL editor")
2424
}
2525

26-
const codeMirrorEditor = heroEditor.locator(".CodeMirror").first()
27-
await expect(codeMirrorEditor).toBeVisible()
28-
29-
await codeMirrorEditor.click()
30-
31-
const codeLines = codeMirrorEditor.locator(".CodeMirror-line")
26+
const codeLines = heroEditor.locator(".cm-line")
3227

3328
// Find the line containing "name" and click after it
3429
for (let i = 0; i < (await codeLines.count()); i++) {
@@ -47,20 +42,24 @@ test.describe("interactive examples", () => {
4742
await page.keyboard.type("ap")
4843
await page.keyboard.press("Control+Space")
4944

50-
const autoCompleteMenu = page.locator(".CodeMirror-hints")
45+
const autoCompleteMenu = page.locator(".cm-tooltip-autocomplete")
5146
await expect(autoCompleteMenu).toBeVisible({ timeout: 5000 })
5247

5348
const appearsInSuggestion = page
54-
.locator(".CodeMirror-hints li")
49+
.locator(".cm-completionLabel")
5550
.filter({ hasText: "appearsIn" })
5651

52+
expect(page.locator(".cm-completionDetail").first()).toHaveText(
53+
"[Episode]!",
54+
)
55+
5756
if (await appearsInSuggestion.isVisible()) {
5857
await appearsInSuggestion.click()
5958
} else {
6059
await page.keyboard.press("Enter")
6160
}
6261

63-
const resultViewer = heroEditor.locator(".result-window")
62+
const resultViewer = page.locator(".result-window").first()
6463
await expect(resultViewer).toBeVisible()
6564

6665
await expect
@@ -91,7 +90,7 @@ test.describe("interactive examples", () => {
9190
await page.waitForLoadState("networkidle")
9291

9392
// Find the mutation example that has GraphiQL enabled
94-
const editors = page.locator(".miniGraphiQL")
93+
const editors = page.locator(".cm-editor")
9594
let mutationEditor: Locator | null = null
9695

9796
for (let i = 0; i < (await editors.count()); i++) {

0 commit comments

Comments
 (0)