Skip to content

Commit

Permalink
add logging specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Feb 29, 2024
1 parent c4ee843 commit fe1f3e4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/features/logging_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require "../spec_helper"

module Selenium::Command
describe "logging", tags: ["feature", "chrome"] do
it "#available_log_types" do
TestServer.route "/home", ""

with_session do |session|
session.navigate_to("http://localhost:3002/home")

available_log_types = session.available_log_types
available_log_types.should eq(["browser", "driver"])
end
end

it "#log" do
TestServer.route "/home", <<-HTML
<script>
console.warn("Hello, Console!");
</script>
HTML

with_session do |session|
session.navigate_to("http://localhost:3002/home")

logs = session.log("browser")
logs.any? { |log| log.level == "WARNING" && log.message.ends_with?("\"Hello, Console!\"") }.should be_truthy
end
end
end
end

0 comments on commit fe1f3e4

Please sign in to comment.