@@ -1271,6 +1271,68 @@ describe("Reorganize Pages View", () => {
12711271 } )
12721272 ) ;
12731273 } ) ;
1274+
1275+ it ( "should focus the newly pasted page after copy and paste (bug 2022516)" , async ( ) => {
1276+ await Promise . all (
1277+ pages . map ( async ( [ browserName , page ] ) => {
1278+ await waitForThumbnailVisible ( page , 1 ) ;
1279+ await page . waitForSelector ( "#viewsManagerStatusActionButton" , {
1280+ visible : true ,
1281+ } ) ;
1282+
1283+ // Select page 1 and copy it.
1284+ await waitAndClick (
1285+ page ,
1286+ `.thumbnail:has(${ getThumbnailSelector ( 1 ) } ) input`
1287+ ) ;
1288+ let handlePagesEdited = await waitForPagesEdited ( page , "copy" ) ;
1289+ await waitAndClick ( page , "#viewsManagerStatusActionButton" ) ;
1290+ await waitAndClick ( page , "#viewsManagerStatusActionCopy" ) ;
1291+ await awaitPromise ( handlePagesEdited ) ;
1292+
1293+ // Paste after page 3: the pasted page lands at position 4.
1294+ handlePagesEdited = await waitForPagesEdited ( page ) ;
1295+ await waitAndClick ( page , `${ getThumbnailSelector ( 3 ) } +button` ) ;
1296+ await awaitPromise ( handlePagesEdited ) ;
1297+
1298+ // Focus must be on the newly pasted page (position 4), not page 1.
1299+ await page . waitForSelector ( `${ getThumbnailSelector ( 4 ) } :focus` , {
1300+ visible : true ,
1301+ } ) ;
1302+ } )
1303+ ) ;
1304+ } ) ;
1305+
1306+ it ( "should focus the newly pasted page after cut and paste (bug 2022516)" , async ( ) => {
1307+ await Promise . all (
1308+ pages . map ( async ( [ browserName , page ] ) => {
1309+ await waitForThumbnailVisible ( page , 1 ) ;
1310+ await page . waitForSelector ( "#viewsManagerStatusActionButton" , {
1311+ visible : true ,
1312+ } ) ;
1313+
1314+ // Select page 3 and cut it.
1315+ await waitAndClick (
1316+ page ,
1317+ `.thumbnail:has(${ getThumbnailSelector ( 3 ) } ) input`
1318+ ) ;
1319+ let handlePagesEdited = await waitForPagesEdited ( page , "cut" ) ;
1320+ await waitAndClick ( page , "#viewsManagerStatusActionButton" ) ;
1321+ await waitAndClick ( page , "#viewsManagerStatusActionCut" ) ;
1322+ await awaitPromise ( handlePagesEdited ) ;
1323+
1324+ // Paste after page 1: the pasted page lands at position 2.
1325+ handlePagesEdited = await waitForPagesEdited ( page ) ;
1326+ await waitAndClick ( page , `${ getThumbnailSelector ( 1 ) } +button` ) ;
1327+ await awaitPromise ( handlePagesEdited ) ;
1328+
1329+ // Focus must be on the newly pasted page (position 2), not page 1.
1330+ await page . waitForSelector ( `${ getThumbnailSelector ( 2 ) } :focus` , {
1331+ visible : true ,
1332+ } ) ;
1333+ } )
1334+ ) ;
1335+ } ) ;
12741336 } ) ;
12751337
12761338 describe ( "Status label reflects number of checked thumbnails (bug 2010832)" , ( ) => {
0 commit comments