Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/master' }}
- name: Build dependencies
run: |
pnpm --filter @gitbutler/ui package
pnpm --filter @gitbutler/but-sdk build:napi
cargo build -p but
# Ubuntu restricts the user namespaces used by unpackaged Chromium builds. Configure
Expand Down
11 changes: 6 additions & 5 deletions apps/lite/e2e/tests/onboarding.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import { LiteTestId } from "../../ui/src/testIds.ts";
import { expect, test } from "../test.ts";
import { assertHeadBranch } from "../utils.ts";

Expand All @@ -19,14 +19,15 @@ test("adds a local repository without changing its branch", async ({
}, repositoryPath);

await expect(appWindow.getByTestId(LiteTestId.OnboardingPage)).toBeVisible();
await appWindow.getByTestId(LiteTestId.OnboardingAddLocalProjectButton).click();
await appWindow.getByRole("button", { name: "Add local repository" }).click();

await expect(appWindow.getByTestId(/project=.*:workspace/)).toBeVisible();
await expect(appWindow.getByTestId(LiteTestId.ProjectPickerButton)).toBeVisible();
const projectPicker = appWindow.getByRole("button", { name: /Select project/ });
await expect(projectPicker).toBeVisible();

await appWindow.getByTestId(LiteTestId.ProjectPickerButton).click();
await projectPicker.click();
await expect(appWindow.getByRole("option", { name: /onboarding-repository/i })).toBeVisible();
await expect(appWindow.getByTestId(LiteTestId.ProjectPickerAddLocalProjectButton)).toBeVisible();
await expect(appWindow.getByRole("button", { name: "Add local repository" })).toBeVisible();

assertHeadBranch(repositoryPath, initialBranch);
});
12 changes: 5 additions & 7 deletions apps/lite/e2e/tests/projects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from "node:path";
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import { expect, test } from "../test.ts";

test.use({ scenario: "project-with-additional-repository.sh" });
Expand All @@ -16,12 +15,11 @@ test("navigates to a project added from the project picker", async ({
}, repositoryPath);

await expect(appWindow.getByTestId(/project=.*:workspace/)).toBeVisible();
await expect(appWindow.getByTestId(LiteTestId.ProjectPickerButton)).toContainText("local-clone");
const projectPicker = appWindow.getByRole("button", { name: /Select project/ });
await expect(projectPicker).toContainText("local-clone");

await appWindow.getByTestId(LiteTestId.ProjectPickerButton).click();
await appWindow.getByTestId(LiteTestId.ProjectPickerAddLocalProjectButton).click();
await projectPicker.click();
await appWindow.getByRole("button", { name: "Add local repository" }).click();

await expect(appWindow.getByTestId(LiteTestId.ProjectPickerButton)).toContainText(
"additional-repository",
);
await expect(projectPicker).toContainText("additional-repository");
});
4 changes: 2 additions & 2 deletions apps/lite/e2e/tests/start.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import { LiteTestId } from "../../ui/src/testIds.ts";
import { expect, test } from "../test.ts";

