* Make self-host tests CI-safe * Await cloud db teardown * Give local e2e boots more headroom * Keep main CI runs alive * Cache CI dependencies and image layers * Wait for recorded introspection requests in graphql plugin tests * Size self-host test budget for loaded runners * Probe test http servers for readiness before use * Die on recorder wait timeout instead of typing a string error * Type the recorder wait timeout as a tagged error * Update e2e locators for the integration copy renames * Keep stale data rendered while a refresh is waiting * Guard create-org input against hydration clobbering * Match the new sign-in heading in the selfhost callback test
Showing the changes to packages/plugins/graphql/src/testing (1 of 27 files). Show all
Unified · Split
| @@ -5,6 +5,7 @@ import { · 4 unmodified lines | ||
| 5 | 5 | Layer, |
| 6 | 6 | Predicate, |
| 7 | 7 | Ref, |
| 8 | + Schedule, | |
| 8 | 9 | Schema as EffectSchema, |
| 9 | 10 | Scope, |
| 10 | 11 | } from "effect"; |
| @@ -54,6 +55,28 @@ export interface GraphqlTestServerShape { · 43 unmodified lines | ||
| 54 | 55 | readonly clearRequests: Effect.Effect<void>; |
| 55 | 56 | } |
| 56 | 57 | |
| 58 | +export class GraphqlTestRecorderTimeoutError extends Data.TaggedError( | |
| 59 | + "GraphqlTestRecorderTimeoutError", | |
| 60 | +)<{ | |
| 61 | + readonly message: string; | |
| 62 | +}> {} | |
| 63 | + | |
| 64 | +/** Poll the request recorder until `predicate` matches. Yoga captures requests | |
| 65 | + * asynchronously (`captureRequest` runs via `Effect.runPromise` in the handler | |
| 66 | + * context), so connect/invoke can resolve before the ref updates under load. */ | |
| 67 | +export const waitForRecordedRequests = ( | |
| 68 | + requests: Effect.Effect<readonly GraphqlTestRequest[]>, | |
| 69 | + predicate: (requests: readonly GraphqlTestRequest[]) => boolean, | |
| 70 | + message = "timed out waiting for matching recorded GraphQL requests", | |
| 71 | +): Effect.Effect<readonly GraphqlTestRequest[], GraphqlTestRecorderTimeoutError> => | |
| 72 | + requests.pipe( | |
| 73 | + Effect.filterOrFail( | |
| 74 | + (all) => predicate(all), | |
| 75 | + () => new GraphqlTestRecorderTimeoutError({ message }), | |
| 76 | + ), | |
| 77 | + Effect.retry(Schedule.both(Schedule.spaced("50 millis"), Schedule.recurs(100))), | |
| 78 | + ); | |
| 79 | + | |
| 57 | 80 | class GraphqlTestServerAddressError extends Data.TaggedError("GraphqlTestServerAddressError")<{ |
| 58 | 81 | readonly address: unknown; |
| 59 | 82 | }> {} |