-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement method to retrieve logs for Chrome (#44)
* Implement method to retrieve logs for Chrome * bump ameba * fix ameba warnings * add logging specs * revert to set command_handler in initializer * revert .ameba.yml
- Loading branch information
Showing
8 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Selenium::Chrome::CommandHandler < Selenium::CommandHandler | ||
CHROME_COMMANDS = { | ||
get_available_log_types: {:get, "/session/:session_id/se/log/types"}, | ||
get_log: {:post, "/session/:session_id/se/log"}, | ||
} | ||
|
||
def commands | ||
DEFAULT_COMMANDS.merge(CHROME_COMMANDS) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Selenium::Chrome::LogEntry | ||
include JSON::Serializable | ||
|
||
property level : String | ||
property message : String | ||
property source : String? | ||
property timestamp : Int64 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters