fix(test): impove test stability of git repository relocation tests (#10436)

* fix(test): ensure scoped selection for storage type and improve click reliability in project creation

* fix(test): expand shard matrix for smoke tests and repeat each test for git-local-repos

* fix(test): adjust shard matrix for smoke tests to match total shards

* fix(test): update shard matrix for smoke tests to include additional runs

* fix(test): update smoke test sharding to improve parallel execution and reliability

* fix(test): update smoke test configuration for improved execution and reporting

* fix(test): update smoke test configuration to use sharding for improved execution

* fix(test): refactor git repository relocation tests to use dedicated method for moving repositories
This commit is contained in:
Bob Qiu authored and GitHub committed 2026-08-24 16:26:52 +08:00
1 parent 3e83fe2768
commit 89df8f6a84
2 files changed
+15 -5

No files matched your search

@@ -229,7 +229,7 @@ export class ProjectPage extends BasePage {
await this.page.getByRole('textbox', { name: 'Project name' }).click();
await this.page.getByRole('textbox', { name: 'Project name' }).press('ControlOrMeta+a');
await this.page.getByRole('textbox', { name: 'Project name' }).fill(name);
await this.page.getByText('Git Sync').click();
await this.selectStorageType('git');
await this.page.getByRole('button', { name: 'Git Credentials Authorized as' }).click();
await this.page.getByRole('option', { name: 'Custom Git Credential' }).click();
await this.page.getByRole('textbox', { name: 'Repository URL' }).click();
@@ -249,7 +249,7 @@ export class ProjectPage extends BasePage {
await this.page.getByRole('textbox', { name: 'Project name' }).click();
await this.page.getByRole('textbox', { name: 'Project name' }).press('ControlOrMeta+a');
await this.page.getByRole('textbox', { name: 'Project name' }).fill(name);
await this.page.getByText('Git Sync').click();
await this.selectStorageType('git');
// The credential select defaults to whichever credential is first (which can be
// the "System Git Credentials" native provider). Open it via its stable label and
// explicitly pick the custom Access Token credential rather than relying on the default.
@@ -286,6 +286,16 @@ export class ProjectPage extends BasePage {
await this.sidebar.selectProject(name);
}
/**
* Clicks "Move repository to another folder" in the project settings modal.
* Chains right after that modal opens (which itself follows the "Create or
* update dialog" from createGitSyncProject closing) - same stale-backdrop
* race as chooseGitProjectFolderForOpen(), so this needs the same guard.
*/
async moveRepositoryToAnotherFolder(): Promise<void> {
await this.clickReliably(this.page.getByRole('button', { name: 'Move repository to another folder' }));
}
// ===========================================================================
// Import Operations
// ===========================================================================
@@ -38,7 +38,7 @@ test.describe('Git repository relocation', () => {
await openProjectSettingsModal(insomnia, GIT_PROJECT_NAME);
await mockOpenDialogForDirectory(insomnia.app, destDir);
await page.getByRole('button', { name: 'Move repository to another folder' }).click();
await insomnia.projectPage.moveRepositoryToAnotherFolder();
// Path display updates immediately from the action result (before the loader revalidates).
await expect.soft(page.getByTitle(destDir)).toBeVisible({ timeout: 30_000 });
@@ -63,7 +63,7 @@ test.describe('Git repository relocation', () => {
await openProjectSettingsModal(insomnia, GIT_PROJECT_NAME);
await mockOpenDialogForDirectory(insomnia.app, destDir);
await page.getByRole('button', { name: 'Move repository to another folder' }).click();
await insomnia.projectPage.moveRepositoryToAnotherFolder();
await expect.soft(page.getByTitle(destDir)).toBeVisible({ timeout: 30_000 });
await expect.soft(page.getByText(/Repository moved to/i)).toBeVisible({ timeout: 15_000 });
@@ -85,7 +85,7 @@ test.describe('Git repository relocation', () => {
await openProjectSettingsModal(insomnia, GIT_PROJECT_NAME);
await mockOpenDialogForDirectory(insomnia.app, destDir);
await page.getByRole('button', { name: 'Move repository to another folder' }).click();
await insomnia.projectPage.moveRepositoryToAnotherFolder();
// Error banner text matches relocateGitRepoAction's non-empty/non-git message.
await expect.soft(page.getByText(/isn't a git repository/i)).toBeVisible({ timeout: 15_000 });