From b7e4ce81c3d87fd3eec5c655733e0121879c9f89 Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Thu, 29 Feb 2024 11:00:23 +0200 Subject: [PATCH] add logging specs --- spec/features/logging_spec.cr | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/features/logging_spec.cr diff --git a/spec/features/logging_spec.cr b/spec/features/logging_spec.cr new file mode 100644 index 0000000..8516e21 --- /dev/null +++ b/spec/features/logging_spec.cr @@ -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 + + 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