diff --git a/apps/client-web/src/routes/accounts/sign-in.tsx b/apps/client-web/src/routes/accounts/sign-in.tsx index b79e0e3ab..38cc41acd 100644 --- a/apps/client-web/src/routes/accounts/sign-in.tsx +++ b/apps/client-web/src/routes/accounts/sign-in.tsx @@ -38,13 +38,13 @@ export const SignIn: React.FC = () => { ) : ( ) } diff --git a/tools/e2e-testing/fixtures/extends/coverage.fixture.ts b/tools/e2e-testing/fixtures/extends/coverage.fixture.ts index 59b11a9fe..942ecb774 100644 --- a/tools/e2e-testing/fixtures/extends/coverage.fixture.ts +++ b/tools/e2e-testing/fixtures/extends/coverage.fixture.ts @@ -1,15 +1,11 @@ import * as fs from 'fs' import * as path from 'path' -import * as crypto from 'crypto' import { BrowserContext } from '@playwright/test' import { FixtureReturnType } from '@/helpers/types/fixture.types' +import { generateUUID } from '@/helpers/utils/uuid' const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output') -export function generateUUID(): string { - return crypto.randomBytes(16).toString('hex') -} - export function coverageFixture(): FixtureReturnType { return async ({ context }, use): Promise => { await context.addInitScript(() => diff --git a/tools/e2e-testing/helpers/api/BlockApi.ts b/tools/e2e-testing/helpers/api/BlockApi.ts index b52d69bef..0775c9300 100644 --- a/tools/e2e-testing/helpers/api/BlockApi.ts +++ b/tools/e2e-testing/helpers/api/BlockApi.ts @@ -1,5 +1,5 @@ -import { blockSyncBatchConverter } from '@/helpers/converter/blockSyncBatchConverter' -import { Page } from '@playwright/test' +import { blockCommitConverter } from '@/helpers/converter/blockCommitConverter' +import { APIResponse, Page } from '@playwright/test' import { createBlockConverter } from '@/helpers/converter/createBlockConverter' import { PageBlock } from '@/helpers/types/data.types' import { GRAPHQL_GROUP } from './graphql' @@ -27,10 +27,18 @@ export class BlockApi { } } + async getUsername(): Promise { + return await this.page.evaluate(() => (window as any).location.pathname.split('/')[1]) + } + async pageReload(): Promise { await this.page.reload({ waitUntil: 'networkidle' }) } + async post(options: OptionsType): Promise { + return await this.request.post(this.REQUEST_URL, options) + } + options(gqlQuery: string, operationName: OperationName, variables: InputType): OptionsType { return { data: { @@ -42,29 +50,25 @@ export class BlockApi { } } - async getBlocks(domain: string): Promise { - const response = await this.request.post( - this.REQUEST_URL, + async getBlocks(username: string): Promise { + const response = await this.post( this.options(GRAPHQL_GROUP.GET_PAGE_BLOCKS, 'GetPageBlocks', { - domain + domain: username }) ) return (await response.json()).data.pageBlocks } async removePage(variables: BlockSoftDeleteInput): Promise { - await this.request.post( - this.REQUEST_URL, - this.options(GRAPHQL_GROUP.BLOCK_SOFT_DELETE, 'blockSoftDelete', variables) - ) + await this.post(this.options(GRAPHQL_GROUP.BLOCK_SOFT_DELETE, 'blockSoftDelete', variables)) } async removeAllPages(options?: { isHardDeleted?: boolean; isSorted?: boolean }): Promise { const isHardDeleted = options?.isHardDeleted ?? true const isSorted = options?.isSorted ?? false - const domain = await this.page.evaluate(() => (window as any).location.pathname.split('/')[1]) - const pages = (await this.getBlocks(domain)).sort(compareAttributeItem) + const username = await this.getUsername() + const pages = (await this.getBlocks(username)).sort(compareAttributeItem) isSorted ? await this.orderRemoveAllPage(pages, isHardDeleted) @@ -90,8 +94,9 @@ export class BlockApi { } async createPage(page: PageBlock, parentId?: string): Promise { - const id = await this.createPageApi(createBlockConverter(page, parentId)) - await this.blockSyncBatch(page, id) + const username = await this.getUsername() + const id = await this.createPageApi(createBlockConverter(page, username, parentId)) + await this.blockCommit(page, id) if (page.children) { for (const child of page.children) { await this.createPage(child, id) @@ -106,23 +111,19 @@ export class BlockApi { } async createPageApi(variables: CreateBlockInput): Promise { - const response = await this.request.post( - this.REQUEST_URL, - this.options(GRAPHQL_GROUP.CREATE_BLOCK, 'blockCreate', variables) - ) + const response = await this.post(this.options(GRAPHQL_GROUP.CREATE_BLOCK, 'blockCreate', variables)) return (await response.json()).data.blockCreate.id } - async blockSyncBatch(page: PageBlock, id: string): Promise { - const variables = blockSyncBatchConverter(page, id) - await this.request.post(this.REQUEST_URL, this.options(GRAPHQL_GROUP.BLOCK_SYNC_BATCH, 'blockSyncBatch', variables)) + async blockCommit(page: PageBlock, id: string): Promise { + const variables = blockCommitConverter(page, id) + await this.post(this.options(GRAPHQL_GROUP.BLOCK_COMMIT, 'blockCommit', variables)) } - async getTrashBlock(domain: string, search: string = ''): Promise { - const response = await this.request.post( - this.REQUEST_URL, + async getTrashBlock(username: string, search: string = ''): Promise { + const response = await this.post( this.options(GRAPHQL_GROUP.GET_TRASH_BLOCKS, 'GetTrashBlocks', { - domain, + domain: username, search }) ) @@ -130,12 +131,9 @@ export class BlockApi { } async removeAllTrashPages(): Promise { - const domain = await this.page.evaluate(() => (window as any).location.pathname.split('/')[1]) - const pages = (await this.getTrashBlock(domain)).map(page => page.id) + const username = await this.getUsername() + const pages = (await this.getTrashBlock(username)).map(page => page.id) - await this.request.post( - this.REQUEST_URL, - this.options(GRAPHQL_GROUP.BLOCK_HARD_DELETE, 'blockHardDelete', { input: { ids: pages } }) - ) + await this.post(this.options(GRAPHQL_GROUP.BLOCK_HARD_DELETE, 'blockHardDelete', { input: { ids: pages } })) } } diff --git a/tools/e2e-testing/helpers/api/graphql.ts b/tools/e2e-testing/helpers/api/graphql.ts index 86dcc5e80..da780fed2 100644 --- a/tools/e2e-testing/helpers/api/graphql.ts +++ b/tools/e2e-testing/helpers/api/graphql.ts @@ -1,9 +1,9 @@ import { graphqlGroupType } from '@/helpers/types/graphql.types' export const GRAPHQL_GROUP: graphqlGroupType = { - BLOCK_SYNC_BATCH: ` - mutation blockSyncBatch($input: BlockSyncBatchInput!) { - blockSyncBatch(input: $input) { + BLOCK_COMMIT: ` + mutation blockCommit($input: BlockCommitInput!) { + blockCommit(input: $input) { errors __typename } @@ -31,7 +31,9 @@ export const GRAPHQL_GROUP: graphqlGroupType = { pageBlocks(domain: $domain) { id parentId - text + documentInfo { + title + } } } `, diff --git a/tools/e2e-testing/helpers/converter/blockCommitConverter.ts b/tools/e2e-testing/helpers/converter/blockCommitConverter.ts new file mode 100644 index 000000000..7e03639e9 --- /dev/null +++ b/tools/e2e-testing/helpers/converter/blockCommitConverter.ts @@ -0,0 +1,33 @@ +import { BlockCommitInput } from '@/helpers/types/graphql.types' +import { PageBlock } from '@/helpers/types/data.types' +import { generateUUID } from '@/helpers/utils/uuid' + +export function blockCommitConverter(page: PageBlock, id: string): BlockCommitInput { + return { + input: { + documentId: id, + blockId: id, + // hard code temporary until backend be fixed + operatorId: '54701a5a-f151-499f-8cc3-069950144ad3', + stateType: 'full', + state: page.state ?? '', + stateId: generateUUID(), + statesCount: 1, + meta: { + title: page.title, + icon: page.icon + ? { + __typename: 'BlockEmoji', + type: 'EMOJI', + name: page.icon.name, + emoji: page.icon.emoji + } + : undefined + }, + content: { + type: 'doc', + content: [] + } + } + } +} diff --git a/tools/e2e-testing/helpers/converter/blockSyncBatchConverter.ts b/tools/e2e-testing/helpers/converter/blockSyncBatchConverter.ts deleted file mode 100644 index 67261fe0e..000000000 --- a/tools/e2e-testing/helpers/converter/blockSyncBatchConverter.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Block, BlockSyncBatchInput } from '@/helpers/types/graphql.types' -import { PageBlock } from '@/helpers/types/data.types' - -export function blockSyncBatchConverter(page: PageBlock, id: string): BlockSyncBatchInput { - return { - input: { - blocks: blockConverter(page, id), - deletedIds: [], - rootId: id, - // hard code temporary until backend be fixed - operatorId: '54701a5a-f151-499f-8cc3-069950144ad3' - } - } -} - -function blockConverter(page: PageBlock, id: string): Block[] { - return [ - { - content: [], - id, - text: page.title, - type: 'doc', - meta: { - title: page.title, - icon: page.icon - ? { - type: 'EMOJI', - name: page.icon.name, - emoji: page.icon.emoji, - __typename: 'BlockEmoji' - } - : undefined, - link: null, - __typename: 'BlockMeta' - }, - data: {} - } - ] -} diff --git a/tools/e2e-testing/helpers/converter/createBlockConverter.ts b/tools/e2e-testing/helpers/converter/createBlockConverter.ts index df9bc9f63..9606d2184 100644 --- a/tools/e2e-testing/helpers/converter/createBlockConverter.ts +++ b/tools/e2e-testing/helpers/converter/createBlockConverter.ts @@ -1,11 +1,12 @@ import { CreateBlockInput } from '@/helpers/types/graphql.types' import { PageBlock } from '@/helpers/types/data.types' -export function createBlockConverter(page: PageBlock, parentId?: string): CreateBlockInput { +export function createBlockConverter(page: PageBlock, username: string, parentId?: string): CreateBlockInput { return { input: { parentId, - title: page.title + title: page.title, + username } } } diff --git a/tools/e2e-testing/helpers/types/data.types.ts b/tools/e2e-testing/helpers/types/data.types.ts index ebb14c313..c1dcddcfe 100644 --- a/tools/e2e-testing/helpers/types/data.types.ts +++ b/tools/e2e-testing/helpers/types/data.types.ts @@ -1,7 +1,9 @@ export interface PageBlock { id?: string title: string - // find in packages/uploader/src/Dashboard/data-by-group.json + // Find in packages/uploader/src/Dashboard/data-by-group.json icon?: { name: string; emoji: string } children?: PageBlock[] + // In dev environment, generated by window.debugDumpDocumentState() + state?: string } diff --git a/tools/e2e-testing/helpers/types/graphql.types.ts b/tools/e2e-testing/helpers/types/graphql.types.ts index 7ab62b815..b52c7847e 100644 --- a/tools/e2e-testing/helpers/types/graphql.types.ts +++ b/tools/e2e-testing/helpers/types/graphql.types.ts @@ -20,15 +20,33 @@ export interface Block { export interface PageType { id: string parentId: string - text: string + documentInfo: { + title: string + } } -export interface BlockSyncBatchInput { +export interface BlockCommitInput { input: { - blocks: Block[] - deletedIds: [] - rootId: string + documentId: string + blockId: string operatorId: '54701a5a-f151-499f-8cc3-069950144ad3' + stateType: 'full' + state: string + stateId: string + statesCount: 1 + meta: { + title: string + icon?: { + __typename: 'BlockEmoji' + type: 'EMOJI' + name: string + emoji: string + } + } + content: { + type: 'doc' + content: [] + } } } @@ -36,6 +54,7 @@ export interface CreateBlockInput { input: { parentId?: string title: string + username: string } } @@ -64,7 +83,7 @@ export interface GetTrashBlocksInput { export type OperationName = | 'GetPageBlocks' | 'GetTrashBlocks' - | 'blockSyncBatch' + | 'blockCommit' | 'blockCreate' | 'blockSoftDelete' | 'blockHardDelete' @@ -72,13 +91,13 @@ export type OperationName = export type InputType = | GetPageBlocksInput | GetTrashBlocksInput - | BlockSyncBatchInput + | BlockCommitInput | CreateBlockInput | BlockSoftDeleteInput | BlockHardDeleteInput export interface graphqlGroupType { - BLOCK_SYNC_BATCH: string + BLOCK_COMMIT: string CREATE_BLOCK: string BLOCK_SOFT_DELETE: string GET_PAGE_BLOCKS: string diff --git a/tools/e2e-testing/helpers/utils/sortByAttribute.ts b/tools/e2e-testing/helpers/utils/sortByAttribute.ts index 685566b34..e167d2d2d 100644 --- a/tools/e2e-testing/helpers/utils/sortByAttribute.ts +++ b/tools/e2e-testing/helpers/utils/sortByAttribute.ts @@ -1,7 +1,7 @@ import { PageType } from '../types/graphql.types' export function compareAttributeItem(item1: PageType, item2: PageType): number { - const text1 = item1.text.toLowerCase().trim() - const text2 = item2.text.toLowerCase().trim() - return text2.localeCompare(text1) + const title1 = item1.documentInfo.title.toLowerCase().trim() + const title2 = item2.documentInfo.title.toLowerCase().trim() + return title2.localeCompare(title1) } diff --git a/tools/e2e-testing/helpers/utils/uuid.ts b/tools/e2e-testing/helpers/utils/uuid.ts new file mode 100644 index 000000000..b53739a67 --- /dev/null +++ b/tools/e2e-testing/helpers/utils/uuid.ts @@ -0,0 +1,5 @@ +import * as crypto from 'crypto' + +export const generateUUID = (): string => { + return crypto.randomUUID() +} diff --git a/tools/e2e-testing/tests/common/common.data.ts b/tools/e2e-testing/tests/common/common.data.ts index 19c01e667..1575f31a2 100644 --- a/tools/e2e-testing/tests/common/common.data.ts +++ b/tools/e2e-testing/tests/common/common.data.ts @@ -14,3 +14,7 @@ export const TWO_LAYER_PAGE_TREE: PageBlock[] = [ ] } ] + +export const COMMON_STYLE = { + hoverBackground: 'rgba(64, 137, 216, 0.1)' +} diff --git a/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.data.ts b/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.data.ts index 1bcc2f62f..e3d19e474 100644 --- a/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.data.ts +++ b/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.data.ts @@ -2,23 +2,35 @@ import { PageBlock } from '@/helpers/types/data.types' export const SUPER_LONG_TITLE_PAGE: PageBlock = { title: 'It is a Super Super Super Super Long breadcrumb which is more than 400px', - icon: { name: 'face with tongue', emoji: '😛' } + icon: { name: 'face with tongue', emoji: '😛' }, + state: + 'AgKnxJbLDACoxoqxmAUAAXdISXQgaXMgYSBTdXBlciBTdXBlciBTdXBlciBTdXBlciBMb25nIGJyZWFkY3J1bWIgd2hpY2ggaXMgbW9yZSB0aGFuIDQwMHB4KAEEbWV0YQRpY29uAXYECl9fdHlwZW5hbWV3CkJsb2NrRW1vamkEdHlwZXcFRU1PSkkEbmFtZXcac3F1aW50aW5nIGZhY2Ugd2l0aCB0b25ndWUFZW1vaml3BPCfmJ0BxoqxmAUAIQEEbWV0YQV0aXRsZQEBxoqxmAUBAAE=' } + export const FIVE_LAYER_PAGE_TREE: PageBlock[] = [ { title: 'page 1', + state: 'AQH9wou7BwAoAQRtZXRhBXRpdGxlAXcGcGFnZSAxAA==', children: [ { title: 'page 1-1', + state: 'AQL9wou7BwAhAQRtZXRhBXRpdGxlAaj9wou7BwABdwhwYWdlIDEtMQH9wou7BwEAAQ==', icon: { name: 'face with tongue', emoji: '😛' }, children: [ { title: 'page 1-1-1', + state: 'AQL9wou7BwAhAQRtZXRhBXRpdGxlAqj9wou7BwEBdwpwYWdlIDEtMS0xAf3Ci7sHAQAC', children: [ { title: 'page 1-1-1-1', + state: 'AQL9wou7BwAhAQRtZXRhBXRpdGxlA6j9wou7BwIBdwxwYWdlIDEtMS0xLTEB/cKLuwcBAAM=', icon: { name: 'face with tongue', emoji: '😛' }, - children: [{ title: 'page 1-1-1-1-1' }] + children: [ + { + title: 'page 1-1-1-1-1', + state: 'AQL9wou7BwAhAQRtZXRhBXRpdGxlBaj9wou7BwQBdw5wYWdlIDEtMS0xLTEtMQH9wou7BwEABQ==' + } + ] } ] } diff --git a/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.spec.ts b/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.spec.ts index 02d84abbc..a6bdc7f3e 100644 --- a/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.spec.ts +++ b/tools/e2e-testing/tests/document/breadcrumb/breadcrumb.spec.ts @@ -123,6 +123,7 @@ test.describe('Breadcrumb', () => { await expect(breadcrumb.getBreadcrumbItems()).toHaveCount(2) }) + // 3 test.describe('Visual test @visual', () => { test('layer more than 4', async ({ api }) => { await api.createPageTree(FIVE_LAYER_PAGE_TREE) diff --git a/tools/e2e-testing/tests/document/documentTitle/documentTitle.page.ts b/tools/e2e-testing/tests/document/documentTitle/documentTitle.page.ts index e55c0176b..b57f81e66 100644 --- a/tools/e2e-testing/tests/document/documentTitle/documentTitle.page.ts +++ b/tools/e2e-testing/tests/document/documentTitle/documentTitle.page.ts @@ -46,7 +46,7 @@ export class DocumentTitlePage extends CommonPage { } async fillTitle(title: string): Promise { - await this.waitForResponseWithAction('blockSyncBatch', this.getDocumentTitle().fill(title)) + await this.getDocumentTitle().fill(title) } async openIconPopup(): Promise { diff --git a/tools/e2e-testing/tests/document/documentTitle/documentTitle.selector.ts b/tools/e2e-testing/tests/document/documentTitle/documentTitle.selector.ts index 3ef5477df..88e25c166 100644 --- a/tools/e2e-testing/tests/document/documentTitle/documentTitle.selector.ts +++ b/tools/e2e-testing/tests/document/documentTitle/documentTitle.selector.ts @@ -2,7 +2,7 @@ import { TEST_ID_ENUM } from '@/../../packages/test-helper/src' export const DOCUMENT_TITLE_SELECTORS = { article: '#article', - documentTitle: `[data-testid=${TEST_ID_ENUM.page.DocumentPage.titleInput.id}] input`, + documentTitle: `[data-testid=${TEST_ID_ENUM.page.DocumentPage.titleInput.id}]`, documentEmoji: `[data-testid=${TEST_ID_ENUM.page.DocumentPage.titleIcon.id}] span`, documentImageIcon: `[data-testid=${TEST_ID_ENUM.page.DocumentPage.titleIcon.id}] div`, actionButtons: `[data-testid=${TEST_ID_ENUM.page.DocumentPage.actionButtons.id}]`, diff --git a/tools/e2e-testing/tests/document/documentTitle/documentTitle.spec.ts b/tools/e2e-testing/tests/document/documentTitle/documentTitle.spec.ts index 8ba916146..b4f0777ff 100644 --- a/tools/e2e-testing/tests/document/documentTitle/documentTitle.spec.ts +++ b/tools/e2e-testing/tests/document/documentTitle/documentTitle.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@/fixtures' import { rem2Pixel } from '@/helpers/utils/rem2Pixel' import { PageTreePage } from '@/tests/sidebar/pageTree/pageTree.page' -import { INITIAL_PAGE } from '@/tests/common/common.data' +import { COMMON_STYLE, INITIAL_PAGE } from '@/tests/common/common.data' import { DocumentTitlePage } from './documentTitle.page' test.describe('Document Title', () => { @@ -19,7 +19,7 @@ test.describe('Document Title', () => { }) test('Verify the font-size is equal 2.5rem', async () => { - await expect(documentTitle.getDocumentTitle()).toHaveCSS('font-size', rem2Pixel('2.5rem')) + await expect(documentTitle.getDocumentTitle()).toHaveCSS('font-size', rem2Pixel('2.25rem')) }) test('Verify the initial page value and placeholder are equal Untitled', async ({ page }) => { @@ -45,11 +45,11 @@ test.describe('Document Title', () => { await documentTitle.getDocumentTitle().hover() await documentTitle.getAddIconButton().hover() - await expect(documentTitle.getAddIconButton()).toHaveCSS('background-color', 'rgba(53, 108, 249, 0.1)') + await expect(documentTitle.getAddIconButton()).toHaveCSS('background-color', COMMON_STYLE.hoverBackground) await documentTitle.getDocumentTitle().hover() await documentTitle.getAddCoverButton().hover() - await expect(documentTitle.getAddCoverButton()).toHaveCSS('background-color', 'rgba(53, 108, 249, 0.1)') + await expect(documentTitle.getAddCoverButton()).toHaveCSS('background-color', COMMON_STYLE.hoverBackground) }) }) diff --git a/tools/e2e-testing/tests/document/editor/editor.spec.ts b/tools/e2e-testing/tests/document/editor/editor.spec.ts index 1ab6b1a92..e49f29f8d 100644 --- a/tools/e2e-testing/tests/document/editor/editor.spec.ts +++ b/tools/e2e-testing/tests/document/editor/editor.spec.ts @@ -32,11 +32,11 @@ test.describe('Editor', () => { await expect(editor.getNodes()).toHaveCount(1) }) - test('Verify it will create paragraph when click under the last non-empty block', async () => { + test('Verify it will not create paragraph when click under the last non-empty block', async () => { await editor.fillToBlock('test') const paragraphHeight = (await editor.getNodeByIndex().boundingBox())?.height as number await editor.getEditorContent().click({ position: { x: 20, y: paragraphHeight * 1.5 } }) - await expect(editor.getNodes()).toHaveCount(2) + await expect(editor.getNodes()).toHaveCount(1) }) test('Verify blockAction is visible when hover node', async () => { diff --git a/tools/e2e-testing/tests/document/icon/icon.selector.ts b/tools/e2e-testing/tests/document/icon/icon.selector.ts index d2b4865dd..e1c0e02c5 100644 --- a/tools/e2e-testing/tests/document/icon/icon.selector.ts +++ b/tools/e2e-testing/tests/document/icon/icon.selector.ts @@ -5,6 +5,6 @@ export enum IconTab { } export const ICON_SELECTOR = { - emojiSearchInput: '.dashboard-emoji-search-input', + emojiSearchInput: '.dashboard-emoji-search-input input', emojiItem: (index: number) => `button.dashboard-emoji-item >> nth=${index}` } diff --git a/tools/e2e-testing/tests/document/slashMenu/slashMenu.selector.ts b/tools/e2e-testing/tests/document/slashMenu/slashMenu.selector.ts index ec80d0acf..27982dbbe 100644 --- a/tools/e2e-testing/tests/document/slashMenu/slashMenu.selector.ts +++ b/tools/e2e-testing/tests/document/slashMenu/slashMenu.selector.ts @@ -1,3 +1,3 @@ export const SLASH_MENU_SELECTORS = { - slashMenu: '#slash-menu' + slashMenu: '#block-selector' } diff --git a/tools/e2e-testing/tests/document/uploaderDashboard/uploaderDashboard.page.ts b/tools/e2e-testing/tests/document/uploaderDashboard/uploaderDashboard.page.ts index e5711a731..0de9dff9d 100644 --- a/tools/e2e-testing/tests/document/uploaderDashboard/uploaderDashboard.page.ts +++ b/tools/e2e-testing/tests/document/uploaderDashboard/uploaderDashboard.page.ts @@ -32,7 +32,7 @@ export class UploaderDashboardPage extends CommonPage { } async uploadImage(path: string): Promise { - await this.waitForResponseWithAction('blockSyncBatch', this.getUploadImageButton().setInputFiles(path)) + await this.waitForResponseWithAction('blockCommit', this.getUploadImageButton().setInputFiles(path)) } async pasteImageLink(link: string): Promise { diff --git a/tools/e2e-testing/tests/sidebar/trash/trash.spec.ts b/tools/e2e-testing/tests/sidebar/trash/trash.spec.ts index 14ed6521d..9067c06bc 100644 --- a/tools/e2e-testing/tests/sidebar/trash/trash.spec.ts +++ b/tools/e2e-testing/tests/sidebar/trash/trash.spec.ts @@ -4,6 +4,7 @@ import { DocumentTitlePage } from '@/tests/document/documentTitle/documentTitle. import { PageTreePage } from '@/tests/sidebar/pageTree/pageTree.page' import { TRASH_PAGE_TREE, TRASH_PAGE_TREE_FOR_VISUAL, TRASH_SINGLE_PAGE } from './trash.data' import { TrashPage } from './trash.page' +import { COMMON_STYLE } from '@/tests/common/common.data' test.describe('Trash', () => { let trash: TrashPage @@ -49,7 +50,7 @@ test.describe('Trash', () => { test('Verify trash item has background-color and action button will be shown when hover', async () => { await trash.getItemByIndex().hover() - await expect(trash.getItemByIndex()).toHaveCSS('background-color', 'rgba(53, 108, 249, 0.1)') + await expect(trash.getItemByIndex()).toHaveCSS('background-color', COMMON_STYLE.hoverBackground) await expect(trash.getItemRestoreButton()).toBeVisible() await expect(trash.getItemRemoveButton()).toBeVisible() })