<commit_before>require_relative 'spec_helper.rb'

feature "a user clicks card in hand" do
  before do
    create_room("jnmandal")
    deal_cards(5)
    find('div:nth-child(3) > .card').click
  end

  scenario "has Draw Card button" do
    expect(page).to have_button("Draw Card")
  end

  scenario "has Pass Card button" do
    expect(page).to have_button("Pass Card")
  end

  scenario "has Play Card button" do
    expect(page).to have_button("Play Card")
  end

  scenario "has Discard Card button" do
    expect(page).to have_button("Discard Card")
  end
end

feature "a user draws a card" do
  before do
    create_room("jnmandal")
    deal_cards(5)
    find('div:nth-child(3) > .card').click
    click_button("Draw Card")
  end

  scenario "card is passed to player's hand" do
    page.assert_selector(".card", count: 6)
  end
end


# Need to add helper that returns the clicked card so
# we can ensure the correct card is played and displayed for both players.
feature "a user plays a card" do
  before do
    create_and_join_room("jnmandal", "bsheridan12")
    in_browser(:one) do
      deal_cards(5)
      # find('div:nth-child(3) > .card').click
      click_card(3)
      click_button("Play Card")
    end
  end

  scenario "card is removed from player hand" do
    in_browser(:one) do
      within "div.player-hand" do
        page.assert_selector(".card", count: 4)
      end
    end
  end

  scenario "selected card is moved to table" do
    in_browser(:one) do
      within "div.table-cards" do
        page.assert_selector(".card", count: 1)
      end
    end
  end

  scenario "card on table is card that was in hand" do


  end

  scenario "second user can see player card" do
    in_browser(:two) do
      within "div.table-cards" do
        page.assert_selector(".card", count: 1)
      end
    end
  end
end

feature "a user discards a card" do
  before do
    create_room("jnmandal")
    in_browser(:one) do
      deal_cards(5)
      find('div:nth-child(3) > .card').click
      click_button("Discard Card")
    end
  end
end


<commit_msg>make capybara tests work with new buttons<commit_after>require_relative 'spec_helper.rb'

feature "a user clicks card in hand" do
  before do
    create_room("jnmandal")
    deal_cards(5)
    find('div:nth-child(3) > .card').click
  end

  scenario "has Draw Card button" do
    expect(page).to have_button("Draw Card")
  end

  scenario "has Pass Card button" do
    expect(page).to have_button("Pass")
  end

  scenario "has Play Card button" do
    expect(page).to have_button("Play")
  end

  scenario "has Discard Card button" do
    expect(page).to have_button("Discard")
  end
end

feature "a user draws a card" do
  before do
    create_room("jnmandal")
    deal_cards(5)
    find('div:nth-child(3) > .card').click
    click_button("Draw Card")
  end

  scenario "card is passed to player's hand" do
    page.assert_selector(".card", count: 6)
  end
end

feature "a user plays a card" do
  before do
    create_and_join_room("jnmandal", "bsheridan12")
    in_browser(:one) do
      deal_cards(5)
      click_card(3)
      click_button("Play")
    end
  end

  scenario "card is removed from player hand" do
    in_browser(:one) do
      within "div.player-hand" do
        page.assert_selector(".card", count: 4)
      end
    end
  end

  scenario "selected card is moved to table" do
    in_browser(:one) do
      within "div.table-cards" do
        page.assert_selector(".card", count: 1)
      end
    end
  end

  scenario "card on table is card that was in hand" do


  end

  scenario "second user can see player card" do
    in_browser(:two) do
      within "div.table-cards" do
        page.assert_selector(".card", count: 1)
      end
    end
  end
end

feature "a user discards a card" do
  before do
    create_room("jnmandal")
    in_browser(:one) do
      deal_cards(5)
      find('div:nth-child(3) > .card').click
      click_button("Discard")
    end
  end
end



{'fraction_non_alphanumeric': 0.10207700101317123, 'fraction_numerical': 0.007345491388044579, 'mean_word_length': 2.8791748526522594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '4104217', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1309, 'n_words': 418}