// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {assert} from 'chai';
import {describe, it} from 'mocha';

import {enableExperiment} from '../../shared/helper.js';
import {getPlayerButtonText, playMediaFile} from '../helpers/media-helpers.js';
import {openPanelViaMoreTools} from '../helpers/settings-helpers.js';

function shouldRunTest() {
  const features = process.env['CHROME_FEATURES'];
  return features !== undefined && features.includes('MediaInspectorLogging');
}

describe('Media Tab', () => {
  beforeEach(async () => {
    await enableExperiment('mediaInspector');
  });

  it('ensures video playback adds entry', async () => {
    if (!shouldRunTest()) {
      return;
    }

    await openPanelViaMoreTools('Media');
    await playMediaFile('fisch.webm');
    const entryName = await getPlayerButtonText();

    // Names are glitched right now, and display 32-character unguessable tokens.
    assert.strictEqual(entryName.length, 32);
  });
});

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {assert} from 'chai';
import {describe, it} from 'mocha';

import {getPlayerButtonText, playMediaFile} from '../helpers/media-helpers.js';
import {openPanelViaMoreTools} from '../helpers/settings-helpers.js';

describe('Media Tab', () => {
  it('ensures video playback adds entry', async () => {
    await openPanelViaMoreTools('Media');
    await playMediaFile('fisch.webm');
    const entryName = await getPlayerButtonText();

    // Names are glitched right now, and display 32-character unguessable tokens.
    assert.strictEqual(entryName.length, 32);
  });
});

Remove need for media flag for media e2e tests
Remove need for media flag for media e2e tests

When I wrote the test, the chrome feature was still behind a flag.
It isn't behind a flag anymore, so it should run always.

Change-Id: Ide674bb7adf94cd5c0b194ede310c7452d96d0fe
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2290578
Commit-Queue: Tim van der Lippe <dba8716ee7f8d16236046f74d2167cb94410f6ed@chromium.org>
Auto-Submit: Ted Meyer <49f16de1701e9d27e09eb331529eeca82ecbab45@chromium.org>
Reviewed-by: Tim van der Lippe <dba8716ee7f8d16236046f74d2167cb94410f6ed@chromium.org>
