| @@ -8,6 +8,11 @@ import { graphqlHttpPlugin } from "@executor-js/plugin-graphql/api"; · 7 unmodified lines |
| 8 | 8 | import { AuthTemplateSlug, ConnectionName, IntegrationSlug } from "@executor-js/sdk/shared"; |
| 9 | 9 | import { variable } from "@executor-js/sdk/http-auth"; |
| 10 | 10 | |
| 11 | +import { |
| 12 | + makeGreetingGraphqlSchema, |
| 13 | + serveGraphqlTestServer, |
| 14 | +} from "@executor-js/plugin-graphql/testing"; |
| 15 | + |
| 11 | 16 | import { scenario } from "../src/scenario"; |
| 12 | 17 | import { Api, Browser, Target } from "../src/services"; |
| 13 | 18 | import { visit } from "../src/surfaces/browser"; |
| @@ -144,3 +149,60 @@ scenario( · 130 unmodified lines |
| 144 | 149 | }), |
| 145 | 150 | ), |
| 146 | 151 | ); |
| 152 | + |
| 153 | +scenario( |
| 154 | + "GraphQL · a healthy account row keeps the connection's name", |
| 155 | + {}, |
| 156 | + Effect.scoped( |
| 157 | + Effect.gen(function* () { |
| 158 | + const target = yield* Target; |
| 159 | + const browser = yield* Browser; |
| 160 | + const { client: makeApiClient } = yield* Api; |
| 161 | + const identity = yield* target.newIdentity(); |
| 162 | + const client = yield* makeApiClient(api, identity); |
| 163 | + const slug = unique("graphql_label"); |
| 164 | + const upstream = yield* serveGraphqlTestServer({ schema: makeGreetingGraphqlSchema() }); |
| 165 | + |
| 166 | + yield* client.graphql.addIntegration({ |
| 167 | + payload: { |
| 168 | + endpoint: upstream.endpoint, |
| 169 | + slug, |
| 170 | + name: "Greeting API", |
| 171 | + }, |
| 172 | + }); |
| 173 | + |
| 174 | + yield* Effect.gen(function* () { |
| 175 | + yield* client.connections.create({ |
| 176 | + payload: { |
| 177 | + owner: "org", |
| 178 | + name: ConnectionName.make("workspace"), |
| 179 | + integration: IntegrationSlug.make(slug), |
| 180 | + template: AuthTemplateSlug.make("none"), |
| 181 | + value: "unused", |
| 182 | + }, |
| 183 | + }); |
| 184 | + |
| 185 | + yield* browser.session(identity, async ({ page, step }) => { |
| 186 | + await step("The healthy account row is labeled with the connection name", async () => { |
| 187 | + await visit(page, `/integrations/${slug}`); |
| 188 | + await page.getByRole("tab", { name: "Accounts" }).click(); |
| 189 | + // Wait for the automatic health probe to land so a probe identity |
| 190 | + // would have replaced the label if the plugin still reported one. |
| 191 | + await page.getByLabel("Status: Healthy").waitFor(); |
| 192 | + await page.getByText("workspace", { exact: true }).waitFor(); |
| 193 | + expect( |
| 194 | + await page.getByText("GraphQL schema", { exact: false }).count(), |
| 195 | + "the schema root type never masquerades as the account label", |
| 196 | + ).toBe(0); |
| 197 | + }); |
| 198 | + }); |
| 199 | + }).pipe( |
| 200 | + Effect.ensuring( |
| 201 | + client.integrations |
| 202 | + .remove({ params: { slug: IntegrationSlug.make(slug) } }) |
| 203 | + .pipe(Effect.ignore), |
| 204 | + ), |
| 205 | + ); |
| 206 | + }), |
| 207 | + ), |
| 208 | +); |