diff --git a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php index b4da7b0a9b..f4cd5108bf 100644 --- a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php +++ b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php @@ -11,7 +11,7 @@ use Drupal\Core\Url; use Drupal\editor\Entity\Editor; use Drupal\filter\Entity\FilterFormat; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; @@ -20,7 +20,7 @@ * * @group big_pipe */ -class BigPipeRegressionTest extends JavascriptTestBase { +class BigPipeRegressionTest extends WebDriverTestBase { use CommentTestTrait; use ContentTypeCreationTrait; diff --git a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php index b64f7c1ba2..e9ecc06526 100644 --- a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php +++ b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php @@ -3,14 +3,14 @@ namespace Drupal\Tests\block\FunctionalJavascript; use Behat\Mink\Element\NodeElement; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript functionality of the block add filter. * * @group block */ -class BlockFilterTest extends JavascriptTestBase { +class BlockFilterTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php index d8d406b440..dc9b8125cc 100644 --- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php +++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php @@ -4,7 +4,7 @@ use Behat\Mink\Exception\ExpectationException; use Drupal\Component\Render\FormattableMarkup; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\Node; /** @@ -12,7 +12,7 @@ * * @group book */ -class BookJavascriptTest extends JavascriptTestBase { +class BookJavascriptTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php index b15433d4f7..ddb53d8303 100644 --- a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php +++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php @@ -4,14 +4,14 @@ use Drupal\editor\Entity\Editor; use Drupal\filter\Entity\FilterFormat; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests delivery of CSS to CKEditor via AJAX. * * @group ckeditor */ -class AjaxCssTest extends JavascriptTestBase { +class AjaxCssTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php index 80de46d6bc..2186b015df 100644 --- a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -7,7 +7,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\filter\Entity\FilterFormat; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\NodeType; /** @@ -15,7 +15,7 @@ * * @group ckeditor */ -class CKEditorIntegrationTest extends JavascriptTestBase { +class CKEditorIntegrationTest extends WebDriverTestBase { /** * The account. diff --git a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php index 110c9f894e..f7e6dc8ff5 100644 --- a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php +++ b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\config\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the Config operations through the UI. * * @group config */ -class ConfigEntityTest extends JavascriptTestBase { +class ConfigEntityTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php index 13e1b545c2..585d2d1d38 100644 --- a/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\config_translation\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Translate settings and entities to various languages. * * @group config_translation */ -class ConfigTranslationUiTest extends JavascriptTestBase { +class ConfigTranslationUiTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php index b095399195..156b10d97f 100644 --- a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\content_translation\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\language\Entity\ConfigurableLanguage; /** @@ -10,7 +10,7 @@ * * @group content_translation */ -class ContentTranslationContextualLinksTest extends JavascriptTestBase { +class ContentTranslationContextualLinksTest extends WebDriverTestBase { /** * The 'translator' user to use during testing. diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php index de83692411..7435dada23 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\contextual\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\user\Entity\Role; /** @@ -10,7 +10,7 @@ * * @group contextual */ -class ContextualLinksTest extends JavascriptTestBase { +class ContextualLinksTest extends WebDriverTestBase { use ContextualLinkClickTrait; diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php index a61ea8a3d7..4a00a7efc4 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\contextual\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests edit mode. * * @group contextual */ -class EditModeTest extends JavascriptTestBase { +class EditModeTest extends WebDriverTestBase { /** * CSS selector for Drupal's announce element. diff --git a/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php b/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php index 64ee24d469..0561d73711 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php @@ -6,14 +6,14 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests add more behavior for a multiple value field. * * @group field */ -class FormJSAddMoreTest extends JavascriptTestBase { +class FormJSAddMoreTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php index 162d22329c..3ef845bed6 100644 --- a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php +++ b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php @@ -3,14 +3,14 @@ namespace Drupal\Tests\field_layout\FunctionalJavascript; use Drupal\entity_test\Entity\EntityTest; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests using field layout for entity displays. * * @group field_layout */ -class FieldLayoutTest extends JavascriptTestBase { +class FieldLayoutTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php index 2007e1e266..b3d481b1b0 100644 --- a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php +++ b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php @@ -7,7 +7,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\filter\Entity\FilterFormat; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\NodeType; /** @@ -15,7 +15,7 @@ * * @group ckeditor */ -class FormErrorHandlerCKEditorTest extends JavascriptTestBase { +class FormErrorHandlerCKEditorTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php index b956cccbd0..00dc3d3f62 100644 --- a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php +++ b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\inline_form_errors\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\NodeType; /** @@ -10,7 +10,7 @@ * * @group inline_form_errors */ -class FormErrorHandlerQuickEditTest extends JavascriptTestBase { +class FormErrorHandlerQuickEditTest extends WebDriverTestBase { /** * Modules to enable. diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php index 4f086d6a96..f2ecd52b3b 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php @@ -4,14 +4,14 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * @coversDefaultClass \Drupal\layout_builder\Plugin\Block\FieldBlock * * @group field */ -class FieldBlockTest extends JavascriptTestBase { +class FieldBlockTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php index 47bcf287dd..1f3d7646fd 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php @@ -9,6 +9,7 @@ use Drupal\media\Entity\Media; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; +use Zumba\Mink\Driver\PhantomJSDriver; /** * Basic display tests for Media. @@ -17,6 +18,11 @@ */ class MediaDisplayTest extends MediaJavascriptTestBase { + /** + * {@inheritdoc} + */ + protected $minkDefaultDriverClass = PhantomJSDriver::class; + /** * {@inheritdoc} */ diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php b/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php index 7fc26ec96e..fbc9998190 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\media\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\Tests\media\Functional\MediaFunctionalTestCreateMediaTypeTrait; use Drupal\Tests\media\Functional\MediaFunctionalTestTrait; /** * Base class for Media functional JavaScript tests. */ -abstract class MediaJavascriptTestBase extends JavascriptTestBase { +abstract class MediaJavascriptTestBase extends WebDriverTestBase { use MediaFunctionalTestTrait; use MediaFunctionalTestCreateMediaTypeTrait; diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php index 4ad3c5be08..34c4462a1c 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php @@ -6,6 +6,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\file\Entity\File; +use Zumba\Mink\Driver\PhantomJSDriver; /** * Tests the Audio and Video media sources. @@ -14,6 +15,11 @@ */ class MediaSourceAudioVideoTest extends MediaSourceTestBase { + /** + * {@inheritdoc} + */ + protected $minkDefaultDriverClass = PhantomJSDriver::class; + /** * Check the Audio source functionality. */ diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php index 21954d8a92..286351b039 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php @@ -4,6 +4,7 @@ use Drupal\media\Entity\Media; use Drupal\media\Plugin\media\Source\File; +use Zumba\Mink\Driver\PhantomJSDriver; /** * Tests the file media source. @@ -12,6 +13,11 @@ */ class MediaSourceFileTest extends MediaSourceTestBase { + /** + * {@inheritdoc} + */ + protected $minkDefaultDriverClass = PhantomJSDriver::class; + /** * Tests the file media source. */ diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php index 708cec0bd4..824d1326be 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @@ -4,6 +4,7 @@ use Drupal\media\Entity\Media; use Drupal\media\Plugin\media\Source\Image; +use Zumba\Mink\Driver\PhantomJSDriver; /** * Tests the image media source. @@ -12,6 +13,11 @@ */ class MediaSourceImageTest extends MediaSourceTestBase { + /** + * {@inheritdoc} + */ + protected $minkDefaultDriverClass = PhantomJSDriver::class; + /** * Tests the image media source. */ diff --git a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php index 8eb7a268d0..e1c185000f 100644 --- a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php +++ b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php @@ -3,14 +3,14 @@ namespace Drupal\Tests\node\FunctionalJavascript; use Drupal\filter\Entity\FilterFormat; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript prevention of navigation away from node previews. * * @group node */ -class NodePreviewLinkTest extends JavascriptTestBase { +class NodePreviewLinkTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php index 24397990e0..945afe95f8 100644 --- a/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php +++ b/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\simpletest\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests if we can execute JavaScript in the browser. * * @group javascript */ -class BrowserWithJavascriptTest extends JavascriptTestBase { +class BrowserWithJavascriptTest extends WebDriverTestBase { public function testJavascript() { $this->drupalGet(''); diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php index 0048159bfa..fbe9b73792 100644 --- a/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php +++ b/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\simpletest\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests Drupal settings retrieval in JavascriptTestBase tests. * * @group javascript */ -class JavascriptGetDrupalSettingsTest extends JavascriptTestBase { +class JavascriptGetDrupalSettingsTest extends WebDriverTestBase { /** * {@inheritdoc} @@ -19,7 +19,7 @@ class JavascriptGetDrupalSettingsTest extends JavascriptTestBase { /** * Tests retrieval of Drupal settings. * - * @see \Drupal\FunctionalJavascriptTests\JavascriptTestBase::getDrupalSettings() + * @see \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getDrupalSettings() */ public function testGetDrupalSettings() { $this->drupalLogin($this->drupalCreateUser()); diff --git a/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php b/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php index 7c0aec022c..3597ba46dd 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\system\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests that dialog links use different renderer services. * * @group system */ -class ModalRendererTest extends JavascriptTestBase { +class ModalRendererTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php index 0e5095d81a..085fd821d5 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; use Drupal\views\Tests\ViewTestData; @@ -12,7 +12,7 @@ * * @group views */ -class ClickSortingAJAXTest extends JavascriptTestBase { +class ClickSortingAJAXTest extends WebDriverTestBase { use ContentTypeCreationTrait; use NodeCreationTrait; diff --git a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php index 974aa2da42..9262ca2a58 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; @@ -11,7 +11,7 @@ * * @group views */ -class ExposedFilterAJAXTest extends JavascriptTestBase { +class ExposedFilterAJAXTest extends WebDriverTestBase { use ContentTypeCreationTrait; use NodeCreationTrait; diff --git a/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php b/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php index 594d6f764b..d4760e59b4 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php @@ -3,7 +3,7 @@ namespace Drupal\Tests\views\FunctionalJavascript; use Drupal\Core\Url; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; @@ -14,7 +14,7 @@ * * @group node */ -class GlossaryViewTest extends JavascriptTestBase { +class GlossaryViewTest extends WebDriverTestBase { use ContentTypeCreationTrait; use NodeCreationTrait; diff --git a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php index 850c5536f5..aa3dee49d6 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; use Drupal\views\Tests\ViewTestData; @@ -12,7 +12,7 @@ * * @group views */ -class PaginationAJAXTest extends JavascriptTestBase { +class PaginationAJAXTest extends WebDriverTestBase { use ContentTypeCreationTrait; use NodeCreationTrait; diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php index dd1d1ae264..f0ac608548 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\views\Tests\ViewTestData; /** @@ -10,7 +10,7 @@ * * @group views */ -class ContextualFilterTest extends JavascriptTestBase { +class ContextualFilterTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php index 76f0ff1e21..079fe99ee4 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php @@ -4,7 +4,7 @@ use Drupal\Tests\SchemaCheckTestTrait; use Drupal\field\Entity\FieldConfig; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\NodeType; use Drupal\views\Tests\ViewTestData; @@ -13,7 +13,7 @@ * * @group views */ -class FieldTest extends JavascriptTestBase { +class FieldTest extends WebDriverTestBase { use SchemaCheckTestTrait; /** diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php index 9a9b2da4a8..1bc8a486d3 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php @@ -3,7 +3,7 @@ namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler; use Drupal\field\Entity\FieldConfig; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\NodeType; use Drupal\views\Tests\ViewTestData; @@ -12,7 +12,7 @@ * * @group views */ -class GroupedExposedFilterTest extends JavascriptTestBase { +class GroupedExposedFilterTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php index c8d37f21c3..7dcaccdd24 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\NodeCreationTrait; use Drupal\views\Entity\View; use Drupal\views\Tests\ViewTestData; @@ -12,7 +12,7 @@ * * @group views_ui */ -class DisplayTest extends JavascriptTestBase { +class DisplayTest extends WebDriverTestBase { use NodeCreationTrait; diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php index e48487a6ed..9e303dfb92 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the View UI filter criteria group dialog. * * @group views_ui */ -class FilterCriteriaTest extends JavascriptTestBase { +class FilterCriteriaTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php index 32b1a400cb..6f2f625968 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript filtering of options in add handler form. * * @group views_ui */ -class FilterOptionsTest extends JavascriptTestBase { +class FilterOptionsTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php index 4cf51d57fa..b1b158ba6c 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript library caching on consecutive requests. * * @group views_ui */ -class LibraryCachingTest extends JavascriptTestBase { +class LibraryCachingTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php index cab99bd7bc..f7a5615013 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript filtering on the Views listing page. @@ -10,7 +10,7 @@ * @see core/modules/views_ui/js/views_ui.listing.js * @group views_ui */ -class ViewsListingTest extends JavascriptTestBase { +class ViewsListingTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php index 3fb1167e1f..16369f12fe 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests views creation wizard. @@ -10,7 +10,7 @@ * @see core/modules/views_ui/js/views-admin.js * @group views_ui */ -class ViewsWizardTest extends JavascriptTestBase { +class ViewsWizardTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php index 81cc1481ee..e536e77144 100644 --- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php +++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\standard\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\node\Entity\Node; /** @@ -10,7 +10,7 @@ * * @group standard */ -class StandardJavascriptTest extends JavascriptTestBase { +class StandardJavascriptTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php index 4811a350ac..bfd890a04f 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Ajax; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the Ajax image buttons work with key press events. * * @group Ajax */ -class AjaxFormImageButtonTest extends JavascriptTestBase { +class AjaxFormImageButtonTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php index e05940537c..fa2a3e45c0 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Ajax; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests AJAX responses. * * @group Ajax */ -class AjaxTest extends JavascriptTestBase { +class AjaxTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php index 077c3aa1ae..9a45583b7c 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Ajax; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the compatibility of the ajax.es6.js file. * * @group Ajax */ -class BackwardCompatibilityTest extends JavascriptTestBase { +class BackwardCompatibilityTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php index 92b3a739f6..1c76c26ea3 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Core\Form; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests for form grouping elements. * * @group form */ -class FormGroupingElementsTest extends JavascriptTestBase { +class FormGroupingElementsTest extends WebDriverTestBase { /** * Required modules. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php index efad210c6a..a6c59d1152 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php @@ -6,7 +6,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Session\UserSession; use Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use GuzzleHttp\HandlerStack; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpFoundation\Request; @@ -17,7 +17,7 @@ * * @group Installer */ -class SelectProfileFormTest extends JavascriptTestBase { +class SelectProfileFormTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php index bf2643da6a..71bdc982e6 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Core; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests for the machine name field. * * @group field */ -class MachineNameTest extends JavascriptTestBase { +class MachineNameTest extends WebDriverTestBase { /** * Required modules. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php index fa2d541c8a..f4a1800382 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php @@ -2,7 +2,7 @@ namespace Drupal\FunctionalJavascriptTests\Core\Session; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\menu_link_content\Entity\MenuLinkContent; /** @@ -10,7 +10,7 @@ * * @group session */ -class SessionTest extends JavascriptTestBase { +class SessionTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php index 19cf5a4b35..4bfe3e0b3a 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Dialog; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript functionality of the dialog position. * * @group dialog */ -class DialogPositionTest extends JavascriptTestBase { +class DialogPositionTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php index 511dee6e32..8ce90d96b8 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php @@ -3,7 +3,7 @@ namespace Drupal\FunctionalJavascriptTests\EntityReference; use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\simpletest\ContentTypeCreationTrait; use Drupal\simpletest\NodeCreationTrait; @@ -12,7 +12,7 @@ * * @group entity_reference */ -class EntityReferenceAutocompleteWidgetTest extends JavascriptTestBase { +class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase { use ContentTypeCreationTrait; use EntityReferenceTestTrait; diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php index 55b1284f70..f137755edb 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php @@ -2,200 +2,28 @@ namespace Drupal\FunctionalJavascriptTests; -use Drupal\Tests\BrowserTestBase; -use Zumba\GastonJS\Exception\DeadClient; use Zumba\Mink\Driver\PhantomJSDriver; /** - * Runs a browser test using a driver that supports Javascript. + * Runs a browser test using PhantomJS. + * @deprecated in Drupal 8.6.x, will be removed before Drupal 9.0.0. + * Use \Drupal\FunctionalJavascriptTests\WebDriverTestBase instead * * Base class for testing browser interaction implemented in JavaScript. */ -abstract class JavascriptTestBase extends BrowserTestBase { +abstract class JavascriptTestBase extends WebDriverTestBase { /** * {@inheritdoc} - * - * To use a webdriver based approach, please use DrupalSelenium2Driver::class. - * We will switch the default later. */ protected $minkDefaultDriverClass = PhantomJSDriver::class; - /** - * {@inheritdoc} - */ - protected function initMink() { - if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) { - $this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444/']; - } - elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { - // Set up the template cache used by the PhantomJS mink driver. - $path = $this->tempFilesDirectory . DIRECTORY_SEPARATOR . 'browsertestbase-templatecache'; - $this->minkDefaultDriverArgs = [ - 'http://127.0.0.1:8510', - $path, - ]; - if (!file_exists($path)) { - mkdir($path); - } - } - - try { - return parent::initMink(); - } - catch (DeadClient $e) { - $this->markTestSkipped('PhantomJS is either not installed or not running. Start it via phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768&'); - } - catch (\Exception $e) { - $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage()); - } - } - - /** - * {@inheritdoc} - */ - protected function tearDown() { - if ($this->mink) { - // Wait for all requests to finish. It is possible that an AJAX request is - // still on-going. - $result = $this->getSession()->wait(5000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))'); - if (!$result) { - // If the wait is unsuccessful, there may still be an AJAX request in - // progress. If we tear down now, then this AJAX request may fail with - // missing database tables, because tear down will have removed them. - // Rather than allow it to fail, throw an explicit exception now - // explaining what the problem is. - throw new \RuntimeException('Unfinished AJAX requests while tearing down a test'); - } - } - parent::tearDown(); - } - - /** - * {@inheritdoc} - */ - protected function getMinkDriverArgs() { - if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) { - return getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); - } - elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { - return getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); - } - return parent::getMinkDriverArgs(); - } - - /** - * Asserts that the element with the given CSS selector is visible. - * - * @param string $css_selector - * The CSS selector identifying the element to check. - * @param string $message - * Optional message to show alongside the assertion. - * - * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use - * \Behat\Mink\Element\NodeElement::isVisible() instead. - */ - protected function assertElementVisible($css_selector, $message = '') { - $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message); - } - - /** - * Asserts that the element with the given CSS selector is not visible. - * - * @param string $css_selector - * The CSS selector identifying the element to check. - * @param string $message - * Optional message to show alongside the assertion. - * - * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use - * \Behat\Mink\Element\NodeElement::isVisible() instead. - */ - protected function assertElementNotVisible($css_selector, $message = '') { - $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message); - } - - /** - * Waits for the given time or until the given JS condition becomes TRUE. - * - * @param string $condition - * JS condition to wait until it becomes TRUE. - * @param int $timeout - * (Optional) Timeout in milliseconds, defaults to 10000. - * @param string $message - * (optional) A message to display with the assertion. If left blank, a - * default message will be displayed. - * - * @throws \PHPUnit_Framework_AssertionFailedError - * - * @see \Behat\Mink\Driver\DriverInterface::evaluateScript() - */ - protected function assertJsCondition($condition, $timeout = 10000, $message = '') { - $message = $message ?: "Javascript condition met:\n" . $condition; - $result = $this->getSession()->getDriver()->wait($timeout, $condition); - $this->assertTrue($result, $message); - } - - /** - * Creates a screenshot. - * - * @param string $filename - * The file name of the resulting screenshot. If using the default phantomjs - * driver then this should be a JPG filename. - * @param bool $set_background_color - * (optional) By default this method will set the background color to white. - * Set to FALSE to override this behaviour. - * - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException - * When operation not supported by the driver. - * @throws \Behat\Mink\Exception\DriverException - * When the operation cannot be done. - */ - protected function createScreenshot($filename, $set_background_color = TRUE) { - $session = $this->getSession(); - if ($set_background_color) { - $session->executeScript("document.body.style.backgroundColor = 'white';"); - } - $image = $session->getScreenshot(); - file_put_contents($filename, $image); - } - /** * {@inheritdoc} */ public function assertSession($name = NULL) { - return new WebDriverWebAssert($this->getSession($name), $this->baseUrl); - } - - /** - * Gets the current Drupal javascript settings and parses into an array. - * - * Unlike BrowserTestBase::getDrupalSettings(), this implementation reads the - * current values of drupalSettings, capturing all changes made via javascript - * after the page was loaded. - * - * @return array - * The Drupal javascript settings array. - * - * @see \Drupal\Tests\BrowserTestBase::getDrupalSettings() - */ - protected function getDrupalSettings() { - $script = <<getSession()->evaluateScript($script) ?: []; - } - - /** - * {@inheritdoc} - */ - protected function getHtmlOutputHeaders() { - // The webdriver API does not support fetching headers. - return ''; + // Return a WebAssert that supports status code and header assertions. + return new JSWebAssert($this->getSession($name), $this->baseUrl); } } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php deleted file mode 100644 index b3baf6e2d3..0000000000 --- a/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php +++ /dev/null @@ -1,27 +0,0 @@ -getSession($name), $this->baseUrl); - } - -} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php index 36f6340f72..6dd591f5fe 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php @@ -3,14 +3,14 @@ namespace Drupal\FunctionalJavascriptTests\Tests; use Behat\Mink\Element\NodeElement; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests for the JSWebAssert class. * * @group javascript */ -class JSWebAssertTest extends JavascriptTestBase { +class JSWebAssertTest extends WebDriverTestBase { /** * Required modules. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php new file mode 100644 index 0000000000..d7d3f8ad8a --- /dev/null +++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php @@ -0,0 +1,200 @@ +minkDefaultDriverClass === DrupalSelenium2Driver::class) { + $this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444/']; + } + elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { + // Set up the template cache used by the PhantomJS mink driver. + $path = $this->tempFilesDirectory . DIRECTORY_SEPARATOR . 'browsertestbase-templatecache'; + $this->minkDefaultDriverArgs = [ + 'http://127.0.0.1:8510', + $path, + ]; + if (!file_exists($path)) { + mkdir($path); + } + } + + try { + return parent::initMink(); + } + catch (DeadClient $e) { + $this->markTestSkipped('PhantomJS is either not installed or not running. Start it via phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768&'); + } + catch (\Exception $e) { + $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage()); + } + } + + /** + * {@inheritdoc} + */ + protected function tearDown() { + if ($this->mink) { + // Wait for all requests to finish. It is possible that an AJAX request is + // still on-going. + $result = $this->getSession()->wait(5000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))'); + if (!$result) { + // If the wait is unsuccessful, there may still be an AJAX request in + // progress. If we tear down now, then this AJAX request may fail with + // missing database tables, because tear down will have removed them. + // Rather than allow it to fail, throw an explicit exception now + // explaining what the problem is. + throw new \RuntimeException('Unfinished AJAX requests while tearing down a test'); + } + } + parent::tearDown(); + } + + /** + * {@inheritdoc} + */ + protected function getMinkDriverArgs() { + if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) { + return getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); + } + elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { + return getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); + } + return parent::getMinkDriverArgs(); + } + + /** + * Asserts that the element with the given CSS selector is visible. + * + * @param string $css_selector + * The CSS selector identifying the element to check. + * @param string $message + * Optional message to show alongside the assertion. + * + * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use + * \Behat\Mink\Element\NodeElement::isVisible() instead. + */ + protected function assertElementVisible($css_selector, $message = '') { + $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message); + } + + /** + * Asserts that the element with the given CSS selector is not visible. + * + * @param string $css_selector + * The CSS selector identifying the element to check. + * @param string $message + * Optional message to show alongside the assertion. + * + * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use + * \Behat\Mink\Element\NodeElement::isVisible() instead. + */ + protected function assertElementNotVisible($css_selector, $message = '') { + $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message); + } + + /** + * Waits for the given time or until the given JS condition becomes TRUE. + * + * @param string $condition + * JS condition to wait until it becomes TRUE. + * @param int $timeout + * (Optional) Timeout in milliseconds, defaults to 10000. + * @param string $message + * (optional) A message to display with the assertion. If left blank, a + * default message will be displayed. + * + * @throws \PHPUnit_Framework_AssertionFailedError + * + * @see \Behat\Mink\Driver\DriverInterface::evaluateScript() + */ + protected function assertJsCondition($condition, $timeout = 10000, $message = '') { + $message = $message ?: "Javascript condition met:\n" . $condition; + $result = $this->getSession()->getDriver()->wait($timeout, $condition); + $this->assertTrue($result, $message); + } + + /** + * Creates a screenshot. + * + * @param string $filename + * The file name of the resulting screenshot. If using the default phantomjs + * driver then this should be a JPG filename. + * @param bool $set_background_color + * (optional) By default this method will set the background color to white. + * Set to FALSE to override this behaviour. + * + * @throws \Behat\Mink\Exception\UnsupportedDriverActionException + * When operation not supported by the driver. + * @throws \Behat\Mink\Exception\DriverException + * When the operation cannot be done. + */ + protected function createScreenshot($filename, $set_background_color = TRUE) { + $session = $this->getSession(); + if ($set_background_color) { + $session->executeScript("document.body.style.backgroundColor = 'white';"); + } + $image = $session->getScreenshot(); + file_put_contents($filename, $image); + } + + /** + * {@inheritdoc} + */ + public function assertSession($name = NULL) { + return new WebDriverWebAssert($this->getSession($name), $this->baseUrl); + } + + /** + * Gets the current Drupal javascript settings and parses into an array. + * + * Unlike BrowserTestBase::getDrupalSettings(), this implementation reads the + * current values of drupalSettings, capturing all changes made via javascript + * after the page was loaded. + * + * @return array + * The Drupal javascript settings array. + * + * @see \Drupal\Tests\BrowserTestBase::getDrupalSettings() + */ + protected function getDrupalSettings() { + $script = <<getSession()->evaluateScript($script) ?: []; + } + + /** + * {@inheritdoc} + */ + protected function getHtmlOutputHeaders() { + // The webdriver API does not support fetching headers. + return ''; + } + +}