Skip to content

Commit d634a03

Browse files
author
David Haeffner
committed
Fix for issue 893 -- setRect for javascript-mocha code export
1 parent 5bef44e commit d634a03

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

packages/code-export-javascript-mocha/__test__/src/__snapshots__/command.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ exports[`command code emitter should emit \`send keys\` command with a variable
303303
304304
exports[`command code emitter should emit \`set speed\` 1`] = `"console.log(\\"\`set speed\` is a no-op in code export, use \`pause\` instead\\")"`;
305305
306-
exports[`command code emitter should emit \`setWindowSize\` 1`] = `"await driver.setRect(1440, 1177)"`;
306+
exports[`command code emitter should emit \`setWindowSize\` 1`] = `"await driver.manage().window().setRect(1440, 1177)"`;
307307
308308
exports[`command code emitter should emit \`store attribute\` command 1`] = `
309309
"{

packages/code-export-javascript-mocha/__test__/src/__snapshots__/index.spec.js.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ describe('login', function() {
1818
})
1919
it('valid credentials', async function() {
2020
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
21-
await driver.setRect(1440, 1177)
21+
await driver.manage().window().setRect(1440, 1177)
2222
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
2323
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
2424
await driver.findElement(By.css(\\"#login button\\")).click()
2525
assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\\\\\\\\\\\")
2626
})
2727
it('invalid credentials', async function() {
2828
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
29-
await driver.setRect(1440, 1177)
29+
await driver.manage().window().setRect(1440, 1177)
3030
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"blah\\")
3131
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"blah\\")
3232
await driver.findElement(By.css(\\"#login button\\")).click()
@@ -254,7 +254,7 @@ describe('login', function() {
254254
})
255255
it('login', async function() {
256256
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
257-
await driver.setRect(1440, 1177)
257+
await driver.manage().window().setRect(1440, 1177)
258258
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
259259
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
260260
await driver.findElement(By.css(\\"#login button\\")).click()
@@ -323,7 +323,7 @@ describe('select window', function() {
323323
}
324324
it('select window', async function() {
325325
await driver.get(\\"http://the-internet.herokuapp.com/\\")
326-
await driver.setRect(1260, 1027)
326+
await driver.manage().window().setRect(1260, 1027)
327327
await driver.findElement(By.linkText(\\"Multiple Windows\\")).click()
328328
vars[\\"windowHandles\\"] = await driver.getAllWindowHandles()
329329
await driver.findElement(By.linkText(\\"Click Here\\")).click()
@@ -356,7 +356,7 @@ describe('login', function() {
356356
})
357357
it('login', async function() {
358358
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
359-
await driver.setRect(1440, 1177)
359+
await driver.manage().window().setRect(1440, 1177)
360360
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
361361
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
362362
await driver.findElement(By.css(\\"#login button\\")).click()

packages/code-export-javascript-mocha/src/command.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ async function emitRunScript(script) {
540540

541541
async function emitSetWindowSize(size) {
542542
const [width, height] = size.split('x')
543-
return Promise.resolve(`await driver.setRect(${width}, ${height})`)
543+
return Promise.resolve(
544+
`await driver.manage().window().setRect(${width}, ${height})`
545+
)
544546
}
545547

546548
async function emitSelect(selectElement, option) {

0 commit comments

Comments
 (0)