Unverified Commit 64de78be authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3278418 by danflanagan8, quietone, nod_: Media Library Tests should not rely on Classy

(cherry picked from commit f3841114)
parent bb7750ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class ContentModerationTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * User with the 'administer media' permission.
+13 −0
Original line number Diff line number Diff line
@@ -19,6 +19,19 @@ class EntityReferenceWidgetTest extends MediaLibraryTestBase {
   */
  protected static $modules = ['field_ui'];

  /**
   * The theme to install as the default for testing.
   *
   * @var string
   *
   * @todo This test's reliance on classes in order to assert the order of
   *   field items makes Stark a bad fit as a base theme. Change the default
   *   theme to Starterkit once it is stable.
   *
   *  @see https://www.drupal.org/project/drupal/issues/3281695
   */
  protected $defaultTheme = 'classy';

  /**
   * Test media items.
   *
+5 −0
Original line number Diff line number Diff line
@@ -14,6 +14,11 @@ class FieldUiIntegrationTest extends MediaLibraryTestBase {
   */
  protected static $modules = ['field_ui'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ abstract class MediaLibraryTestBase extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * Create media items.
@@ -333,7 +333,6 @@ protected function assertMediaAdded($index = 0) {
    $assert_session->elementNotExists('css', '[data-drupal-selector$="preview"]', $fields);
    $assert_session->buttonNotExists('Remove', $fields);
    $assert_session->elementNotExists('css', '[data-drupal-selector$="filename"]', $fields);
    $assert_session->elementNotExists('css', '.file-size', $fields);
  }

  /**
+12 −3
Original line number Diff line number Diff line
@@ -14,6 +14,11 @@ class MediaOverviewTest extends MediaLibraryTestBase {
   */
  protected static $modules = ['block'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
@@ -64,7 +69,7 @@ public function testAdministrationPage() {
    $assert_session->linkExists('Table');

    // We should see the table view and a link to add media.
    $assert_session->elementExists('css', '.view-media .views-table');
    $assert_session->elementExists('css', '[data-drupal-selector="views-form-media-media-page-list"] table');
    $assert_session->linkExists('Add media');

    // Go to the grid display for the rest of the test.
@@ -78,8 +83,12 @@ public function testAdministrationPage() {
    $assert_session->pageTextContains('Dog');
    $assert_session->pageTextContains('Turtle');

    // Verify that the media name does not contain a link.
    $assert_session->elementNotExists('css', '.media-library-item__name a');
    // Verify that the media name does not contain a link. The selector is
    // tricky, so start by asserting ".js-media-library-item-preview + div"
    // can select a div containing a media name.
    $assert_session->elementExists('css', '.js-media-library-item-preview + div:contains("Dog")');
    $assert_session->elementExists('css', '.js-media-library-item-preview + div:contains("Turtle")');
    $assert_session->elementNotExists('css', '.js-media-library-item-preview + div a');
    // Verify that there are links to edit and delete media items.
    $assert_session->linkExists('Edit Dog');
    $assert_session->linkExists('Delete Turtle');
Loading