test: cover share page e2e (#4126)

This commit is contained in:
Alex Yang
2023-09-02 00:57:04 -05:00
committed by GitHub
parent 8825678ca9
commit 4f97ea8a5d
27 changed files with 186 additions and 99 deletions
+16 -16
View File
@@ -1,7 +1,7 @@
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
clickNewPageButton,
getBlockSuiteEditorTitle,
newPage,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import type { Page } from '@playwright/test';
@@ -43,7 +43,7 @@ async function closeImagePreviewModal(page: Page) {
test('image preview should be shown', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
@@ -58,7 +58,7 @@ test('image preview should be shown', async ({ page }) => {
test('image go left and right', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -105,7 +105,7 @@ test('image go left and right', async ({ page }) => {
test('image able to zoom in and out with mouse scroll', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -158,7 +158,7 @@ test('image able to zoom in and out with mouse scroll', async ({ page }) => {
test('image able to zoom in and out with button click', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -204,7 +204,7 @@ test('image able to zoom in and out with button click', async ({ page }) => {
test('image should able to go left and right by buttons', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -258,7 +258,7 @@ test('image should able to go left and right by buttons', async ({ page }) => {
test('image able to fit to screen by button', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -315,7 +315,7 @@ test('image able to fit to screen by button', async ({ page }) => {
test('image able to reset zoom to 100%', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -368,7 +368,7 @@ test('image able to reset zoom to 100%', async ({ page }) => {
test('image able to copy to clipboard', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -395,7 +395,7 @@ test('image able to copy to clipboard', async ({ page }) => {
test('image able to download', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -427,7 +427,7 @@ test('image should only able to move when image is larger than viewport', async
}) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -484,7 +484,7 @@ test('image should able to delete and when delete, it will move to previous/next
}) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -559,7 +559,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
@@ -654,7 +654,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
test('keypress esc should close the modal', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
@@ -672,7 +672,7 @@ test('when mouse moves outside, the modal should be closed', async ({
}) => {
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
@@ -693,7 +693,7 @@ test('caption should be visible and different styles were applied if image zoome
const sampleCaption = 'affine owns me and all';
await openHomePage(page);
await waitForEditorLoad(page);
await newPage(page);
await clickNewPageButton(page);
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');