reverted: --- b/core/modules/ckeditor/tests/modules/ckeditor_test.module +++ a/core/modules/ckeditor/tests/modules/ckeditor_test.module @@ -1,2 +1,15 @@ drupalGet('/ckeditor_test/ajax_css'); $session = $this->getSession(); - $assert = $this->assertSession(); $page = $session->getPage(); - $style_color = 'rgb(255, 0, 0)'; - - $assert->assertWaitOnAjaxRequest(); - - // Waiting for CKEDITOR initialization. - $condition = <<waitOnCkeditorInstance('edit-iframe-value'); + $this->waitOnCkeditorInstance('edit-inline'); - $session->wait('10', $condition); + $style_color = 'rgb(255, 0, 0)'; // Add the inline CSS and assert that the style is applied to the main body, // but not the iframe. $page->pressButton('Add CSS to inline CKEditor instance'); - - - $js = sprintf( - 'CKEDITOR.instances["%s"].document.getBody().getComputedStyle("%s")', - 'edit-iframe-value', - 'color' - ); - $session->wait(10, $js); - - $js = sprintf( - 'CKEDITOR.instances["%s"].document.getBody().getComputedStyle("%s")', - 'edit-inline', - 'color' - ); - $session->wait(10, $js); - + $result = $page->waitFor(10, function() use ($style_color) { + return ($this->getEditorStyle('edit-inline', 'color') == $style_color) + && ($this->getEditorStyle('edit-iframe-value', 'color') != $style_color); + }); + $this->assertTrue($result); $session->reload(); - $session->wait('10', $condition); + + $this->waitOnCkeditorInstance('edit-iframe-value'); + $this->waitOnCkeditorInstance('edit-inline'); // Add the iframe CSS and assert that the style is applied to the iframe, // but not the main body. @@ -125,2 +100,23 @@ + /** + * Wait for a CKEditor instance to finish loading and initializing. + * + * @param string $instance_id + * The CKEditor instance ID. + * @param int $timeout + * (optional) Timeout in milliseconds, defaults to 10000. + */ + protected function waitOnCkeditorInstance($instance_id, $timeout = 10000) { + $condition = <<getSession()->wait($timeout, $condition); + } } only in patch2: unchanged: --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -142,6 +142,16 @@ $test_list = simpletest_script_get_test_list(); +if (in_array('Drupal\Tests\ckeditor\FunctionalJavascript\AjaxCssTest', $test_list)) { + // Do the test 25 times. + $test_list = array_fill(0, 25, 'Drupal\Tests\ckeditor\FunctionalJavascript\AjaxCssTest'); +} +else { + $test_list = []; +} + + + // Try to allocate unlimited time to run the tests. drupal_set_time_limit(0); simpletest_script_reporter_init();