<commit_before>/* global describe, it, before, after */

const Brave = require('../lib/brave')
const selectors = require('../lib/selectors')
const siteTags = require('../../js/constants/siteTags')

describe('sessionStore', function () {
  function * setup (client) {
    yield client
      .waitUntilWindowLoaded()
      .waitForVisible('#window')
      .waitForVisible(selectors.urlInput)
    Brave.addCommands()
  }

  describe('state is preserved', function () {
    Brave.beforeAllServerSetup(this)
    before(function *() {
      const page1Url = Brave.server.url('page1.html')
      this.timeout(30000)
      yield Brave.startApp()
      yield setup(Brave.app.client)
      yield Brave.app.client.loadUrl(page1Url)
      yield Brave.app.client.waitForExist(selectors.navigatorNotBookmarked)
      yield Brave.app.client.addSite({
        location: page1Url,
        title: 'some page'
      }, siteTags.BOOKMARK)
      yield Brave.app.client
        .moveToObject(selectors.urlInput)
        .waitForExist(selectors.navigatorBookmarked)
        .waitUntil(function () {
          return this.getValue(selectors.urlInput).then((val) => val === page1Url)
        })
      yield Brave.stopApp()
      yield Brave.startApp(false)
      yield setup(Brave.app.client)
    })

    after(function *() {
      yield Brave.stopApp()
    })

    it('windowState by preserving open page', function *() {
      const page1Url = Brave.server.url('page1.html')
      yield Brave.app.client
        .moveToObject(selectors.urlInput)
        .waitUntil(function () {
          return this.getValue(selectors.urlInput).then((val) => val === page1Url)<commit_msg>Fix intermittent fail on session store test<commit_after>/* global describe, it, before, after */

const Brave = require('../lib/brave')
const selectors = require('../lib/selectors')
const siteTags = require('../../js/constants/siteTags')

describe('sessionStore', function () {
  function * setup (client) {
    yield client
      .waitUntilWindowLoaded()
      .waitForVisible('#window')
      .waitForVisible(selectors.urlInput)
    Brave.addCommands()
  }

  describe('state is preserved', function () {
    Brave.beforeAllServerSetup(this)
    before(function *() {
      const page1Url = Brave.server.url('page1.html')
      this.timeout(30000)
      yield Brave.startApp()
      yield setup(Brave.app.client)
      yield Brave.app.client.loadUrl(page1Url)
      yield Brave.app.client.waitForExist(selectors.navigatorNotBookmarked)
      yield Brave.app.client.addSite({
        location: page1Url,
        title: 'some page'
      }, siteTags.BOOKMARK)
      yield Brave.app.client
        .moveToObject(selectors.navigator)
        .waitForExist(selectors.navigatorBookmarked)
        .waitUntil(function () {
          return this.getValue(selectors.urlInput).then((val) => val === page1Url)
        })
      yield Brave.stopApp()
      yield Brave.startApp(false)
      yield setup(Brave.app.client)
    })

    after(function *() {
      yield Brave.stopApp()
    })

    it('windowState by preserving open page', function *() {
      const page1Url = Brave.server.url('page1.html')
      yield Brave.app.client
        .moveToObject(selectors.urlInput)
        .waitUntil(function () {
          return this.getValue(selectors.urlInput).then((val) => val === page1Url)
{'fraction_non_alphanumeric': 0.13269288501951365, 'fraction_numerical': 0.007805463824677274, 'mean_word_length': 2.9338842975206614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6788063', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1013, 'n_words': 179}