<commit_before>helpers          = require '../helpers/helpers.js'
activitySelector = '[testpath=activity-list] section:nth-of-type(1) [testpath=ActivityListItemView]:first-child'

module.exports =

  searchActivity: (browser) ->

    post     = helpers.postActivity(browser)
    selector = '[testpath=activity-list] [testpath=ActivityListItemView]:first-child'
    word     = post.split(' ')[0]

    browser
      .setValue                 '.kdtabhandlecontainer .search-input', word + '\n'
      .waitForElementVisible    '.kdtabpaneview.search', 25000
      .waitForElementVisible    selector, 25000
      .pause                    25000
      .assert.containsText      selector, word # Assertion
      .end()


  showMoreCommentLink: (browser) ->

    helpers.postComment(browser)
    helpers.postComment(browser, no, no)  for i in [1..4]

    browser
      .pause 2000
      .refresh()
      .waitForElementVisible  "#{activitySelector} [testpath=list-previous-link]", 25000
      .end()


  sendHashtagActivity: (browser) ->

    helpers.sendHashtagActivity(browser)
    browser.end()


  followTopic: (browser) ->

    helpers.doFollowTopic(browser)
    browser.end()


  unfollowTopic: (browser) ->

    hashtag        = helpers.doFollowTopic(browser)
    publicSelector = '#main-sidebar [testpath="public-feed-link/Activity/Topic/public"]'
    topicSelector  = "#main-sidebar [testpath=\"public-feed-link/Activity/Topic/#{hashtag.replace '#', ''}\"]"
    recentSelector = "[testpath=\"ActivityTabHandle-/Activity/Public/Recent\"]"

    browser<commit_msg>tests: comments: add an extra refresh against wsod<commit_after>helpers          = require '../helpers/helpers.js'
activitySelector = '[testpath=activity-list] section:nth-of-type(1) [testpath=ActivityListItemView]:first-child'

module.exports =

  searchActivity: (browser) ->

    post     = helpers.postActivity(browser)
    selector = '[testpath=activity-list] [testpath=ActivityListItemView]:first-child'
    word     = post.split(' ')[0]

    browser
      .setValue                 '.kdtabhandlecontainer .search-input', word + '\n'
      .waitForElementVisible    '.kdtabpaneview.search', 25000
      .waitForElementVisible    selector, 25000
      .pause                    25000
      .assert.containsText      selector, word # Assertion
      .end()


  showMoreCommentLink: (browser) ->

    helpers.postComment(browser)
    helpers.postComment(browser, no, no)  for i in [1..4]

    browser
      .refresh()
      .pause 2000
      .refresh()
      .waitForElementVisible  "#{activitySelector} [testpath=list-previous-link]", 25000
      .end()


  sendHashtagActivity: (browser) ->

    helpers.sendHashtagActivity(browser)
    browser.end()


  followTopic: (browser) ->

    helpers.doFollowTopic(browser)
    browser.end()


  unfollowTopic: (browser) ->

    hashtag        = helpers.doFollowTopic(browser)
    publicSelector = '#main-sidebar [testpath="public-feed-link/Activity/Topic/public"]'
    topicSelector  = "#main-sidebar [testpath=\"public-feed-link/Activity/Topic/#{hashtag.replace '#', ''}\"]"
    recentSelector = "[testpath=\"ActivityTabHandle-/Activity/Public/Recent\"]"

    browser
{'fraction_non_alphanumeric': 0.1330188679245283, 'fraction_numerical': 0.01761006289308176, 'mean_word_length': 3.0164141414141414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3614883', 'n_tokens_mistral': 1013, 'n_tokens_neox': 943, 'n_words': 161}