<commit_before>module Screenshots
  module DiscussionHelper

    include Acceptance::FactHelper
    include Acceptance::CommentHelper

    def factlink
      @factlink ||= backend_create_fact
    end

    def create_discussion
      comment1_text = '1. Comment'
      factlink2_text = '2. New Factlink. Which is long. Very' + ', very' * 50 + ' long...'

      sub_comment_text = "\n\nThis is a subcomment\n\nwith some  whitespace \n\n"
      sub_comment_text_normalized = "This is a subcomment with some whitespace"

      factlink3 = backend_create_fact
      go_to_discussion_page_of factlink3
      click_wheel_part 0

      go_to_discussion_page_of factlink
      click_wheel_part 0

      add_comment :supporting, comment1_text
      add_new_factlink :supporting, factlink2_text
      add_existing_factlink :supporting, factlink3

      # make sure sorting is done:
      sleep 1

      vote_comment :down, comment1_text

      within('.evidence-votable', text: comment1_text, visible: false) do
        find('a', text: 'Comment').click
        add_sub_comment(sub_comment_text)
        assert_sub_comment_exists sub_comment_text_normalized
      end

      within('.evidence-votable', text: factlink3.data.displaystring, visible: false) do
        find('.js-fact-relation-unbelieve').click
        eventually_succeeds do
          find('a', text: 'Comment').click
          find('.spec-sub-comments-form').should_not eq nil
        end
        add_sub_comment(sub_comment_text)
        assert_sub_comment_exists sub_comment_text_normalized
      end

      factlink
    end<commit_msg>Fixed spec / thanks to @janpaul123<commit_after>module Screenshots
  module DiscussionHelper

    include Acceptance::FactHelper
    include Acceptance::CommentHelper

    def factlink
      @factlink ||= backend_create_fact
    end

    def create_discussion
      comment1_text = '1. Comment'
      factlink2_text = '2. New Factlink. Which is long. Very' + ', very' * 50 + ' long...'

      sub_comment_text = "\n\nThis is a subcomment\n\nwith some  whitespace \n\n"
      sub_comment_text_normalized = "This is a subcomment with some whitespace"

      factlink3 = backend_create_fact
      go_to_discussion_page_of factlink3
      click_wheel_part 0

      go_to_discussion_page_of factlink
      click_wheel_part 0

      add_comment :supporting, comment1_text
      add_new_factlink :supporting, factlink2_text
      add_existing_factlink :supporting, factlink3

      # make sure sorting is done:
      sleep 1

      vote_comment :down, comment1_text

      within('.evidence-votable', text: comment1_text, visible: false) do
        find('a', text: 'Comment').click
        add_sub_comment(sub_comment_text)
        assert_sub_comment_exists sub_comment_text_normalized
      end

      within('.evidence-votable', text: factlink3.data.displaystring, visible: false) do
        find('.js-down').click
        find('.js-fact-disbelieve').click
        eventually_succeeds do
          find('a', text: 'Comment').click
          find('.spec-sub-comments-form').should_not eq nil
        end
        add_sub_comment(sub_comment_text)
        assert_sub_comment_exists sub_comment_text_normalized
      end

      factlink
    end
{'fraction_non_alphanumeric': 0.0750154990700558, 'fraction_numerical': 0.011469311841289522, 'mean_word_length': 2.944987775061125, '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': '5711016', 'n_tokens_mistral': 1011, 'n_tokens_neox': 956, 'n_words': 222}