Skip to content

Commit

Permalink
feat: disable editor blank correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Oct 28, 2024
1 parent 80828d6 commit 342a778
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
18 changes: 9 additions & 9 deletions packages/frontend/i18n/src/i18n-completenesses.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"ar": 86,
"ar": 85,
"ca": 6,
"da": 7,
"de": 32,
"da": 6,
"de": 31,
"en": 100,
"es-AR": 15,
"es-CL": 18,
"es-CL": 17,
"es": 15,
"fr": 77,
"fr": 75,
"hi": 2,
"it": 1,
"ja": 100,
"ko": 91,
"ko": 89,
"pl": 0,
"pt-BR": 99,
"ru": 84,
"pt-BR": 97,
"ru": 83,
"sv-SE": 5,
"ur": 3,
"zh-Hans": 99,
"zh-Hant": 99
"zh-Hant": 97
}
23 changes: 11 additions & 12 deletions tests/affine-cloud/e2e/copilot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ test.describe('chat with block', () => {
return answer.getAttribute('src');
};

const disableEditorBlank = async (page: Page) => {
// hide blank element, this may block the click
const blank = page.getByTestId('.page-editor-blank');
if (await blank.isVisible()) {
await blank.evaluate(node => (node.style.userSelect = 'none'));
}
};

test.describe('chat with text', () => {
const pasteTextToPageEditor = async (page: Page, content: string) => {
await focusToEditor(page);
Expand Down Expand Up @@ -418,10 +426,7 @@ test.describe('chat with block', () => {
];
for (const option of options) {
test(option, async ({ page }) => {
// hide blank element, this may block the click
await page
.getByTestId('.page-editor-blank')
.evaluate(node => (node.style.userSelect = 'none'));
await disableEditorBlank(page);
await page
.waitForSelector(
`.ai-item-${option.replaceAll(' ', '-').toLowerCase()}`
Expand Down Expand Up @@ -460,10 +465,7 @@ test.describe('chat with block', () => {

test.describe('page mode', () => {
test.beforeEach(async ({ page }) => {
// hide blank element, this may block the click
await (
await page.waitForSelector('.page-editor-blank')
).evaluate(node => (node.style.userSelect = 'none'));
await disableEditorBlank(page);
await page.waitForSelector('affine-image').then(i => i.click());
await page
.waitForSelector('affine-image editor-toolbar ask-ai-button')
Expand Down Expand Up @@ -526,10 +528,7 @@ test.describe('chat with block', () => {
note.click();
}

// hide blank element, this may block the click
await (
await page.waitForSelector('.page-editor-blank')
).evaluate(node => (node.style.userSelect = 'none'));
await disableEditorBlank(page);
await page.waitForSelector('affine-image').then(i => i.click());
await page
.waitForSelector('affine-image editor-toolbar ask-ai-button')
Expand Down

0 comments on commit 342a778

Please sign in to comment.