diff --git a/acceptance/WcmsTestsImgInlineCest.php b/acceptance/WcmsTestsImgInlineCest.php
index ba92cc8cc83e27899ef9ae5089fcef54fe828b8d..9e0b3cc53baf3be3ff2a16a12dbe10e40db64c8f 100644
--- a/acceptance/WcmsTestsImgInlineCest.php
+++ b/acceptance/WcmsTestsImgInlineCest.php
@@ -49,6 +49,10 @@ class WcmsTestsImgInlineCest {
 
       $i->waitForText('Choose a block');
       $i->click('Copy text');
+      $i->waitForText('Configure block');
+
+      // Switch the block form iframe.
+      $i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
       $i->waitForText('Block description');
 
       // Fill the title.
@@ -71,7 +75,7 @@ class WcmsTestsImgInlineCest {
       // Click the submit button.
       $i->waitForElementClickable('input[id*="edit-actions-submit"]');
       $i->click('input[id*="edit-actions-submit"]');
-
+      $i->switchToIFrame();
       // Ensure that the block is on the page.
       $i->waitForJS("return document.readyState === 'complete';", 30);
       $i->waitForElement(".uw-copy-text div " . $block . " img", 30);
@@ -79,12 +83,14 @@ class WcmsTestsImgInlineCest {
 
       // Check that image's parent is a block.
       $i->seeElement(".uw-copy-text div " . $block . " img", ['alt' => 'Inserted image in ' . $block . ' block']);
+      $i->waitForJS("return document.readyState === 'complete';");
 
       // Remove added block to avoid ambiguity in finding image.
       $i->amOnPage($path . '/layout/discard-changes');
       $i->click('#edit-submit');
-      $i->waitForJS("return document.readyState === 'complete';", 30);
-      $i->waitForText("The changes to the layout have been discarded.", 60);
+      $i->switchToIFrame();
+      $i->waitForJS("return document.readyState === 'complete';");
+      $i->waitForText("The changes to the layout have been discarded.");
     }
   }