feat(core): unused blob management in settings (#9795)

fix AF-2144, PD-2064, PD-2065, PD-2066
This commit is contained in:
pengx17
2025-01-23 07:12:16 +00:00
parent 8021b89944
commit 6ac6a8d6d6
26 changed files with 846 additions and 30 deletions
+61
View File
@@ -0,0 +1,61 @@
import { test } from '@affine-test/kit/playwright';
import {
createRandomUser,
deleteUser,
enableCloudWorkspace,
loginUser,
} from '@affine-test/kit/utils/cloud';
import { clickSideBarAllPageButton } from '@affine-test/kit/utils/sidebar';
import { expect } from '@playwright/test';
let user: {
id: string;
name: string;
email: string;
password: string;
};
test.beforeEach(async ({ page }) => {
user = await createRandomUser();
await loginUser(page, user);
});
test.afterEach(async () => {
// if you want to keep the user in the database for debugging,
// comment this line
await deleteUser(user.email);
});
test('should show blob management dialog', async ({ page }) => {
await enableCloudWorkspace(page);
await clickSideBarAllPageButton(page);
// delete the welcome page ('Write, draw, plan all at once.')
await page
.getByTestId('page-list-item')
.filter({
has: page.getByText('Write, draw, plan all at once.'),
})
.getByTestId('page-list-operation-button')
.click();
const deleteBtn = page.getByTestId('move-to-trash');
await deleteBtn.click();
await expect(page.getByText('Delete doc?')).toBeVisible();
await page.getByRole('button', { name: 'Delete' }).click();
await page.getByTestId('slider-bar-workspace-setting-button').click();
await expect(page.getByTestId('setting-modal')).toBeVisible();
await page.getByTestId('workspace-setting:storage').click();
await expect(page.getByTestId('blob-preview-card')).toHaveCount(3);
await expect(page.getByText('Unused blobs (3)')).toBeVisible();
await page.getByTestId('blob-preview-card').nth(0).click();
await expect(page.getByText('1 Selected')).toBeVisible();
await page.getByRole('button', { name: 'Delete' }).click();
await expect(page.getByText('Delete blob files')).toBeVisible();
await page.getByRole('button', { name: 'Delete' }).click();
await expect(page.getByText('Unused blobs (2)')).toBeVisible();
});
@@ -95,6 +95,8 @@ test('export then add', async ({ page, appInfo, workspace }) => {
// check its name is correct
await expect(page.getByTestId('workspace-name')).toHaveText(newWorkspaceName);
await page.waitForTimeout(1000);
// find button which has the title "test1"
await page.getByText('test1').click();