2023-05-30 08:14:10 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
2023-07-13 12:05:01 +03:00
|
|
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
2023-10-27 12:06:59 +03:00
|
|
|
import { dragTo, waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
2023-05-30 08:14:10 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
|
|
|
test('drag a page from "All pages" list onto the "Trash" folder in the sidebar to move it to trash list', async ({
|
|
|
|
page,
|
|
|
|
}) => {
|
|
|
|
// TODO-Doma
|
|
|
|
// Init test db with known workspaces and open "All Pages" page via url directly
|
|
|
|
{
|
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-10-27 12:06:59 +03:00
|
|
|
await page.getByTestId('app-sidebar').getByText('All Pages').click();
|
2023-07-07 17:15:27 +03:00
|
|
|
await page.waitForTimeout(500);
|
2023-05-30 08:14:10 +03:00
|
|
|
}
|
|
|
|
|
2023-09-11 09:42:45 +03:00
|
|
|
const title = 'AFFiNE - not just a note-taking app';
|
2023-06-28 11:45:05 +03:00
|
|
|
|
2023-10-27 12:06:59 +03:00
|
|
|
await dragTo(
|
|
|
|
page,
|
|
|
|
page.locator(`[role="button"]:has-text("${title}")`),
|
|
|
|
page.getByTestId('app-sidebar').getByText('Trash')
|
|
|
|
);
|
2023-05-30 08:14:10 +03:00
|
|
|
|
|
|
|
await expect(
|
|
|
|
page.getByText('Successfully deleted'),
|
|
|
|
'A toast containing success message is shown'
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
await expect(
|
2023-06-28 11:45:05 +03:00
|
|
|
page.getByText(title),
|
2023-05-30 08:14:10 +03:00
|
|
|
'The deleted post is no longer on the All Page list'
|
|
|
|
).toHaveCount(0);
|
|
|
|
|
|
|
|
// TODO-Doma
|
|
|
|
// Visit trash page via url
|
|
|
|
await page.getByText('Trash', { exact: true }).click();
|
|
|
|
await expect(
|
2023-06-28 11:45:05 +03:00
|
|
|
page.getByText(title),
|
2023-05-30 08:14:10 +03:00
|
|
|
'The deleted post exists in the Trash list'
|
|
|
|
).toHaveCount(1);
|
|
|
|
});
|