Skip to content

Commit c15f679

Browse files
committed
Instrument and update the E2E test for adding a non-git repostory
When adding a non-git repostory and then chossing to initialize that, the application should correcly add the project
1 parent a0621e2 commit c15f679

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

apps/desktop/src/lib/project/project.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ export function handleAddProjectOutcome(
166166
return true;
167167
case 'notAGitRepository':
168168
showToast({
169+
testId: TestId.AddProjectNotAGitRepoModal,
169170
title: 'Not a Git repository',
170171
message:
171172
'The selected directory is not a Git repository. Would you like to initialize one?',
172173
style: 'warning',
173174
extraAction: {
175+
testId: TestId.AddProjectNotAGitRepoModalInitializeButton,
174176
label: 'Initialize Repository',
175177
onClick: async (dismiss) => {
176178
const projectPath = outcome.subject.path;

e2e/playwright/tests/addingAProject.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ test('should handle gracefully adding a non-git directory', async ({ page, conte
9696
await fileChooser.setFiles(projectPath);
9797

9898
await waitForTestId(page, 'add-project-not-a-git-repo-modal');
99+
// Click it in order to close the select dropdown behind
100+
await clickByTestId(page, 'add-project-not-a-git-repo-modal', true);
101+
102+
await clickByTestId(page, 'add-project-not-a-git-repo-modal-initialize-button');
103+
104+
await waitForTestId(page, 'workspace-view');
99105
});
100106

101107
test('should handle adding a project with extra commit and uncommitted changes on main branch', async ({

packages/ui/src/lib/utils/testIds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export enum TestId {
137137
AddProjectBareRepoModal = 'add-project-bare-repo-modal',
138138
AddProjectNoDotGitDirectoryModal = 'add-project-no-dot-git-directory-modal',
139139
AddProjectNotAGitRepoModal = 'add-project-not-a-git-repo-modal',
140+
AddProjectNotAGitRepoModalInitializeButton = 'add-project-not-a-git-repo-modal-initialize-button',
140141
ChromeHeaderProjectSelector = 'chrome-header-project-selector',
141142
ChromeHeaderProjectSelectorAddLocalProject = 'chrome-header-project-selector-add-local-project',
142143
ChromeSideBarProjectSettingsButton = 'chrome-sidebar-project-settings-button',

0 commit comments

Comments
 (0)