Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Service & Driver class to run multiple instances of same drive…
…r on different port (#30)
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 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,33 @@ | ||
require "../spec_helper" | ||
|
||
module Selenium::Command | ||
describe "session", tags: "feature" do | ||
it "run multiple browsers on separate process" do | ||
TestServer.route "/home", "<h1>The Title</h1>" | ||
TestServer.route "/next-page", "<h1>You made it!</h1>" | ||
TestServer.route "/action-page", <<-HTML | ||
<a href="/next-page">Click Me!</a> | ||
HTML | ||
|
||
begin | ||
driver1, args1 = Selenium::TestDriverFactory.build(ENV["SELENIUM_BROWSER"]? || "chrome") | ||
session1 = driver1.not_nil!.create_session(args: args1.not_nil!) | ||
driver2, args2 = Selenium::TestDriverFactory.build(ENV["SELENIUM_BROWSER"]? || "chrome") | ||
session2 = driver2.not_nil!.create_session(args: args2.not_nil!) | ||
|
||
session1.navigate_to("http://localhost:3002/home") | ||
session2.navigate_to("http://localhost:3002/action-page") | ||
element = session2.find_element(:link_text, "Click Me!") | ||
element.click | ||
session1.current_url.should eq("http://localhost:3002/home") | ||
session2.current_url.should eq("http://localhost:3002/next-page") | ||
ensure | ||
session1.try &.delete | ||
driver1.try &.stop | ||
session2.try &.delete | ||
driver2.try &.stop | ||
TestServer.reset | ||
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