<commit_before>/* global describe, it, beforeEach, afterEach */

const Brave = require('../lib/brave')
const {navigatorBookmarked, navigatorNotBookmarked, doneButton} = require('../lib/selectors')
const profilerUtil = require('../lib/profilerUtil')
const userProfiles = require('../lib/userProfiles')

describe('Performance bookmarks', function () {
  Brave.beforeAllServerSetup(this)
  const RESTART_TIMEOUT = 5000
  let inspectPort = 9223

  function * setup () {
    Brave.addCommands()
  }

  function * setupBrave (enableInspector) {
    const extraArgs = []
    if (enableInspector) {
      extraArgs.push(`--debug=${inspectPort}`)
      inspectPort += 1
    }
    yield Brave.startApp(extraArgs)
    yield setup(Brave.app.client)
  }

  function * restart () {
    yield Brave.stopApp(false, RESTART_TIMEOUT)
    yield setupBrave(true)
  }

  beforeEach(function * () {
    this.page1Url = Brave.server.url('page1.html')
    yield setupBrave()
  })

  afterEach(function * () {
    yield Brave.stopApp(true, RESTART_TIMEOUT)
  })

  this.afterAll(function * () {
    yield profilerUtil.uploadTravisArtifacts()
  })

  describe('adding a bookmark', function () {
    function * runPreStory () {
      yield Brave.app.client
        .waitForUrl(Brave.newTabUrl, 10000, 250)
        .loadUrl(this.page1Url)
        .windowParentByUrl(this.page1Url)
        .activateURLMode()
        .waitForVisible(navigatorNotBookmarked)
    }

    function * runStory () {
      yield Brave.app.client
        .click(navigatorNotBookmarked)
        .waitForVisible(doneButton)
        .waitForBookmarkDetail(this.page1Url, 'Page 1')
        .waitForEnabled(doneButton)
        .click(doneButton)
        .activateURLMode()
        .waitForVisible(navigatorBookmarked)
    }

    it('fresh', function * () {
      // restart to keep it consistent with other tests
      yield restart()<commit_msg>Fix test/performance/bookmarksTest<commit_after>/* global describe, it, beforeEach, afterEach */

const Brave = require('../lib/brave')
const {navigatorBookmarked, navigatorNotBookmarked, bookmarkHangerDoneButton} = require('../lib/selectors')
const profilerUtil = require('../lib/profilerUtil')
const userProfiles = require('../lib/userProfiles')

describe('Performance bookmarks', function () {
  Brave.beforeAllServerSetup(this)
  const RESTART_TIMEOUT = 5000
  let inspectPort = 9223

  function * setup () {
    Brave.addCommands()
  }

  function * setupBrave (enableInspector) {
    const extraArgs = []
    if (enableInspector) {
      extraArgs.push(`--debug=${inspectPort}`)
      inspectPort += 1
    }
    yield Brave.startApp(extraArgs)
    yield setup(Brave.app.client)
  }

  function * restart () {
    yield Brave.stopApp(false, RESTART_TIMEOUT)
    yield setupBrave(true)
  }

  beforeEach(function * () {
    this.page1Url = Brave.server.url('page1.html')
    yield setupBrave()
  })

  afterEach(function * () {
    yield Brave.stopApp(true, RESTART_TIMEOUT)
  })

  this.afterAll(function * () {
    yield profilerUtil.uploadTravisArtifacts()
  })

  describe('adding a bookmark', function () {
    function * runPreStory () {
      yield Brave.app.client
        .waitForUrl(Brave.newTabUrl, 10000, 250)
        .loadUrl(this.page1Url)
        .windowParentByUrl(this.page1Url)
        .activateURLMode()
        .waitForVisible(navigatorNotBookmarked)
    }

    function * runStory () {
      yield Brave.app.client
        .click(navigatorNotBookmarked)
        .waitForVisible(bookmarkHangerDoneButton)
        .waitForBookmarkDetail(this.page1Url, 'Page 1')
        .waitForEnabled(bookmarkHangerDoneButton)
        .click(bookmarkHangerDoneButton)
        .activateURLMode()
        .waitForVisible(navigatorBookmarked)
    }

    it('fresh', function * () {
      // restart to keep it consistent with other tests
      yield restart()
{'fraction_non_alphanumeric': 0.12048818488704233, 'fraction_numerical': 0.01194494936380161, 'mean_word_length': 3.2052401746724892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1988373', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1191, 'n_words': 212}