<commit_before>require_relative 'spec_helper'
require 'json'

describe 'Kiwi orchard Stories' do
  include PageObject::PageFactory
  before do
    unless @browser
      @headless = Headless.new
      @browser = Watir::Browser.new
    end
  end

  describe 'Visiting the home page' do
    it 'finds the title' do
      visit HomePage do |page|
        page.title.must_equal 'Kiwi orchard'
        page.home_link_element.exists?.must_equal true
        page.kiwi_learn_link_element.exists?.must_equal true
        page.search_link_element.exists?.must_equal true
        page.courses_link_element.exists?.must_equal true
        page.statistics_link_element.exists?.must_equal true
      end
    end

    it 'check home page' do
      visit HomePage do |page|
        page.click_home_link
        page.homepage_header.must_equal 'Kiwi Learn'

        page.click_kiwi_learn_link
        page.homepage_header.must_equal 'Kiwi Learn'
      end
    end

  end

  describe 'Search a course' do
    it 'can search a course' do

      visit SearchPage do |page|
        page.browser.url.must_match %r{http.*/search}
        page.search_header.must_equal 'Search a course with keyword'

        # GIVEN & WEHN
        page.search_course('program')

        # THEN
        page.browser.url.must_match %r{http.*/search}<commit_msg>fixed test<commit_after>require_relative 'spec_helper'
require 'json'

describe 'Kiwi orchard Stories' do
  include PageObject::PageFactory
  before do
    unless @browser
      @headless = Headless.new
      @browser = Watir::Browser.new
    end
  end

  describe 'Visiting the home page' do
    it 'finds the title' do
      visit HomePage do |page|
        page.title.must_equal 'Kiwi orchard'
        page.home_link_element.exists?.must_equal true
        page.kiwi_learn_link_element.exists?.must_equal true
        page.search_link_element.exists?.must_equal true
        page.courses_link_element.exists?.must_equal true
        page.statistics_link_element.exists?.must_equal true
      end
    end

    it 'check home page' do
      visit HomePage do |page|
        page.click_home_link
        page.homepage_header.must_equal 'Kiwi Learn'

        page.click_kiwi_learn_link
        page.homepage_header.must_equal 'Kiwi Learn'
      end
    end

  end

  describe 'Search a course' do
    it 'can search a course' do

      visit SearchPage do |page|
        page.browser.url.must_match %r{http.*/search}
        page.search_header.must_equal 'Explore courses'

        # GIVEN & WEHN
        page.search_course('program')

        # THEN
        page.browser.url.must_match %r{http.*/search}
{'fraction_non_alphanumeric': 0.07627765064836003, 'fraction_numerical': 0.0, 'mean_word_length': 2.638002773925104, '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': '3661079', 'n_tokens_mistral': 837, 'n_tokens_neox': 800, 'n_words': 197}