77 getPageOperationButton ,
88 waitForEditorLoad ,
99} from '@affine-test/kit/utils/page-logic' ;
10+ import { getCurrentDocIdFromUrl } from '@affine-test/kit/utils/url' ;
1011import { expect } from '@playwright/test' ;
1112
1213test ( 'page delete -> refresh page -> it should be disappear' , async ( {
@@ -18,7 +19,7 @@ test('page delete -> refresh page -> it should be disappear', async ({
1819 await clickNewPageButton ( page ) ;
1920 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
2021 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page delete' ) ;
21- const newPageId = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
22+ const newPageId = getCurrentDocIdFromUrl ( page ) ;
2223 await page . getByTestId ( 'all-pages' ) . click ( ) ;
2324 const cell = page . getByRole ( 'cell' , {
2425 name : 'this is a new page delete' ,
@@ -54,7 +55,7 @@ test('page delete -> create new page -> refresh page -> new page should be appea
5455 await clickNewPageButton ( page ) ;
5556 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
5657 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page delete' ) ;
57- const newPageDeleteId = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
58+ const newPageDeleteId = getCurrentDocIdFromUrl ( page ) ;
5859 await page . getByTestId ( 'all-pages' ) . click ( ) ;
5960 const cellDelete = page . getByRole ( 'cell' , {
6061 name : 'this is a new page delete' ,
@@ -80,13 +81,13 @@ test('page delete -> create new page -> refresh page -> new page should be appea
8081 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
8182 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page1' ) ;
8283 await page . waitForTimeout ( 1000 ) ;
83- const newPageId1 = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
84+ const newPageId1 = getCurrentDocIdFromUrl ( page ) ;
8485 await page . getByTestId ( 'all-pages' ) . click ( ) ;
8586 await clickNewPageButton ( page ) ;
8687 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
8788 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page2' ) ;
8889 await page . waitForTimeout ( 1000 ) ;
89- const newPageId2 = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
90+ const newPageId2 = getCurrentDocIdFromUrl ( page ) ;
9091 await page . getByTestId ( 'all-pages' ) . click ( ) ;
9192 await page . reload ( ) ;
9293 await getPageItem ( page , newPageId1 ) . click ( ) ;
@@ -109,13 +110,13 @@ test('delete multiple pages -> create multiple pages -> refresh', async ({
109110 await clickNewPageButton ( page ) ;
110111 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
111112 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page1' ) ;
112- const newPageId1 = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
113+ const newPageId1 = getCurrentDocIdFromUrl ( page ) ;
113114 await page . getByTestId ( 'all-pages' ) . click ( ) ;
114115 // create 2nd page
115116 await clickNewPageButton ( page ) ;
116117 await getBlockSuiteEditorTitle ( page ) . click ( ) ;
117118 await getBlockSuiteEditorTitle ( page ) . fill ( 'this is a new page2' ) ;
118- const newPageId2 = page . url ( ) . split ( '/' ) . reverse ( ) [ 0 ] ;
119+ const newPageId2 = getCurrentDocIdFromUrl ( page ) ;
119120 await page . getByTestId ( 'all-pages' ) . click ( ) ;
120121
121122 // 1st cell to be deleted
0 commit comments