mirror of
https://github.com/appium/appium.git
synced 2026-02-04 08:38:54 -06:00
add refresh() and a weak test for it
This commit is contained in:
@@ -356,6 +356,10 @@ Android.prototype.forward = function(cb) {
|
||||
cb(new NotYetImplementedError(), null);
|
||||
};
|
||||
|
||||
Android.prototype.refresh = function(cb) {
|
||||
cb(new NotYetImplementedError(), null);
|
||||
};
|
||||
|
||||
Android.prototype.getPageIndex = function(elementId, cb) {
|
||||
cb(new NotYetImplementedError(), null);
|
||||
};
|
||||
|
||||
@@ -367,6 +367,10 @@ exports.forward = function(req, res) {
|
||||
req.device.forward(getResponseHandler(req, res));
|
||||
};
|
||||
|
||||
exports.refresh = function(req, res) {
|
||||
req.device.refresh(getResponseHandler(req, res));
|
||||
};
|
||||
|
||||
exports.keys = function(req, res) {
|
||||
var keys = req.body.value.join('');
|
||||
|
||||
|
||||
@@ -194,7 +194,9 @@ RemoteDebugger.prototype.executeAtom = function(atom, args, frames, cb) {
|
||||
if (atom === "title") {
|
||||
atomSrc = "function(){return JSON.stringify({status: 0, value: document.title});}";
|
||||
} else if (atom === "element_equals_element") {
|
||||
var atomSrc = this.wrapElementEqualsElementAtom(args);
|
||||
atomSrc = this.wrapElementEqualsElementAtom(args);
|
||||
} else if (atom === "refresh") {
|
||||
atomSrc = "function(){return JSON.stringify({status: 0, value: window.location.reload()});}";
|
||||
} else {
|
||||
atomSrc = atoms.get(atom);
|
||||
}
|
||||
|
||||
10
app/ios.js
10
app/ios.js
@@ -1000,6 +1000,14 @@ IOS.prototype.forward = function(cb) {
|
||||
}
|
||||
};
|
||||
|
||||
IOS.prototype.refresh = function(cb) {
|
||||
if (this.curWindowHandle === null) {
|
||||
cb(new NotImplementedError(), null);
|
||||
} else {
|
||||
this.executeAtom('refresh', [], cb);
|
||||
}
|
||||
};
|
||||
|
||||
IOS.prototype.getPageIndex = function(elementId, cb) {
|
||||
if (this.curWindowHandle) {
|
||||
cb(new NotImplementedError(), null);
|
||||
@@ -1552,7 +1560,7 @@ IOS.prototype.equalsWebElement = function(element, other, cb) {
|
||||
// ...otherwise let the browser tell us.
|
||||
this.executeAtom('element_equals_element', [ctxElem.ELEMENT, otherElem.ELEMENT], cb);
|
||||
}
|
||||
|
||||
|
||||
cb(null, {
|
||||
status: retStatus
|
||||
, value: retValue
|
||||
|
||||
@@ -69,6 +69,7 @@ module.exports = function(appium) {
|
||||
rest.post('/wd/hub/session/:sessionId?/click', controller.clickCurrent);
|
||||
rest.post('/wd/hub/session/:sessionId?/back', controller.back);
|
||||
rest.post('/wd/hub/session/:sessionId?/forward', controller.forward);
|
||||
rest.post('/wd/hub/session/:sessionId?/refresh', controller.refresh);
|
||||
|
||||
// these are for testing purposes only
|
||||
rest.post('/wd/hub/produce_error', controller.produceError);
|
||||
@@ -99,7 +100,6 @@ var routeNotYetImplemented = function(rest) {
|
||||
rest.post('/wd/hub/session/:sessionId?/timeouts', controller.notYetImplemented);
|
||||
rest.post('/wd/hub/session/:sessionId?/execute_async', controller.notYetImplemented);
|
||||
rest.post('/wd/hub/session/:sessionId?/timeouts/async_script', controller.notYetImplemented);
|
||||
rest.post('/wd/hub/session/:sessionId?/refresh', controller.notYetImplemented);
|
||||
rest.get('/wd/hub/session/:sessionId?/ime/available_engines', controller.notYetImplemented);
|
||||
rest.get('/wd/hub/session/:sessionId?/ime/active_engine', controller.notYetImplemented);
|
||||
rest.get('/wd/hub/session/:sessionId?/ime/activated', controller.notYetImplemented);
|
||||
|
||||
@@ -959,5 +959,16 @@ module.exports.buildTests = function(webviewType) {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
desc('refresh', function(h) {
|
||||
it('should be able to refresh', function(done) {
|
||||
loadWebView(h.driver, function() {
|
||||
h.driver.refresh(function(err) {
|
||||
should.not.exist(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user