Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushAgrawal-A2 committed Jan 23, 2024
1 parent e66aded commit 022306f
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions tests/attachment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function getAttachment(page: Page) {
};

const getName = () =>
attachment.locator('.affine-attachment-name').innerText();
attachment.locator('.affine-attachment-content-title-text').innerText();

return {
// locators
Expand All @@ -82,7 +82,8 @@ function getAttachment(page: Page) {
*/
waitLoading: () => loading.waitFor({ state: 'hidden' }),
getName,
getSize: () => attachment.locator('.affine-attachment-desc').innerText(),
getSize: () =>
attachment.locator('.affine-attachment-content-info').innerText(),

turnToEmbed: async () => {
await expect(turnToEmbedBtn).toBeVisible();
Expand Down Expand Up @@ -151,9 +152,12 @@ test('can insert attachment from slash menu', async ({ page }) => {
>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
</affine:note>`,
Expand Down Expand Up @@ -193,9 +197,12 @@ test('should undo/redo works for attachment', async ({ page }) => {
>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
</affine:note>`,
Expand Down Expand Up @@ -252,9 +259,12 @@ test('should undo/redo works for attachment', async ({ page }) => {
>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
</affine:note>`,
Expand Down Expand Up @@ -368,9 +378,12 @@ test('should turn attachment to image works', async ({ page }) => {
<affine:attachment
prop:caption=""
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
</affine:note>`,
Expand Down Expand Up @@ -453,9 +466,12 @@ test(`support dragging attachment block directly`, async ({ page }) => {
>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
</affine:note>`,
Expand Down Expand Up @@ -504,9 +520,12 @@ test(`support dragging attachment block directly`, async ({ page }) => {
>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
<affine:paragraph
Expand All @@ -528,13 +547,8 @@ test(`support dragging attachment block directly`, async ({ page }) => {
// drag bookmark block
await page.mouse.move(rect.x + 20, rect.y + 20);
await page.mouse.down();
await page.waitForTimeout(200);

await page.mouse.move(rect.x + 40, rect.y + rect.height + 80);
await page.waitForTimeout(200);

await page.mouse.move(rect.x + 40, rect.y + rect.height + 80, { steps: 20 });
await page.mouse.up();
await page.waitForTimeout(200);

const rects = page.locator('affine-block-selection');
await expect(rects).toHaveCount(1);
Expand Down Expand Up @@ -568,9 +582,12 @@ test(`support dragging attachment block directly`, async ({ page }) => {
/>
<affine:attachment
prop:embed={false}
prop:index="a0"
prop:name="${FILE_NAME}"
prop:rotate={0}
prop:size={${FILE_SIZE}}
prop:sourceId="${FILE_ID}"
prop:style="horizontalThin"
prop:type="image/png"
/>
<affine:paragraph
Expand Down

0 comments on commit 022306f

Please sign in to comment.