(input: {
readonly target: TargetShape;
readonly browser: BrowserSurface;
readonly identity: Identity;
readonly sourceUrl: string;
})
| 208 | }).then((response) => response.body); |
| 209 | |
| 210 | const addSourceThroughConsole = (input: { |
| 211 | readonly target: TargetShape; |
| 212 | readonly browser: BrowserSurface; |
| 213 | readonly identity: Identity; |
| 214 | readonly sourceUrl: string; |
| 215 | }) => |
| 216 | input.browser.session(input.identity, async ({ page, step }) => { |
| 217 | await step("Open the integrations page", async () => { |
| 218 | await page.goto(new URL("/integrations", input.target.baseUrl).toString(), { |
| 219 | waitUntil: "networkidle", |
| 220 | }); |
| 221 | }); |
| 222 | |
| 223 | await step("Detect the Git repository as custom tools", async () => { |
| 224 | await page.getByRole("button", { name: "Connect", exact: true }).click(); |
| 225 | const dialog = page.getByRole("dialog"); |
| 226 | await dialog.getByRole("textbox").fill(input.sourceUrl); |
| 227 | await dialog.getByRole("button", { name: "Detect" }).click(); |
| 228 | await page.getByRole("heading", { name: "Add custom tools" }).waitFor(); |
| 229 | }); |
| 230 | |
| 231 | await step("Sync the custom tools source", async () => { |
| 232 | await page.locator('input[type="password"]').fill(FIXTURE_GIT_TOKEN); |
| 233 | await page.getByRole("button", { name: "Sync source" }).click(); |
| 234 | await page.waitForURL(/\/integrations\/repo(?:\?|$)/, { timeout: 90_000 }); |
| 235 | await page.getByLabel("Source").getByText("3 tools").waitFor({ timeout: 90_000 }); |
| 236 | await page.getByRole("link", { name: "repo" }).waitFor({ timeout: 90_000 }); |
| 237 | await page.getByRole("tab", { name: "Tools" }).click(); |
| 238 | await page.getByRole("button", { name: /repo\s+3/ }).click(); |
| 239 | await page.getByRole("button", { name: "echo-tool", exact: true }).click(); |
| 240 | await page.getByRole("tab", { name: "Run" }).click(); |
| 241 | expect(await page.getByLabel("Connection").count()).toBe(0); |
| 242 | await page.getByLabel("message").fill("from run tab"); |
| 243 | await page.getByLabel("apps").selectOption("0"); |
| 244 | await page.getByRole("button", { name: "Run", exact: true }).click(); |
| 245 | await page |
| 246 | .locator("pre") |
| 247 | .filter({ hasText: "from run tab" }) |
| 248 | .filter({ hasText: "v1" }) |
| 249 | .last() |
| 250 | .waitFor({ timeout: 90_000 }); |
| 251 | }); |
| 252 | }); |
| 253 | |
| 254 | const assertBadTokenFailureThroughConsole = (input: { |
| 255 | readonly target: TargetShape; |
no test coverage detected