summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-07-04 07:16:25 (GMT)
committerAlex Pott2018-07-04 07:16:25 (GMT)
commitf55d974612094a9f3e5a6dd25d95575ca752de19 (patch)
tree1a9a3039f1898cafe6ff8682ec86650b39f736df
parent7a615251d8c2115b510dd47e2c6fe5b787990895 (diff)
Issue #2942900 by Mixologic, vaplas, jibran, Lendude, martin107, alexpott, dawehner, tedbow, tacituseu, tstoeckler, heddn: Convert JavascriptTestBase Tests to use DrupalSelenium2Driver
-rw-r--r--core/drupalci.yml2
-rw-r--r--core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php12
-rw-r--r--core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php4
-rw-r--r--core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php4
-rw-r--r--core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php4
-rw-r--r--core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php4
-rw-r--r--core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php9
-rw-r--r--core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php4
-rw-r--r--core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php4
-rw-r--r--core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php4
-rw-r--r--core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php4
-rw-r--r--core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php4
-rw-r--r--core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php4
-rw-r--r--core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php10
-rw-r--r--core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php13
-rw-r--r--core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php4
-rw-r--r--core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php4
-rw-r--r--core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php10
-rw-r--r--core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php9
-rw-r--r--core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php4
-rw-r--r--core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php4
-rw-r--r--core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php1
-rw-r--r--core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php4
-rw-r--r--core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php4
-rw-r--r--core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php6
-rw-r--r--core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php4
-rw-r--r--core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php6
-rw-r--r--core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php4
-rw-r--r--core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php12
-rw-r--r--core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php1
-rw-r--r--core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php2
-rw-r--r--core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php10
-rw-r--r--core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php19
-rw-r--r--core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php4
-rw-r--r--core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php6
-rw-r--r--core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php4
-rw-r--r--core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php4
-rw-r--r--core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php5
-rw-r--r--core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php23
-rw-r--r--core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php4
-rw-r--r--core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php4
-rw-r--r--core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php9
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php4
-rw-r--r--core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php4
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php4
-rw-r--r--core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php24
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php10
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php10
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php9
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php191
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php20
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php110
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php202
74 files changed, 553 insertions, 380 deletions
diff --git a/core/drupalci.yml b/core/drupalci.yml
index b658e47..b539d56 100644
--- a/core/drupalci.yml
+++ b/core/drupalci.yml
@@ -47,7 +47,7 @@ build:
# Functional JavaScript tests require a concurrency of 1 because there is
# only one instance of PhantomJS on the testbot machine.
run_tests.javascript:
- concurrency: 1
+ concurrency: 15
types: 'PHPUnit-FunctionalJavascript'
testgroups: '--all'
suppress-deprecations: false
diff --git a/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php b/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
index bc314a5..f4c85fc 100644
--- a/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
+++ b/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
@@ -3,7 +3,7 @@
namespace Drupal\Tests\action\FunctionalJavascript;
use Drupal\Core\Url;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\system\Entity\Action;
/**
@@ -11,7 +11,7 @@ use Drupal\system\Entity\Action;
*
* @group action
*/
-class ActionFormAjaxTest extends JavascriptTestBase {
+class ActionFormAjaxTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -33,16 +33,15 @@ class ActionFormAjaxTest extends JavascriptTestBase {
public function testActionConfigurationWithAjax() {
$url = Url::fromRoute('action.admin_add', ['action_id' => 'action_form_ajax_test']);
$this->drupalGet($url);
- $this->assertSession()->statusCodeEquals(200);
$page = $this->getSession()->getPage();
$id = 'test_plugin';
- $page->find('css', '[name="id"]')
- ->setValue($id);
+ $this->assertSession()->waitForElementVisible('named', ['button', 'Edit'])->press();
+ $this->assertSession()->waitForElementVisible('css', '[name="id"]')->setValue($id);
$page->find('css', '[name="having_a_party"]')
->check();
- $this->assertSession()->waitForElement('css', '[name="party_time"]');
+ $this->assertSession()->waitForElementVisible('css', '[name="party_time"]');
$party_time = 'Evening';
$page->find('css', '[name="party_time"]')
@@ -54,7 +53,6 @@ class ActionFormAjaxTest extends JavascriptTestBase {
$url = Url::fromRoute('entity.action.collection');
$this->assertSession()->pageTextContains('The action has been successfully saved.');
$this->assertSession()->addressEquals($url);
- $this->assertSession()->statusCodeEquals(200);
// Check storage.
$instance = Action::load($id);
diff --git a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
index b4da7b0..f4cd510 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\comment\Tests\CommentTestTrait;
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 @@ use Drupal\simpletest\NodeCreationTrait;
*
* @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 b64f7c1..e9ecc06 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 d8d406b..dc9b812 100644
--- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
+++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
@@ -4,7 +4,7 @@ namespace Drupal\Tests\book\FunctionalJavascript;
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 @@ use Drupal\node\Entity\Node;
*
* @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 b15433d..ddb53d8 100644
--- a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
+++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
@@ -4,14 +4,14 @@ namespace Drupal\Tests\ckeditor\FunctionalJavascript;
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 80de46d..a9ee697 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\editor\Entity\Editor;
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 @@ use Drupal\node\Entity\NodeType;
*
* @group ckeditor
*/
-class CKEditorIntegrationTest extends JavascriptTestBase {
+class CKEditorIntegrationTest extends WebDriverTestBase {
/**
* The account.
@@ -92,9 +92,10 @@ class CKEditorIntegrationTest extends JavascriptTestBase {
$session->getPage();
// Add a bottom margin to the title field to be sure the body field is not
- // visible. PhantomJS runs with a resolution of 1024x768px.
- $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = '800px';");
+ // visible.
+ $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = window.innerHeight*2 +'px';");
+ $this->assertSession()->waitForElementVisible('css', $ckeditor_id);
// Check that the CKEditor-enabled body field is currently not visible in
// the viewport.
$web_assert->assertNotVisibleInViewport('css', $ckeditor_id, 'topLeft', 'CKEditor-enabled body field is visible.');
diff --git a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php
index 110c9f8..f7e6dc8 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 13e1b54..585d2d1 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 b095399..156b10d 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 @@ use Drupal\language\Entity\ConfigurableLanguage;
*
* @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 de83692..7435dad 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 @@ use Drupal\user\Entity\Role;
*
* @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 a61ea8a..4a00a7e 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 64ee24d..0561d73 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\Entity\Entity\EntityFormDisplay;
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 162d223..9e65b27 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}
@@ -100,12 +100,15 @@ class FieldLayoutTest extends JavascriptTestBase {
// After a refresh the new regions are still there.
$this->drupalGet('entity_test/structure/entity_test/form-display');
$this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
+ $this->assertSession()->waitForElement('css', '.tabledrag-handle');
+ $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
// Drag the field to the second region.
$field_test_text_row = $this->getSession()->getPage()->find('css', '#field-test-text');
$second_region_row = $this->getSession()->getPage()->find('css', '.region-second-message');
$field_test_text_row->find('css', '.handle')->dragTo($second_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
+ $this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
@@ -158,6 +161,8 @@ class FieldLayoutTest extends JavascriptTestBase {
// After a refresh the new regions are still there.
$this->drupalGet('entity_test/structure/entity_test/display');
$this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
+ $this->assertSession()->waitForElement('css', '.tabledrag-handle');
+ $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
// Drag the field to the first region.
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
@@ -166,6 +171,7 @@ class FieldLayoutTest extends JavascriptTestBase {
$field_test_text_row->find('css', '.handle')->dragTo($first_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertFalse($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
+ $this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
index ae2c56c..7909f0f 100644
--- a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
@@ -3,14 +3,14 @@
namespace Drupal\Tests\field_ui\FunctionalJavascript;
use Drupal\entity_test\Entity\EntityTest;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the UI for entity displays.
*
* @group field_ui
*/
-class EntityDisplayTest extends JavascriptTestBase {
+class EntityDisplayTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -50,7 +50,8 @@ class EntityDisplayTest extends JavascriptTestBase {
$this->drupalGet('entity_test/structure/entity_test/form-display');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
-
+ $this->getSession()->getPage()->pressButton('Show row weights');
+ $this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
$this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'hidden');
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
@@ -72,6 +73,8 @@ class EntityDisplayTest extends JavascriptTestBase {
$this->drupalGet('entity_test/structure/entity_test/display');
$this->assertSession()->elementExists('css', '.region-content-message.region-empty');
+ $this->getSession()->getPage()->pressButton('Show row weights');
+ $this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
$this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'content');
@@ -92,12 +95,16 @@ class EntityDisplayTest extends JavascriptTestBase {
public function testExtraFields() {
entity_test_create_bundle('bundle_with_extra_fields');
$this->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
+ $this->assertSession()->waitForElement('css', '.tabledrag-handle');
+ $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
$extra_field_row = $this->getSession()->getPage()->find('css', '#display-extra-field');
$disabled_region_row = $this->getSession()->getPage()->find('css', '.region-hidden-title');
$extra_field_row->find('css', '.handle')->dragTo($disabled_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
+ $this->assertSession()
+ ->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
diff --git a/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php b/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
index 2e4cb69..99acc37 100644
--- a/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
+++ b/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\file\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\file\Functional\FileFieldCreationTrait;
use Drupal\Tests\TestFileCreationTrait;
@@ -12,7 +12,7 @@ use Drupal\Tests\TestFileCreationTrait;
*
* @group file
*/
-class FileFieldValidateTest extends JavascriptTestBase {
+class FileFieldValidateTest extends WebDriverTestBase {
use FileFieldCreationTrait;
use TestFileCreationTrait;
diff --git a/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php b/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
index 7ccd2b2..45c8bf5 100644
--- a/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
+++ b/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
@@ -3,7 +3,7 @@
namespace Drupal\Tests\file\FunctionalJavascript;
use Drupal\Component\Utility\Bytes;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\TestFileCreationTrait;
use Drupal\Tests\file\Functional\FileFieldCreationTrait;
@@ -12,7 +12,7 @@ use Drupal\Tests\file\Functional\FileFieldCreationTrait;
*
* @group file
*/
-class MaximumFileSizeExceededUploadTest extends JavascriptTestBase {
+class MaximumFileSizeExceededUploadTest extends WebDriverTestBase {
use FileFieldCreationTrait;
use TestFileCreationTrait;
diff --git a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
index a4af78b..4e21f6a 100644
--- a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
+++ b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
@@ -2,15 +2,14 @@
namespace Drupal\Tests\image\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\image\Kernel\ImageFieldCreationTrait;
use Drupal\Tests\TestFileCreationTrait;
/**
* This class provides methods specifically for testing Image's field handling.
*/
-abstract class ImageFieldTestBase extends JavascriptTestBase {
+abstract class ImageFieldTestBase extends WebDriverTestBase {
use ImageFieldCreationTrait;
use TestFileCreationTrait {
@@ -30,11 +29,6 @@ abstract class ImageFieldTestBase extends JavascriptTestBase {
];
/**
- * {@inheritdoc}
- */
- protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
-
- /**
* An user with permissions to administer content types and image styles.
*
* @var \Drupal\user\UserInterface
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 2007e1e..7c9a74a 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\editor\Entity\Editor;
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 @@ use Drupal\node\Entity\NodeType;
*
* @group ckeditor
*/
-class FormErrorHandlerCKEditorTest extends JavascriptTestBase {
+class FormErrorHandlerCKEditorTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -87,9 +87,10 @@ class FormErrorHandlerCKEditorTest extends JavascriptTestBase {
$this->submitForm($edit, 'Save');
+ $this->assertSession()->waitForElement('css', '#cke_edit-body-0-value');
// Add a bottom margin to the title field to be sure the body field is not
- // visible. PhantomJS runs with a resolution of 1024x768px.
- $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = '800px';");
+ // visible.
+ $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = window.innerHeight*2 + 'px';");
// Check that the CKEditor-enabled body field is currently not visible in
// the viewport.
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 b956ccc..00dc3d3 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 @@ use Drupal\node\Entity\NodeType;
*
* @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 4f086d6..f2ecd52 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 @@ namespace Drupal\Tests\layout_builder\FunctionalJavascript;
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 30b6204..76b1bad 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
@@ -55,6 +55,7 @@ class MediaDisplayTest extends MediaJavascriptTestBase {
// Enable the field on the display and verify it becomes visible on the UI.
$this->drupalGet("/admin/structure/media/manage/{$media_type->id()}/display");
$assert_session->buttonExists('Show row weights')->press();
+ $this->assertSession()->waitForElementVisible('css', '[name="fields[name][region]"]');
$page->selectFieldOption('fields[name][region]', 'content');
$assert_session->waitForElementVisible('css', '#edit-fields-name-settings-edit');
$page->pressButton('Save');
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php b/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php
index e84db38..f8c04d1 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\MediaFunctionalTestTrait;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
/**
* Base class for Media functional JavaScript tests.
*/
-abstract class MediaJavascriptTestBase extends JavascriptTestBase {
+abstract class MediaJavascriptTestBase extends WebDriverTestBase {
use MediaFunctionalTestTrait;
use MediaTypeCreationTrait;
diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
index f8604e6..154a1d2 100644
--- a/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
+++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\media_library\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\media\Entity\Media;
/**
@@ -10,7 +10,7 @@ use Drupal\media\Entity\Media;
*
* @group media_library
*/
-class MediaLibraryTest extends JavascriptTestBase {
+class MediaLibraryTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php b/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
index 6ce4ccc..2295932 100644
--- a/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
+++ b/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\menu_ui\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\system\Entity\Menu;
use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
use Drupal\Tests\menu_ui\Traits\MenuUiTrait;
@@ -12,7 +12,7 @@ use Drupal\Tests\menu_ui\Traits\MenuUiTrait;
*
* @group menu_ui
*/
-class MenuUiJavascriptTest extends JavascriptTestBase {
+class MenuUiJavascriptTest extends WebDriverTestBase {
use ContextualLinkClickTrait;
use MenuUiTrait;
@@ -123,7 +123,6 @@ class MenuUiJavascriptTest extends JavascriptTestBase {
protected function addMenuLink($parent = '', $path = '/', $menu_id = 'tools', $expanded = FALSE, $weight = '0') {
// View add menu link page.
$this->drupalGet("admin/structure/menu/manage/$menu_id/add");
- $this->assertSession()->statusCodeEquals(200);
$title = '!link_' . $this->randomMachineName(16);
$edit = [
@@ -138,7 +137,6 @@ class MenuUiJavascriptTest extends JavascriptTestBase {
// Add menu link.
$this->drupalPostForm(NULL, $edit, 'Save');
- $this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains('The menu link has been saved.');
$storage = $this->container->get('entity_type.manager')->getStorage('menu_link_content');
diff --git a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
index 8eb7a26..e1c1850 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/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
index 4760ee6..aef0c1e 100644
--- a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
+++ b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
@@ -2,14 +2,14 @@
namespace Drupal\Tests\node\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript updating of summaries on content type form.
*
* @group node
*/
-class TestSettingSummariesContentType extends JavascriptTestBase {
+class TestSettingSummariesContentType extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -33,6 +33,8 @@ class TestSettingSummariesContentType extends JavascriptTestBase {
public function testWorkflowSummary() {
$this->drupalGet('admin/structure/types/manage/test');
$page = $this->getSession()->getPage();
+ $page->find('css', 'a[href="#edit-workflow"]')->click();
+ $this->assertSession()->waitForElementVisible('css', '[name="options[status]"]');
$page->findField('options[status]')->uncheck();
$page->findField('options[sticky]')->check();
$page->findField('options[promote]')->check();
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
index 3e60470..7555220 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
@@ -4,7 +4,7 @@ namespace Drupal\Tests\quickedit\FunctionalJavascript;
use Drupal\editor\Entity\Editor;
use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
@@ -14,7 +14,7 @@ use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
*
* @group quickedit
*/
-class FieldTest extends JavascriptTestBase {
+class FieldTest extends WebDriverTestBase {
use ContextualLinkClickTrait;
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
index cb40a83..8c939b3 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
@@ -2,21 +2,13 @@
namespace Drupal\Tests\quickedit\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use WebDriver\Key;
/**
* Base class for testing the QuickEdit.
*/
-class QuickEditJavascriptTestBase extends JavascriptTestBase {
-
- /**
- * {@inheritdoc}
- *
- * @todo: Remove after https://www.drupal.org/project/drupal/issues/2942900
- */
- protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
+class QuickEditJavascriptTestBase extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
index 8646b93..6b15be9 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
@@ -51,6 +51,7 @@ class ConfigAccessTest extends SettingsTrayTestBase {
// permission.
$web_assert->fieldNotExists('settings[site_information][site_name]');
$page->pressButton('Save Site branding');
+ $this->waitForOffCanvasToClose();
$this->assertElementVisibleAfterWait('css', 'div:contains(The block configuration has been saved)');
$web_assert->assertWaitOnAjaxRequest();
// Confirm we did not save changes to the configuration.
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
index d30562f..6f623cb 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
@@ -134,6 +134,8 @@ class QuickEditIntegrationTest extends SettingsTrayTestBase {
$this->placeBlock('block_content:' . $block_content->uuid(), ['id' => 'custom']);
$this->drupalGet('user');
$page = $this->getSession()->getPage();
+ $this->toggleContextualTriggerVisibility('#block-custom');
+ $page->find('css', '#block-custom .contextual button')->press();
$links = $page->findAll('css', "#block-custom .contextual-links li a");
$link_labels = [];
/** @var \Behat\Mink\Element\NodeElement $link */
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
index 106dae4..0e6b9d6 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
@@ -67,8 +67,8 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase {
$block_id = $block->id();
$this->drupalGet('user');
- $link = $page->find('css', "$block_selector .contextual-links li a");
- $this->assertEquals('Quick edit', $link->getText(), "'Quick edit' is the first contextual link for the block.");
+ $link = $web_assert->waitForElement('css', "$block_selector .contextual-links li a");
+ $this->assertEquals('Quick edit', $link->getHtml(), "'Quick edit' is the first contextual link for the block.");
$this->assertContains("/admin/structure/block/manage/$block_id/settings-tray?destination=user/2", $link->getAttribute('href'));
if (isset($toolbar_item)) {
@@ -138,9 +138,11 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase {
$this->getSession()->executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));');
$this->waitForOffCanvasToClose();
$this->getSession()->wait(100);
+ $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
+ $this->getSession()->getPage()->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
$this->assertEditModeDisabled();
- $web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.');
- $web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing');
+ $this->assertNotEmpty($web_assert->waitForElement('css', '#drupal-live-announce:contains(Exited edit mode)'));
+ $this->waitForNoElement('.contextual-toolbar-tab button:contains(Editing)');
$web_assert->elementAttributeNotContains('css', '.dialog-off-canvas-main-canvas', 'class', 'js-settings-tray-edit-mode');
// Clean up test data so each test does not impact the next.
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
index 448fd21..2017acc 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
@@ -49,7 +49,9 @@ class SettingsTrayTestBase extends OffCanvasTestBase {
$this->assertElementVisibleAfterWait('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode');
// Ensure that all other Ajax activity is completed.
$this->assertSession()->assertWaitOnAjaxRequest();
- $this->click($block_selector);
+ $block = $this->getSession()->getPage()->find('css', $block_selector);
+ $block->mouseOver();
+ $block->click();
$this->waitForOffCanvasToOpen();
$this->assertOffCanvasBlockFormIsValid();
}
@@ -79,6 +81,8 @@ class SettingsTrayTestBase extends OffCanvasTestBase {
$edit_button = $this->getSession()
->getPage()
->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR);
+ $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
+ $edit_button->mouseOver();
$edit_button->press();
}
@@ -87,6 +91,12 @@ class SettingsTrayTestBase extends OffCanvasTestBase {
*/
protected function assertEditModeDisabled() {
$web_assert = $this->assertSession();
+ $page = $this->getSession()->getPage();
+ $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
+ $page->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
+ $this->assertTrue($page->waitFor(10, function ($page) {
+ return !$page->find('css', '.contextual .trigger:not(.visually-hidden)');
+ }));
// Contextual triggers should be hidden.
$web_assert->elementExists('css', '.contextual .trigger.visually-hidden');
// No contextual triggers should be not hidden.
@@ -103,6 +113,13 @@ class SettingsTrayTestBase extends OffCanvasTestBase {
*/
protected function assertEditModeEnabled() {
$web_assert = $this->assertSession();
+ $page = $this->getSession()->getPage();
+ // Move the mouse over the toolbar button so that isn't over a contextual
+ // links area which cause the contextual link to be shown.
+ $page->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
+ $this->assertTrue($page->waitFor(10, function ($page) {
+ return !$page->find('css', '.contextual .trigger.visually-hidden');
+ }));
// No contextual triggers should be hidden.
$web_assert->elementNotExists('css', '.contextual .trigger.visually-hidden');
// The toolbar edit button should read "Editing".
diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php
index 2439799..945afe9 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('<front>');
diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php
index 0048159..fbe9b73 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/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php b/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
index b00f0ed..acd103e 100644
--- a/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
+++ b/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
@@ -3,7 +3,7 @@
namespace Drupal\Tests\statistics\FunctionalJavascript;
use Drupal\Core\Session\AccountInterface;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\Entity\Role;
@@ -12,7 +12,7 @@ use Drupal\user\Entity\Role;
*
* @group system
*/
-class StatisticsLoggingTest extends JavascriptTestBase {
+class StatisticsLoggingTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php b/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php
index 7c0aec0..3597ba4 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/system/tests/src/FunctionalJavascript/OffCanvasTest.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
index 7719634..c42d777 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
@@ -50,7 +50,7 @@ class OffCanvasTest extends OffCanvasTestBase {
if ($link_index == '2') {
// Check no title behavior.
$web_assert->elementExists('css', '.ui-dialog-empty-title');
- $this->assertEquals("\xc2\xa0", $header_text);
+ $this->assertEquals(' ', $header_text);
$style = $page->find('css', '.ui-dialog-off-canvas')->getAttribute('style');
$this->assertTrue(strstr($style, 'width: 555px;') !== FALSE, 'Dialog width respected.');
@@ -127,6 +127,9 @@ class OffCanvasTest extends OffCanvasTestBase {
$this->waitForOffCanvasToOpen();
// Check that the main canvas is padded when page is not narrow width and
// tray is open.
+ $page->waitFor(10, function ($page) {
+ return $page->find('css', '.dialog-off-canvas-main-canvas')->hasAttribute('style');
+ });
$web_assert->elementAttributeContains('css', '.dialog-off-canvas-main-canvas', 'style', 'padding-right');
// Testing at the narrower width.
diff --git a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
index 293d9f7..b2e6c2b 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
@@ -2,12 +2,12 @@
namespace Drupal\Tests\system\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Base class contains common test functionality for the Off-canvas dialog.
*/
-abstract class OffCanvasTestBase extends JavascriptTestBase {
+abstract class OffCanvasTestBase extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -106,8 +106,22 @@ abstract class OffCanvasTestBase extends JavascriptTestBase {
* @todo Remove in https://www.drupal.org/node/2892440.
*/
protected function waitForNoElement($selector, $timeout = 10000) {
- $condition = "(typeof jQuery !== 'undefined' && jQuery('$selector').length === 0)";
- $this->assertJsCondition($condition, $timeout);
+
+ $start = microtime(TRUE);
+ $end = $start + ($timeout / 1000);
+ $page = $this->getSession()->getPage();
+
+ do {
+ $result = $page->find('css', $selector);
+
+ if (empty($result)) {
+ return;
+ }
+
+ usleep(100000);
+ } while (microtime(TRUE) < $end);
+
+ $this->assertEmpty($result, 'Element was not on the page after wait.');
}
/**
@@ -132,6 +146,7 @@ abstract class OffCanvasTestBase extends JavascriptTestBase {
* (Optional) Timeout in milliseconds, defaults to 10000.
*/
protected function assertElementVisibleAfterWait($selector, $locator, $timeout = 10000) {
+ $this->assertSession()->assertWaitOnAjaxRequest();
$this->assertNotEmpty($this->assertSession()->waitForElementVisible($selector, $locator, $timeout));
}
diff --git a/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php b/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
index 8e4729f..4f3e9f1 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
@@ -3,7 +3,7 @@
namespace Drupal\Tests\system\FunctionalJavascript;
use Drupal\file\Entity\File;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\TestFileCreationTrait;
/**
@@ -11,7 +11,7 @@ use Drupal\Tests\TestFileCreationTrait;
*
* @group system
*/
-class ThemeFormSettingsTest extends JavascriptTestBase {
+class ThemeFormSettingsTest extends WebDriverTestBase {
use TestFileCreationTrait;
diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
index 76fbcc7..88153ab 100644
--- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
+++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
@@ -3,14 +3,14 @@
namespace Drupal\Tests\text\FunctionalJavascript;
use Drupal\field\Entity\FieldConfig;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript functionality of the text_textarea_with_summary widget.
*
* @group text
*/
-class TextareaWithSummaryTest extends JavascriptTestBase {
+class TextareaWithSummaryTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
index c3b3d9a..fd16398 100644
--- a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
+++ b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
@@ -2,14 +2,14 @@
namespace Drupal\Tests\toolbar\FunctionalJavascript;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript functionality of the toolbar.
*
* @group toolbar
*/
-class ToolbarIntegrationTest extends JavascriptTestBase {
+class ToolbarIntegrationTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -27,7 +27,12 @@ class ToolbarIntegrationTest extends JavascriptTestBase {
]);
$this->drupalLogin($admin_user);
+ // Set size for horizontal toolbar.
+ $this->getSession()->resizeWindow(1200, 600);
$this->drupalGet('<front>');
+ $this->assertNotEmpty($this->assertSession()->waitForElement('css', 'body.toolbar-horizontal'));
+ $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '.toolbar-tray'));
+
$page = $this->getSession()->getPage();
// Test that it is possible to toggle the toolbar tray.
diff --git a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
index 0e5095d..085fd82 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 dc68468..6aa52bc 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 @@ use Drupal\simpletest\NodeCreationTrait;
*
* @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 594d6f7..d4760e5 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 b4372c6..de4efd2 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 dd1d1ae..f0ac608 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 76f0ff1..079fe99 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 @@ namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 9a9b2da..1bc8a48 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 c8d37f2..7dcaccd 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 @@ use Drupal\views\Tests\ViewTestData;
*
* @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 e48487a..9e303df 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 32b1a40..6f2f625 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 4cf51d5..b1b158b 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 86d3b6e..fc696c0 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 @@ use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
* @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 3fb1167..16369f1 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 @@ use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
* @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 c9c92f4..13973e0 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 @@ use Drupal\node\Entity\Node;
*
* @group standard
*/
-class StandardJavascriptTest extends JavascriptTestBase {
+class StandardJavascriptTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
index e13ecfd..ffdbd98 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
@@ -2,14 +2,14 @@
namespace Drupal\FunctionalJavascriptTests\Ajax;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests Ajax callbacks on FAPI elements.
*
* @group Ajax
*/
-class AjaxCallbacksTest extends JavascriptTestBase {
+class AjaxCallbacksTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -23,11 +23,9 @@ class AjaxCallbacksTest extends JavascriptTestBase {
// Test Ajax callback when date changes.
$this->drupalGet('ajax_forms_test_ajax_element_form');
- $this->assertSession()->responseContains('No date yet selected');
- $this->getSession()->getPage()->fillField('edit-date', '2016-01-01');
- $this->assertSession()->assertWaitOnAjaxRequest();
- $this->assertSession()->responseNotContains('No date yet selected');
- $this->assertSession()->responseContains('2016-01-01');
+ $this->assertNotEmpty($this->getSession()->getPage()->find('xpath', '//div[@id="ajax_date_value"][text()="No date yet selected"]'));
+ $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-date]").val("2016-01-01").trigger("change");');
+ $this->assertNotEmpty($this->assertSession()->waitForElement('xpath', '//div[@id="ajax_date_value"]/div[text()="2016-01-01"]'));
}
/**
@@ -37,14 +35,10 @@ class AjaxCallbacksTest extends JavascriptTestBase {
// Test Ajax callback when datetime changes.
$this->drupalGet('ajax_forms_test_ajax_element_form');
- $this->assertSession()->responseContains('No datetime selected.');
- $this->getSession()->getPage()->fillField('edit-datetime-date', '2016-01-01');
- $this->assertSession()->assertWaitOnAjaxRequest();
- $this->assertSession()->responseNotContains('No datetime selected.');
- $this->assertSession()->responseContains('2016-01-01');
- $this->getSession()->getPage()->fillField('edit-datetime-time', '12:00:00');
- $this->assertSession()->assertWaitOnAjaxRequest();
- $this->assertSession()->responseContains('2016-01-01 12:00:00');
+ $this->assertNotEmpty($this->getSession()->getPage()->find('xpath', '//div[@id="ajax_datetime_value"][text()="No datetime selected."]'));
+ $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-datetime-date]").val("2016-01-01");');
+ $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-datetime-time]").val("12:00:00").trigger("change");');
+ $this->assertNotEmpty($this->assertSession()->waitForElement('xpath', '//div[@id="ajax_datetime_value"]/div[text()="2016-01-01 12:00:00"]'));
}
}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
index 4811a35..bfd890a 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/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
index 3d174b0..06b64af 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
@@ -2,14 +2,14 @@
namespace Drupal\FunctionalJavascriptTests\Ajax;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Performs tests on AJAX forms in cached pages.
*
* @group Ajax
*/
-class AjaxFormPageCacheTest extends JavascriptTestBase {
+class AjaxFormPageCacheTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -41,7 +41,6 @@ class AjaxFormPageCacheTest extends JavascriptTestBase {
*/
public function testSimpleAJAXFormValue() {
$this->drupalGet('ajax_forms_test_get_form');
- $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
$build_id_initial = $this->getFormBuildId();
// Changing the value of a select input element, triggers a AJAX
@@ -77,7 +76,6 @@ class AjaxFormPageCacheTest extends JavascriptTestBase {
// Emulate a push of the reload button and then repeat the test sequence
// this time with a page loaded from the cache.
$session->reload();
- $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$build_id_from_cache_initial = $this->getFormBuildId();
$this->assertEquals($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request');
@@ -115,7 +113,9 @@ class AjaxFormPageCacheTest extends JavascriptTestBase {
$this->drupalGet('ajax_validation_test');
// Changing the value of the textfield will trigger an AJAX
// request/response.
- $this->getSession()->getPage()->fillField('drivertext', 'some dumb text');
+ $field = $this->getSession()->getPage()->findField('drivertext');
+ $field->setValue('some dumb text');
+ $field->blur();
// When the AJAX command updates the DOM a <ul> unsorted list
// "message__list" structure will appear on the page echoing back the
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
index e059405..fa2a3e4 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 077c3aa..9a45583 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/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
index e2ecaea..56715e6 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
@@ -2,20 +2,14 @@
namespace Drupal\FunctionalJavascriptTests\Ajax;
-use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the throbber.
*
* @group Ajax
*/
-class ThrobberTest extends JavascriptTestBase {
-
- /**
- * {@inheritdoc}
- */
- protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
+class ThrobberTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
index 92b3a73..1c76c26 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 efad210..a6c59d1 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\DependencyInjection\ContainerBuilder;
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 @@ use Symfony\Component\HttpFoundation\RequestStack;
*
* @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 bf2643d..71bdc98 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 fa2d541..f4a1800 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 @@ use Drupal\menu_link_content\Entity\MenuLinkContent;
*
* @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 19cf5a4..4bfe3e0 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/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
index 5f243af..f67e738 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
@@ -3,6 +3,7 @@
namespace Drupal\FunctionalJavascriptTests;
use Behat\Mink\Driver\Selenium2Driver;
+use WebDriver\ServiceFactory;
/**
* Provides a driver for Selenium testing.
@@ -12,6 +13,14 @@ class DrupalSelenium2Driver extends Selenium2Driver {
/**
* {@inheritdoc}
*/
+ public function __construct($browserName = 'firefox', $desiredCapabilities = NULL, $wdHost = 'http://localhost:4444/wd/hub') {
+ parent::__construct($browserName, $desiredCapabilities, $wdHost);
+ ServiceFactory::getInstance()->setServiceClass('service.curl', WebDriverCurlService::class);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function setCookie($name, $value = NULL) {
if ($value === NULL) {
$this->getWebDriverSession()->deleteCookie($name);
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
index 511dee6..3d0b402 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 @@ use Drupal\simpletest\NodeCreationTrait;
*
* @group entity_reference
*/
-class EntityReferenceAutocompleteWidgetTest extends JavascriptTestBase {
+class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase {
use ContentTypeCreationTrait;
use EntityReferenceTestTrait;
@@ -63,7 +63,7 @@ class EntityReferenceAutocompleteWidgetTest extends JavascriptTestBase {
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();
- $autocomplete_field = $page->findField($field_name . '[0][target_id]');
+ $autocomplete_field = $assert_session->waitForElement('css', '[name="' . $field_name . '[0][target_id]"].ui-autocomplete-input');
$autocomplete_field->setValue('Test');
$this->getSession()->getDriver()->keyDown($autocomplete_field->getXpath(), ' ');
$assert_session->waitOnAutocomplete();
@@ -87,7 +87,7 @@ class EntityReferenceAutocompleteWidgetTest extends JavascriptTestBase {
$this->drupalGet('node/add/page');
$page = $this->getSession()->getPage();
- $autocomplete_field = $page->findField($field_name . '[0][target_id]');
+ $autocomplete_field = $assert_session->waitForElement('css', '[name="' . $field_name . '[0][target_id]"].ui-autocomplete-input');
$autocomplete_field->setValue('Test');
$this->getSession()->getDriver()->keyDown($autocomplete_field->getXpath(), ' ');
$assert_session->waitOnAutocomplete();
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
index 44b83c1..b545f71 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
@@ -2,202 +2,33 @@
namespace Drupal\FunctionalJavascriptTests;
-use Drupal\Tests\BrowserTestBase;
-use Zumba\GastonJS\Exception\DeadClient;
+@trigger_error('The ' . __NAMESPACE__ . '\JavascriptTestBase is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.0. Instead, use ' . __NAMESPACE__ . '\WebDriverTestBase. See https://www.drupal.org/node/2945059', E_USER_DEPRECATED);
+
use Zumba\Mink\Driver\PhantomJSDriver;
/**
- * Runs a browser test using a driver that supports Javascript.
+ * Runs a browser test using PhantomJS.
*
* Base class for testing browser interaction implemented in JavaScript.
+ *
+ * @deprecated in Drupal 8.6.x, will be removed before Drupal 9.0.0.
+ * Use \Drupal\FunctionalJavascriptTests\WebDriverTestBase instead
+ *
+ * @see https://www.drupal.org/node/2945059
*/
-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.0, will be removed before Drupal 9.0.0. Use
- * \Behat\Mink\Element\NodeElement::isVisible() instead.
- */
- protected function assertElementVisible($css_selector, $message = '') {
- $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
- @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
- }
-
- /**
- * 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.0, will be removed before Drupal 9.0.0. Use
- * \Behat\Mink\Element\NodeElement::isVisible() instead.
- */
- protected function assertElementNotVisible($css_selector, $message = '') {
- $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
- @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
- }
-
- /**
- * 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 = <<<EndOfScript
-(function () {
- if (typeof drupalSettings !== 'undefined') {
- return drupalSettings;
- }
-})();
-EndOfScript;
-
- return $this->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
index b3baf6e..70869d0 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php
@@ -2,26 +2,14 @@
namespace Drupal\FunctionalJavascriptTests;
-use Zumba\Mink\Driver\PhantomJSDriver;
-
/**
* Runs a browser test using PhantomJS.
*
- * Base class for testing browser interaction implemented in JavaScript.
+ * @deprecated in Drupal 8.6.0, will be removed before Drupal 9.0.0.
+ * Use \Drupal\FunctionalJavascriptTests\WebDriverTestBase instead
+ *
+ * BC layer for testing browser interaction implemented in JavaScript.
*/
abstract class LegacyJavascriptTestBase extends JavascriptTestBase {
- /**
- * {@inheritdoc}
- */
- protected $minkDefaultDriverClass = PhantomJSDriver::class;
-
- /**
- * {@inheritdoc}
- */
- public function assertSession($name = NULL) {
- // 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/Tests/JSWebAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
index 36f6340..6dd591f 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/WebDriverCurlService.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php
new file mode 100644
index 0000000..13991af
--- /dev/null
+++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php
@@ -0,0 +1,110 @@
+<?php
+
+namespace Drupal\FunctionalJavascriptTests;
+
+use WebDriver\Service\CurlService;
+use WebDriver\Exception\CurlExec;
+use WebDriver\Exception as WebDriverException;
+
+/**
+ * Provides a curl service to interact with Selenium driver.
+ *
+ * Extends WebDriver\Service\CurlService to solve problem with race conditions,
+ * when multiple processes requests.
+ */
+class WebDriverCurlService extends CurlService {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function execute($requestMethod, $url, $parameters = NULL, $extraOptions = []) {
+ $extraOptions += [
+ CURLOPT_FAILONERROR => TRUE,
+ ];
+ $retries = 0;
+ while ($retries < 10) {
+ try {
+ $customHeaders = [
+ 'Content-Type: application/json;charset=UTF-8',
+ 'Accept: application/json;charset=UTF-8',
+ ];
+
+ $curl = curl_init($url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
+
+ switch ($requestMethod) {
+ case 'GET':
+ break;
+
+ case 'POST':
+ if ($parameters && is_array($parameters)) {
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
+ }
+ else {
+ $customHeaders[] = 'Content-Length: 0';
+ }
+
+ // Suppress "Expect: 100-continue" header automatically added by
+ // cURL that causes a 1 second delay if the remote server does not
+ // support Expect.
+ $customHeaders[] = 'Expect:';
+
+ curl_setopt($curl, CURLOPT_POST, TRUE);
+ break;
+
+ case 'DELETE':
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
+ break;
+
+ case 'PUT':
+ if ($parameters && is_array($parameters)) {
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
+ }
+ else {
+ $customHeaders[] = 'Content-Length: 0';
+ }
+
+ // Suppress "Expect: 100-continue" header automatically added by
+ // cURL that causes a 1 second delay if the remote server does not
+ // support Expect.
+ $customHeaders[] = 'Expect:';
+
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
+ break;
+ }
+
+ foreach ($extraOptions as $option => $value) {
+ curl_setopt($curl, $option, $value);
+ }
+
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $customHeaders);
+
+ $rawResult = trim(curl_exec($curl));
+
+ $info = curl_getinfo($curl);
+ $info['request_method'] = $requestMethod;
+
+ if (array_key_exists(CURLOPT_FAILONERROR, $extraOptions) && $extraOptions[CURLOPT_FAILONERROR] && CURLE_GOT_NOTHING !== ($errno = curl_errno($curl)) && $error = curl_error($curl)) {
+ curl_close($curl);
+
+ throw WebDriverException::factory(WebDriverException::CURL_EXEC, sprintf("Curl error thrown for http %s to %s%s\n\n%s", $requestMethod, $url, $parameters && is_array($parameters) ? ' with params: ' . json_encode($parameters) : '', $error));
+ }
+
+ curl_close($curl);
+
+ $result = json_decode($rawResult, TRUE);
+ if (isset($result['status']) && $result['status'] === WebDriverException::STALE_ELEMENT_REFERENCE) {
+ usleep(100000);
+ $retries++;
+ continue;
+ }
+ return [$rawResult, $info];
+ }
+ catch (CurlExec $exception) {
+ $retries++;
+ }
+ }
+ throw WebDriverException::factory(WebDriverException::CURL_EXEC, sprintf("Curl error thrown for http %s to %s%s\n\n%s", $requestMethod, $url, $parameters && is_array($parameters) ? ' with params: ' . json_encode($parameters) : '', $error));
+ }
+
+}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
new file mode 100644
index 0000000..1d32371
--- /dev/null
+++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
@@ -0,0 +1,202 @@
+<?php
+
+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.
+ *
+ * Base class for testing browser interaction implemented in JavaScript.
+ */
+abstract class WebDriverTestBase extends BrowserTestBase {
+
+ /**
+ * {@inheritdoc}
+ *
+ * To use a legacy phantomjs based approach, please use PhantomJSDriver::class.
+ */
+ protected $minkDefaultDriverClass = DrupalSelenium2Driver::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.0, will be removed before Drupal 9.0.0. Use
+ * \Behat\Mink\Element\NodeElement::isVisible() instead.
+ */
+ protected function assertElementVisible($css_selector, $message = '') {
+ $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
+ @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
+ }
+
+ /**
+ * 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.0, will be removed before Drupal 9.0.0. Use
+ * \Behat\Mink\Element\NodeElement::isVisible() instead.
+ */
+ protected function assertElementNotVisible($css_selector, $message = '') {
+ $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
+ @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
+ }
+
+ /**
+ * 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 = <<<EndOfScript
+(function () {
+ if (typeof drupalSettings !== 'undefined') {
+ return drupalSettings;
+ }
+})();
+EndOfScript;
+
+ return $this->getSession()->evaluateScript($script) ?: [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getHtmlOutputHeaders() {
+ // The webdriver API does not support fetching headers.
+ return '';
+ }
+
+}