test(insomnia-test): align 2-http-cookie-env with pruned e2e-1 base

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Bob QiuandClaude Sonnet 5.5 committed 2026-11-05 14:18:20 +08:00
1 parent 311ad0906c
commit cfb05a3c30
9 files changed
+52 -32

No files matched your search

@@ -61,6 +61,28 @@ export class PreferencesCredentialsComponent extends PreferencesTabComponent {
await modal.waitForHidden();
}
/**
* Adds a custom (username/PAT) Git credential from the Credentials tab,
* which must already be open (see `openCredentialsTab()`).
*/
async addCustomCredential(credential: GitCredential): Promise<void> {
const modal = this.page.getByRole("dialog", {
name: /Access Token Credential/,
});
await this.dialog
.getByRole("button", { name: "Create Git Credential" })
.click();
await this.page
.getByRole("menuitem", { name: "Access Token", exact: true })
.click();
await this.page.getByLabel("Author Email").fill(credential.authorEmail);
await this.page.getByLabel("Author Name").fill(credential.authorName);
await this.page.getByLabel("Username").fill(credential.username);
await this.page.getByLabel("Git Access Token").fill(credential.password);
await this.page.getByRole("button", { name: "Save Credential" }).click();
await expect(modal).toBeHidden({ timeout: DEFAULT_TIMEOUT });
}
/**
* Adds an AWS cloud (vault) credential from the Credentials tab's
* "Service Provider Credential List", which must already be open (see
@@ -8,6 +8,7 @@ import { CookieFlow } from "./cookie.flow";
import { EnvironmentFlow } from "./environment.flow";
import { EventStreamRequestFlow } from "./event-stream-request.flow";
import { ExportFlow } from "./export.flow";
import type { FlowContext } from "./flow-context";
import { FolderFlow } from "./folder.flow";
import { GitSyncFlow } from "./git-sync.flow";
import { GraphQLRequestFlow } from "./graphql-request.flow";
@@ -1,7 +1,6 @@
import type { OAuth2Tokens } from "@package/components/auth-tab.component";
import { type McpCapabilityType, McpListAction } from "@package/enums/mcp-capability";
import { DEFAULT_TIMEOUT } from "@package/misc/constants";
import type { FlowContext } from "@package/misc/flow-context";
import { step } from "@package/misc/step";
import { McpClient } from "@package/models/mcp-client";
import type { Project } from "@package/models/project";
@@ -11,6 +10,7 @@ import type { PageManager } from "@package/pages/page-manager";
import { expect } from "@playwright/test";
import { BaseFlow } from "./base.flow";
import type { FlowContext } from "./flow-context";
import type { WorkspaceFlow } from "./workspace.flow";
export class McpClientFlow extends BaseFlow {
@@ -71,6 +71,23 @@ export interface UnitTestRunResult {
rows: UnitTestResultRow[];
}
export type WorkspaceItem =
| (Project & { kind: 'project' })
| (Collection & { kind: 'collection' })
| (McpClient & { kind: 'mcpClient' })
| (HttpRequest & { kind: 'http' })
| (GraphQLRequest & { kind: 'graphql' })
| (GrpcRequest & { kind: 'grpc' })
| (EventStreamRequest & { kind: 'eventStream' })
| (SocketIORequest & { kind: 'socketIO' })
| (WebSocketRequest & { kind: 'webSocket' });
/** The settled outcome of `WorkspaceFlow.runAllTests()`. */
export interface UnitTestRunResult {
summary: string;
rows: UnitTestResultRow[];
}
export class WorkspaceFlow extends BaseFlow {
constructor(
context: FlowContext,
@@ -75,15 +75,9 @@ export class CloudSyncFileDeletePage extends BasePage {
* backend.
*/
async deleteWorkspacePermanently(): Promise<void> {
// The radio's <input> sits under its card <label>, which intercepts
// pointer events, so click the card's heading instead and confirm the
// selection took.
await this.page
.getByRole("heading", { name: "Delete Permanently" })
.getByRole("radio", { name: "Delete Permanently" })
.click();
await expect(
this.page.getByRole("radio", { name: "Delete Permanently" }),
).toBeChecked();
await this.page.getByRole("button", { name: "Delete Workspace" }).click();
}
@@ -29,13 +29,10 @@ export class CloudSyncHistoryDialogPage extends BasePage {
* `openHistory()` to have been called first.
*/
async restoreSnapshot(message: string): Promise<void> {
const row = new TableComponent(this.page, this.historyModal.root).row(
message,
);
await row.getByRole("button", { name: "Restore" }).click();
// A dblclick can fire its 2nd click before React re-renders the
// button into its "Confirm" state, so wait for it explicitly.
await row.getByRole("button", { name: "Confirm" }).click();
await new TableComponent(this.page, this.historyModal.root)
.row(message)
.getByRole("button", { name: "Restore" })
.dblclick();
}
/**
@@ -67,13 +67,6 @@ export class CloudSyncPage extends BasePage {
const workspaceRow = this.page.getByTestId(`workspace-node-${name}`);
await expect(workspaceRow).toBeVisible({ timeout: DEFAULT_TIMEOUT });
await workspaceRow.click();
// A freshly fetched collection renders collapsed for a beat before the
// sidebar auto-expands it. Wait for that to settle, or a tree scan
// right after (e.g. `workspaceFlow.getCollection()`) clicks its Expand
// toggle mid-transition and fights the auto-expand.
await expect(workspaceRow).not.toHaveAttribute("data-expanded", "false", {
timeout: DEFAULT_TIMEOUT,
});
}
/**
@@ -41,7 +41,7 @@ export class GrpcRequestPage extends RequestPage {
*/
async commit(): Promise<void> {
await this.switchTab(MESSAGE_TAB_KEY);
await this.page.locator(this.PANE).getByRole("button", { name: /^Commit\b/ }).click();
await this.page.locator(this.PANE).getByRole("button", { name: "Commit", exact: true }).click();
}
/**
@@ -162,6 +162,6 @@ export class GrpcRequestPage extends RequestPage {
*/
async clickStream(): Promise<void> {
await this.waitForRendererIdle();
await this.page.locator(this.PANE).getByRole("button", { name: /^Stream\b/ }).click();
await this.page.locator(this.PANE).getByRole("button", { name: "Stream", exact: true }).click();
}
}
+4 -8
View File
@@ -382,14 +382,10 @@ export class SpecPage extends BasePage {
* Reads every suite name currently listed in the Test Suites sidebar.
*/
async getTestSuiteNames(): Promise<string[]> {
// Re-opening the Tests tab re-renders the list; wait for it to settle
// so a read taken mid-render doesn't return a stale or partial list.
return this.waitForStableValue(() =>
new TableComponent(
this.page,
this.page.locator(this.TEST_SUITES_LIST),
).rows.allInnerTexts(),
);
return new TableComponent(
this.page,
this.page.locator(this.TEST_SUITES_LIST),
).rows.allInnerTexts();
}
/**