w3c CreateSession response
MODIFY
lib/mjsonwp/mjsonwp.js
lib/mjsonwp/mjsonwp.js
@@ -284,6 +284,11 @@ function buildHandler (app, method, path, spec, driver, isSessCmd) {
if (spec.command === 'createSession') {
newSessionId = driverRes[0];
driverRes = driverRes[1];
+ if (driver.protocol === BaseDriver.DRIVER_PROTOCOL.W3C) {
+ driverRes = {
+ capabilities: driverRes[1],
+ };
+ }
}
// convert undefined to null, but leave all other values the same
@@ -334,7 +339,11 @@ function buildHandler (app, method, path, spec, driver, isSessCmd) {
res.status(httpStatus).send(httpResBody);
} else {
if (newSessionId) {
+ if (driver.protocol === BaseDriver.DRIVER_PROTOCOL.W3C) {
+ httpResBody.value.sessionId = newSessionId;
+ } else {
httpResBody.sessionId = newSessionId;
+ }
} else {
httpResBody.sessionId = req.params.sessionId || null;
}

MODIFY
test/mjsonwp/mjsonwp-e2e-specs.js
test/mjsonwp/mjsonwp-e2e-specs.js
@@ -398,13 +398,14 @@ describe('MJSONWP', async () => {
},
firstMatch: [{}],
};
- let {sessionId} = await request({
+ let {value} = await request({
url: 'http://localhost:8181/wd/hub/session',
method: 'POST',
json: {
capabilities: w3cCaps,
}
});
+ let sessionId = value.sessionId;
let {statusCode:badStatusCode} = await request({
url: `http://localhost:8181/wd/hub/session/${sessionId}/url`,
method: 'POST',

w3c CreateSession response (#161)