AFFiNE/tests/affine-local/e2e/local-first-export-page.spec.ts

79 lines
2.4 KiB
TypeScript
Raw Normal View History

import { test } from '@affine-test/kit/playwright';
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
2023-09-02 08:57:04 +03:00
clickNewPageButton,
clickPageMoreActions,
getBlockSuiteEditorTitle,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import { expect } from '@playwright/test';
2023-07-13 15:41:46 +03:00
test.skip('New a page ,then open it and export html', async ({
page,
workspace,
}) => {
await openHomePage(page);
await waitForEditorLoad(page);
2023-09-02 08:57:04 +03:00
await clickNewPageButton(page);
await getBlockSuiteEditorTitle(page).click();
await page
.getByPlaceholder('Title')
.fill('this is a new page to export html content');
await page.getByTestId('all-pages').click();
const cell = page.getByRole('cell', {
name: 'this is a new page to export html content',
});
expect(cell).not.toBeUndefined();
await cell.click();
await clickPageMoreActions(page);
const exportParentBtn = page.getByRole('tooltip', {
name: 'Add to favorites Convert to Edgeless Export Delete',
});
await exportParentBtn.click();
const [download] = await Promise.all([
page.waitForEvent('download'),
page.getByRole('button', { name: 'Export to HTML' }).click(),
]);
expect(download.suggestedFilename()).toBe(
'this is a new page to export html content.html'
);
2023-07-13 15:41:46 +03:00
const currentWorkspace = await workspace.current();
2023-12-15 10:20:50 +03:00
expect(currentWorkspace.meta.flavour).toContain('local');
});
2023-07-13 15:41:46 +03:00
test.skip('New a page ,then open it and export markdown', async ({
page,
workspace,
}) => {
2023-09-02 08:57:04 +03:00
await clickNewPageButton(page);
await getBlockSuiteEditorTitle(page).click();
await page
.getByPlaceholder('Title')
.fill('this is a new page to export markdown content');
await page.getByTestId('all-pages').click();
const cell = page.getByRole('cell', {
name: 'this is a new page to export markdown content',
});
expect(cell).not.toBeUndefined();
await cell.click();
await clickPageMoreActions(page);
const exportParentBtn = page.getByRole('tooltip', {
name: 'Add to favorites Convert to Edgeless Export Delete',
});
await exportParentBtn.click();
const [download] = await Promise.all([
page.waitForEvent('download'),
page.getByRole('button', { name: 'Export to Markdown' }).click(),
]);
expect(download.suggestedFilename()).toBe(
'this is a new page to export markdown content.md'
);
2023-07-13 15:41:46 +03:00
const currentWorkspace = await workspace.current();
2023-12-15 10:20:50 +03:00
expect(currentWorkspace.meta.flavour).toContain('local');
});