1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

Add Driver#refresh to support Session#refresh in Capybara 2.15

This commit is contained in:
Thomas Walpole 2017-07-05 13:37:36 -07:00
parent a916a90b21
commit d815b7f33c
8 changed files with 72 additions and 35 deletions

View file

@ -2,20 +2,20 @@ PATH
remote: .
specs:
capybara-webkit (1.14.0)
capybara (>= 2.3.0, < 2.14.0)
capybara (~> 2.3)
json
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
appraisal (0.4.1)
bundler
rake
capybara (2.13.0)
capybara (2.15.4)
addressable
mime-types (>= 1.16)
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
@ -30,41 +30,44 @@ GEM
addressable (~> 2.3)
spoon (~> 0.0.1)
mime-types (2.99.3)
mini_magick (4.7.0)
mini_portile (0.6.2)
nokogiri (1.6.6.4)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.4-java)
nokogiri (1.6.6.4-x86-mingw32)
mini_portile (~> 0.6.0)
public_suffix (2.0.5)
rack (1.6.5)
rack-protection (1.5.3)
mini_magick (4.8.0)
mini_mime (0.1.4)
mini_portile2 (2.3.0)
mustermann (1.0.1)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.1-java)
nokogiri (1.8.1-x86-mingw32)
mini_portile2 (~> 2.3.0)
public_suffix (3.0.0)
rack (2.0.3)
rack-protection (2.0.0)
rack
rack-test (0.6.3)
rack (>= 1.0)
rack-test (0.7.0)
rack (>= 1.0, < 3)
rake (11.3.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
sinatra (2.0.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.0)
tilt (~> 2.0)
spoon (0.0.6)
ffi
tilt (2.0.7)
xpath (2.0.0)
tilt (2.0.8)
xpath (2.1.0)
nokogiri (~> 1.3)
PLATFORMS
@ -84,4 +87,4 @@ DEPENDENCIES
sinatra
BUNDLED WITH
1.14.6
1.15.4

View file

@ -289,6 +289,10 @@ https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
command("GoForward")
end
def refresh
command("Refresh")
end
def allow_url(url)
command("AllowUrl", url)
end

View file

@ -241,6 +241,10 @@ module Capybara::Webkit
@browser.go_forward
end
def refresh
@browser.refresh
end
def accept_modal(type, options={})
options = modal_action_options_for_browser(options)

View file

@ -46,6 +46,7 @@
#include "WindowMaximize.h"
#include "GoBack.h"
#include "GoForward.h"
#include "Refresh.h"
#include "AcceptAlert.h"
#include "FindModal.h"
#include "SetUnknownUrlMode.h"

12
src/Refresh.cpp Normal file
View file

@ -0,0 +1,12 @@
#include "Refresh.h"
#include "SocketCommand.h"
#include "WebPage.h"
#include "WebPageManager.h"
Refresh::Refresh(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
}
void Refresh::start() {
page()->triggerAction(QWebPage::Reload);
finish(true);
}

10
src/Refresh.h Normal file
View file

@ -0,0 +1,10 @@
#include "SocketCommand.h"
class Refresh : public SocketCommand {
Q_OBJECT
public:
Refresh(WebPageManager *, QStringList &arguments, QObject *parent = 0);
virtual void start();
};

View file

@ -48,6 +48,7 @@ CHECK_COMMAND(WindowSize)
CHECK_COMMAND(WindowMaximize)
CHECK_COMMAND(GoBack)
CHECK_COMMAND(GoForward)
CHECK_COMMAND(Refresh)
CHECK_COMMAND(AcceptAlert)
CHECK_COMMAND(FindModal)
CHECK_COMMAND(SetUnknownUrlMode)

View file

@ -17,6 +17,7 @@ HEADERS = \
AcceptAlert.h \
GoForward.h \
GoBack.h \
Refresh.h \
WindowMaximize.h \
WindowSize.h \
WindowCommand.h \
@ -100,6 +101,7 @@ SOURCES = \
AcceptAlert.cpp \
GoForward.cpp \
GoBack.cpp \
Refresh.cpp \
WindowMaximize.cpp \
WindowSize.cpp \
WindowCommand.cpp \