<commit_before>let currentBrowser;

module.exports = {
  tags: ['component', 'video'],
  'Bolt Video Playback Rate': function(browser) {
    const { testingUrl } = browser.globals;
    console.log(`global browser url: ${testingUrl}`);
    currentBrowser = '--' + browser.currentEnv || 'chrome';
    let testName = 'bolt-video-playback-rate';

    browser
      .url(
        `${testingUrl}/pattern-lab/patterns/02-components-video-35-video-with-inline-script-and-external-controls/02-components-video-35-video-with-inline-script-and-external-controls.html`,
      )
      .waitForElementVisible('.video-js', 1000)
      .click('.vjs-big-play-button')
      .pause(250)
      .assert.elementPresent('button.vjs-playback-rate')
      // .click('button.vjs-playback-rate')
      // .assert.containsText('.vjs-playback-rate-value', '1.3x')
      .execute(
        function(data) {
          return document.querySelector('button.vjs-playback-rate').click();
        },
        [],
        function(result) {
          browser.assert.containsText('.vjs-playback-rate-value', '1.3x');
        },
      )
      .saveScreenshot(
        `screenshots/bolt-video/${testName}--playback-at-1.3x--${currentBrowser}.png`,
      )
      .execute(
        function(data) {
          return document.querySelector('bolt-video').player.playbackRate(2);
        },
        [],
        function(result) {
          browser.assert.containsText('.vjs-playback-rate-value', '2x');
        },
      )
      .saveScreenshot(
        `screenshots/bolt-video/${testName}--playback-at-2x--${currentBrowser}.png`,<commit_msg>test(@bolt/components-video): update test logic<commit_after>let currentBrowser;
// import videojs from 'video';

module.exports = {
  tags: ['component', 'video'],
  'Bolt Video Playback Rate': function(browser) {
    const { testingUrl } = browser.globals;
    console.log(`global browser url: ${testingUrl}`);
    currentBrowser = '--' + browser.currentEnv || 'chrome';
    let testName = 'bolt-video-playback-rate';
    // const player = videojs(document.getElementsByClassName('video-js')[0], { inactivityTimeout: 0 });

    browser
      .url(
        `${testingUrl}/pattern-lab/patterns/02-components-video-35-video-with-inline-script-and-external-controls/02-components-video-35-video-with-inline-script-and-external-controls.html`,
      )
      .waitForElementVisible('.video-js', 1000)
      .click('.vjs-big-play-button')
      .assert.elementPresent('.vjs-playback-rate')
      .execute(
        function(data) {
          return document.querySelector('button.vjs-playback-rate').click();
        },
        [],
        function(result) {
          // browser.assert.ok(
          //   result.value === 1.3,
          //   `verified that <bolt-video> play rate has sped up to ${
          //     result.value
          //   }`,
          // );
        },
      )
      .saveScreenshot(
        `screenshots/bolt-video/${testName}--${currentBrowser}.png`,
      )
      .execute(
        function(data) {
          return document.querySelector('bolt-video').player.playbackRate();
        },
        [],
        function(result) {
          browser.assert.ok(
            result.value === 1.3,
            `verified that <bolt-video> play rate has sped up to ${
              result.value
              }`,
          );
        },
      )
      .execute(
        function(data) {
          return document.querySelector('.vjs-playback-rate-value').textContent;
        },
        [],
        function(result) {
          browser.assert.ok(
            result.value === '1.3x',
            `verified that <bolt-video> play rate text reads 1.3x.`,
          );
        },
{'fraction_non_alphanumeric': 0.16145691764066322, 'fraction_numerical': 0.012503397662408263, 'mean_word_length': 2.156089193825043, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2889388', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1111, 'n_words': 149}