@@ -631,6 +631,7 @@ describe("Stamp Editor", () => {
631631 } ) ;
632632
633633 it ( "must check that the alt-text button is here when pasting in the second tab" , async ( ) => {
634+ // Run sequentially to avoid clipboard issues.
634635 for ( let i = 0 ; i < pages1 . length ; i ++ ) {
635636 const [ , page1 ] = pages1 [ i ] ;
636637 await page1 . bringToFront ( ) ;
@@ -1592,86 +1593,80 @@ describe("Stamp Editor", () => {
15921593 } ) ;
15931594
15941595 it ( "must check that deleting an image can be undone using the undo button" , async ( ) => {
1595- await Promise . all (
1596- pages . map ( async ( [ browserName , page ] ) => {
1597- await switchToStamp ( page ) ;
1596+ // Run sequentially to avoid clipboard issues.
1597+ for ( const [ , page ] of pages ) {
1598+ await switchToStamp ( page ) ;
15981599
1599- const editorSelector = getEditorSelector ( 0 ) ;
1600- await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1601- await page . waitForSelector ( editorSelector ) ;
1602- await waitForSerialized ( page , 1 ) ;
1600+ const editorSelector = getEditorSelector ( 0 ) ;
1601+ await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1602+ await page . waitForSelector ( editorSelector ) ;
1603+ await waitForSerialized ( page , 1 ) ;
16031604
1604- await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1605- await page . click ( `${ editorSelector } button.delete` ) ;
1606- await waitForSerialized ( page , 0 ) ;
1607- await page . waitForSelector ( "#editorUndoBar" , { visible : true } ) ;
1605+ await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1606+ await page . click ( `${ editorSelector } button.delete` ) ;
1607+ await waitForSerialized ( page , 0 ) ;
1608+ await page . waitForSelector ( "#editorUndoBar" , { visible : true } ) ;
16081609
1609- await page . waitForSelector ( "#editorUndoBarUndoButton" , {
1610- visible : true ,
1611- } ) ;
1612- await page . click ( "#editorUndoBarUndoButton" ) ;
1613- await waitForSerialized ( page , 1 ) ;
1614- await page . waitForSelector ( editorSelector ) ;
1615- await page . waitForSelector ( `${ editorSelector } canvas` ) ;
1616- } )
1617- ) ;
1610+ await page . waitForSelector ( "#editorUndoBarUndoButton" , {
1611+ visible : true ,
1612+ } ) ;
1613+ await page . click ( "#editorUndoBarUndoButton" ) ;
1614+ await waitForSerialized ( page , 1 ) ;
1615+ await page . waitForSelector ( editorSelector ) ;
1616+ await page . waitForSelector ( `${ editorSelector } canvas` ) ;
1617+ }
16181618 } ) ;
16191619
16201620 it ( "must check that the undo deletion popup displays the correct message" , async ( ) => {
1621- await Promise . all (
1622- pages . map ( async ( [ browserName , page ] ) => {
1623- await switchToStamp ( page ) ;
1621+ // Run sequentially to avoid clipboard issues.
1622+ for ( const [ , page ] of pages ) {
1623+ await switchToStamp ( page ) ;
16241624
1625- const editorSelector = getEditorSelector ( 0 ) ;
1626- await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1627- await page . waitForSelector ( editorSelector ) ;
1628- await waitForSerialized ( page , 1 ) ;
1625+ const editorSelector = getEditorSelector ( 0 ) ;
1626+ await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1627+ await page . waitForSelector ( editorSelector ) ;
1628+ await waitForSerialized ( page , 1 ) ;
16291629
1630- await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1631- await page . click ( `${ editorSelector } button.delete` ) ;
1632- await waitForSerialized ( page , 0 ) ;
1630+ await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1631+ await page . click ( `${ editorSelector } button.delete` ) ;
1632+ await waitForSerialized ( page , 0 ) ;
16331633
1634- await page . waitForFunction ( ( ) => {
1635- const messageElement = document . querySelector (
1636- "#editorUndoBarMessage"
1637- ) ;
1638- return messageElement && messageElement . textContent . trim ( ) !== "" ;
1639- } ) ;
1640- const message = await page . waitForSelector ( "#editorUndoBarMessage" ) ;
1641- const messageText = await page . evaluate (
1642- el => el . textContent ,
1643- message
1634+ await page . waitForFunction ( ( ) => {
1635+ const messageElement = document . querySelector (
1636+ "#editorUndoBarMessage"
16441637 ) ;
1645- expect ( messageText ) . toContain ( "Image removed" ) ;
1646- } )
1647- ) ;
1638+ return messageElement && messageElement . textContent . trim ( ) !== "" ;
1639+ } ) ;
1640+ const message = await page . waitForSelector ( "#editorUndoBarMessage" ) ;
1641+ const messageText = await page . evaluate ( el => el . textContent , message ) ;
1642+ expect ( messageText ) . toContain ( "Image removed" ) ;
1643+ }
16481644 } ) ;
16491645
16501646 it ( "must check that the popup disappears when a new image is inserted" , async ( ) => {
1651- await Promise . all (
1652- pages . map ( async ( [ browserName , page ] ) => {
1653- await switchToStamp ( page ) ;
1647+ // Run sequentially to avoid clipboard issues.
1648+ for ( const [ , page ] of pages ) {
1649+ await switchToStamp ( page ) ;
16541650
1655- const editorSelector = getEditorSelector ( 0 ) ;
1656- await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1657- await page . waitForSelector ( editorSelector ) ;
1658- await waitForSerialized ( page , 1 ) ;
1651+ const editorSelector = getEditorSelector ( 0 ) ;
1652+ await copyImage ( page , "../images/firefox_logo.png" , editorSelector ) ;
1653+ await page . waitForSelector ( editorSelector ) ;
1654+ await waitForSerialized ( page , 1 ) ;
16591655
1660- await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1661- await page . click ( `${ editorSelector } button.delete` ) ;
1662- await waitForSerialized ( page , 0 ) ;
1656+ await page . waitForSelector ( `${ editorSelector } button.delete` ) ;
1657+ await page . click ( `${ editorSelector } button.delete` ) ;
1658+ await waitForSerialized ( page , 0 ) ;
16631659
1664- await page . waitForSelector ( "#editorUndoBar" , { visible : true } ) ;
1665- await page . click ( "#editorStampAddImage" ) ;
1666- const newInput = await page . $ ( "#stampEditorFileInput" ) ;
1667- await newInput . uploadFile (
1668- `${ path . join ( __dirname , "../images/firefox_logo.png" ) } `
1669- ) ;
1670- await waitForImage ( page , getEditorSelector ( 1 ) ) ;
1671- await waitForSerialized ( page , 1 ) ;
1672- await page . waitForSelector ( "#editorUndoBar" , { hidden : true } ) ;
1673- } )
1674- ) ;
1660+ await page . waitForSelector ( "#editorUndoBar" , { visible : true } ) ;
1661+ await page . click ( "#editorStampAddImage" ) ;
1662+ const newInput = await page . $ ( "#stampEditorFileInput" ) ;
1663+ await newInput . uploadFile (
1664+ `${ path . join ( __dirname , "../images/firefox_logo.png" ) } `
1665+ ) ;
1666+ await waitForImage ( page , getEditorSelector ( 1 ) ) ;
1667+ await waitForSerialized ( page , 1 ) ;
1668+ await page . waitForSelector ( "#editorUndoBar" , { hidden : true } ) ;
1669+ }
16751670 } ) ;
16761671 } ) ;
16771672
0 commit comments