Fix commit listing, adding new commits to list instead of replacing

This commit is contained in:
Sebastian Martinez
2024-07-23 15:43:15 +02:00
committed by Rūdolfs Ošiņš
parent cbb6c557be
commit 7a5d4566d3
7 changed files with 37 additions and 9 deletions
+3
View File
@@ -11,6 +11,9 @@
"__format": "json"
}
},
"source": {
"commitsPerPage": "COMMITS_PER_PAGE"
},
"supportWebsite": "SUPPORT_WEBSITE",
"fallbackPreferredSeed": {
"__name": "FALLBACK_PREFERRED_SEED",
+3
View File
@@ -16,6 +16,9 @@
}
]
},
"source": {
"commitsPerPage": 30
},
"supportWebsite": "https://radicle.zulipchat.com",
"fallbackPreferredSeed": {
"hostname": "seed.radicle.garden",
Vendored
+3
View File
@@ -10,6 +10,9 @@ declare module "virtual:*" {
defaultHttpdScheme: string;
pinned: { baseUrl: BaseUrl }[];
};
source: {
commitsPerPage: number;
};
reactions: string[];
supportWebsite: string;
fallbackPreferredSeed: BaseUrl;
+13 -4
View File
@@ -82,10 +82,19 @@ const config: PlaywrightTestConfig = {
},
],
webServer: {
command: "npm run start -- --strictPort --port 3001",
port: 3001,
},
webServer: [
{
command: "npm run start -- --strictPort --port 3001",
port: 3001,
},
// Required by test tests/e2e/project/commits.spec.ts "loading more commits, adds them to the commits list"
{
command: "npm run start -- --strictPort --port 3002",
port: 3002,
// eslint-disable-next-line @typescript-eslint/naming-convention
env: { COMMITS_PER_PAGE: "4" },
},
],
};
export default config;
+3 -3
View File
@@ -9,7 +9,7 @@
} from "@http-client";
import type { ProjectRoute } from "./router";
import { COMMITS_PER_PAGE } from "./router";
import config from "virtual:config";
import { HttpdClient } from "@http-client";
import { baseUrlToString } from "@app/lib/utils";
import { groupCommits } from "@app/lib/commit";
@@ -58,9 +58,9 @@
const response = await api.project.getAllCommits(project.id, {
parent: allCommitHeaders[0].id,
page,
perPage: COMMITS_PER_PAGE,
perPage: config.source.commitsPerPage,
});
allCommitHeaders = response;
allCommitHeaders = [...allCommitHeaders, ...response];
} catch (e) {
error = e;
}
+1 -2
View File
@@ -29,7 +29,6 @@ import { handleError, unreachableError } from "@app/views/projects/error";
import { HttpdClient } from "@http-client";
import { ResponseError, ResponseParseError } from "@http-client/lib/fetcher";
export const COMMITS_PER_PAGE = 30;
export const PATCHES_PER_PAGE = 10;
export const ISSUES_PER_PAGE = 10;
@@ -524,7 +523,7 @@ async function loadHistoryView(
await api.project.getAllCommits(project.id, {
parent: commitId,
page: 0,
perPage: COMMITS_PER_PAGE,
perPage: config.source.commitsPerPage,
}),
]);
+11
View File
@@ -87,6 +87,17 @@ test("peer and branch switching", async ({ page }) => {
}
});
test("loading more commits, adds them to the commits list", async ({
page,
}) => {
await page.goto(`http://localhost:3002${sourceBrowsingUrl}`);
await page.getByRole("button", { name: "Commits" }).click();
await expect(page.locator("div > div > .teaser")).toHaveCount(4);
await page.getByRole("button", { name: "More" }).click();
await expect(page.locator("div > div > .teaser")).toHaveCount(8);
});
test("commit messages with double colon not converted into single colon", async ({
page,
}) => {