test("starts without configured projects", async ({ appWindow }) => {
Expand All @@ -11,7 +11,7 @@ test.describe("with a seeded project", () => {

test("opens the project and navigates between views", async ({ appWindow }) => {
await expect(appWindow).toHaveURL(/\/project\/[^/]+\/workspace$/);
await expect(appWindow.getByTestId(LiteTestId.ProjectPickerButton)).toBeVisible();
await expect(appWindow.getByRole("button", { name: /Select project/ })).toBeVisible();

const pages = appWindow.getByRole("group", { name: "Pages" });
await pages.getByRole("button", { name: "Branches" }).click();
Expand Down
1 change: 0 additions & 1 deletion apps/lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
"@base-ui/utils": "^0.3.1",
"@gitbutler/but-sdk": "workspace:*",
"@gitbutler/design-core": "3.12.4",
"@gitbutler/ui": "workspace:*",
"@pierre/diffs": "^1.3.5",
"@pierre/theming": "^1.0.1",
"@reduxjs/toolkit": "catalog:redux",
Expand Down
4 changes: 1 addition & 3 deletions apps/lite/ui/src/components/AddProjectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import type { FC } from "react";
import { getButtonClassName, type ButtonSize } from "#ui/components/Button.tsx";

type Props = {
testId: string;
size?: ButtonSize;
isPending: boolean;
onClick: () => void;
};

export const AddProjectButton: FC<Props> = ({ testId, size, isPending, onClick }) => (
export const AddProjectButton: FC<Props> = ({ size, isPending, onClick }) => (
<button
type="button"
className={getButtonClassName({ size })}
data-testid={testId}
disabled={isPending}
onClick={onClick}
>
Expand Down
8 changes: 2 additions & 6 deletions apps/lite/ui/src/routes/IndexPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import type { FC } from "react";
import { AddProjectButton } from "#ui/components/AddProjectButton.tsx";
import { useAddLocalRepository } from "#ui/components/useAddLocalRepository.ts";
import { LiteTestId } from "#ui/testIds.ts";
import styles from "./IndexPage.module.css";

export const IndexPage: FC = () => {
Expand All @@ -11,11 +11,7 @@ export const IndexPage: FC = () => {
<section className={styles.page} data-testid={LiteTestId.OnboardingPage}>
<h1>Welcome to GitButler Lite</h1>
<p>Add a local Git repository to get started.</p>
<AddProjectButton
testId={LiteTestId.OnboardingAddLocalProjectButton}
isPending={isPending}
onClick={() => void addLocalRepository()}
/>
<AddProjectButton isPending={isPending} onClick={() => void addLocalRepository()} />
</section>
);
};
2 changes: 0 additions & 2 deletions apps/lite/ui/src/routes/project/$id/workspace/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { globalHotkeys, workspaceHotkeys } from "#ui/hotkeys.ts";
import { writeLastOpenedProject } from "#ui/project.ts";
import { useAppDispatch, useAppSelector } from "#ui/store.ts";
import type { ProjectForFrontend, RefInfo } from "@gitbutler/but-sdk";
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import { useHotkey, useHotkeys, type UseHotkeyDefinition } from "@tanstack/react-hotkeys";
import {
QueryErrorResetBoundary,
Expand Down Expand Up @@ -349,7 +348,6 @@ const ProjectPicker: FC<ProjectPickerProps> = (p) => {
emptyLabel="No projects found."
footerAction={
<AddProjectButton
testId={LiteTestId.ProjectPickerAddLocalProjectButton}
size="small"
isPending={p.isAddingProject}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TopLeftControls } from "#ui/routes/project/$id/workspace/TopLeftControl
import { formatRelativeTime } from "#ui/time.ts";
import { Button, Tooltip } from "@base-ui/react";
import type { ProjectForFrontend } from "@gitbutler/but-sdk";
import { LiteTestId } from "@gitbutler/ui/utils/testIds";
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
import { Match } from "effect";
import { type FC, useState } from "react";
Expand Down Expand Up @@ -94,7 +93,6 @@ export const SidebarHeader: FC<{
<Tooltip.Root>
<Tooltip.Trigger
aria-label={`${globalHotkeys.selectProject.meta.name} (current: ${p.project.title})`}
data-testid={LiteTestId.ProjectPickerButton}
className={classes(
getButtonClassName({ variant: "ghost" }),
"text-15",
Expand Down
3 changes: 3 additions & 0 deletions apps/lite/ui/src/testIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const LiteTestId = {
OnboardingPage: "lite-onboarding-page",
} as const;
7 changes: 0 additions & 7 deletions packages/ui/src/lib/utils/testIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,6 @@ export enum TestId {
DiscardFileChangesConfirmationModal_Discard = "discard-file-changes-confirmation-modal-discard",
}

export enum LiteTestId {
OnboardingPage = "lite-onboarding-page",
OnboardingAddLocalProjectButton = "lite-onboarding-add-local-project-button",
ProjectPickerButton = "lite-project-picker-button",
ProjectPickerAddLocalProjectButton = "lite-project-picker-add-local-project-button",
}

export enum ElementId {
NewBranchNameInput = "new-branch-name-input",
SnapshotDescriptionInput = "snapshot-description-input",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading