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