<commit_before>require_relative 'cyber_dojo_test'

class DiffingInAKataTest < CyberDojoTest

  def test_A_diff_dialog_appears_when_a_traffic_light_is_clicked
    create_and_enter_kata

    select_file('hiker.c')
    editor.clear
    editor.send_keys("#include \"hiker.h\"\n")
    editor.send_keys("int answer(void) { return 49; }\n")

    test_button.click
    wait_for_spinner_to_show_and_hide

    select_file('hiker.c')
    editor.clear
    editor.send_keys("#include \"hiker.h\"\n")
    editor.send_keys("int answer(void) { return 42; }\n")

    test_button.click
    wait_for_spinner_to_show_and_hide

    traffic_light(1).click

    refute_nil(diff_dialog, 'Could not find the diff dialog')

    select_diff('hiker.c')

    expected = "#include \"hiker.h\"\n"
    expected += "int answer(void) { return 49; }\n"
    expected += "int answer(void) { return 42; }"

    assert_equal(expected, diff_view.text)
  end

end<commit_msg>Refactored diffing in a kata tests to use steps<commit_after>require_relative 'cyber_dojo_test'

class DiffingInAKataTest < CyberDojoTest

  def test_A_diff_dialog_appears_when_a_traffic_light_is_clicked
    create_and_enter_kata

    edit_hiker_c("int answer(void) { return 49; }")
    run_kata_tests

    edit_hiker_c("int answer(void) { return 42; }")
    run_kata_tests

    traffic_light(1).click

    refute_nil(diff_dialog, 'Could not find the diff dialog')

    select_diff('hiker.c')

    expected = "#include \"hiker.h\"\n"
    expected += "int answer(void) { return 49; }\n"
    expected += "int answer(void) { return 42; }"

    assert_equal(expected, diff_view.text)
  end

end
{'fraction_non_alphanumeric': 0.11206896551724138, 'fraction_numerical': 0.011083743842364532, 'mean_word_length': 4.030959752321982, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3605707', 'n_tokens_mistral': 615, 'n_tokens_neox': 580, 'n_words': 109}