Skip to content

Commit

Permalink
need right click
Browse files Browse the repository at this point in the history
  • Loading branch information
potapovDim committed Aug 3, 2019
1 parent a996981 commit 345c8c2
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 123 deletions.
6 changes: 2 additions & 4 deletions __specs__/integration/chrome/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('client chrome', () => {
it('tabs', async () => {
const file = 'tabs'
const link = $('a').waitForClickable(1000)
const googleInput = $('#lst-ib').waitForElementPresent(5000)
const googleInput = $('[name="q"]').waitForElementPresent(5000)
await client.goTo(pathResolver(file))
await link.click()
await client.switchToTab(1)
Expand All @@ -347,7 +347,6 @@ describe('client chrome', () => {
it('getRect', async () => {
const file = 'tabs'
const link = $('a').waitForClickable(1000)
const googleInput = $('#lst-ib').waitForElementPresent(5000)
await client.goTo(pathResolver(file))
expect(await link.getRect()).to.eql(
{width: 76, height: 17, x: 8, y: 8}
Expand All @@ -357,7 +356,6 @@ describe('client chrome', () => {
it('getElementHTML', async () => {
const file = 'tabs'
const link = $('a').waitForClickable(1000)
const googleInput = $('#lst-ib').waitForElementPresent(5000)
await client.goTo(pathResolver(file))
expect(await link.getElementHTML()).to.eql('<a href="https://www.google.com.ua" target="_blank">Go to goole</a>')
})
Expand Down Expand Up @@ -402,7 +400,7 @@ describe('client chrome', () => {
expect(await clicker.getTag()).to.eql('button')
})

it('rightClick', async () => {
it.only('rightClick', async () => {
const file = 'rightClick'
const clicker = element('#test_button').waitForClickable(3000)
const spans = $$('span')
Expand Down
22 changes: 11 additions & 11 deletions lib/callWrapper.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
const {handledErrors} = require('./interfaceError')
const retryError = 'STALE_ELEMENT_REFERENCE'

async function callWithWrap(action, ...rest) {
let driverResp = await action(this.sessionId, ...rest)
async function callWithWrap(that, action, ...rest) {
let driverResp = await action(that.sessionId, ...rest)

const {err, errorType} = handledErrors(driverResp.status)

if(!err) return driverResp.value

if(err && errorType !== retryError) {
err({
sessionId: this.sessionId,
selector: JSON.stringify(this.selector),
sessionId: that.sessionId,
selector: JSON.stringify(that.selector),
additionalMessage: JSON.stringify(driverResp.value),
parentSelector: this.baseElement && JSON.stringify(this.baseElement.selector)
parentSelector: that.baseElement && JSON.stringify(that.baseElement.selector)
})
} else {

await this.getThisElement(true)
await that.getThisElement(true)

if(typeof rest[0] === 'string') {
rest[0] = this.elementId
rest[0] = that.elementId
}

driverResp = await action(this.sessionId, ...rest)
driverResp = await action(that.sessionId, ...rest)
const {err} = handledErrors(driverResp.status)
if(!err) return driverResp.value
err({
sessionId: this.sessionId,
selector: JSON.stringify(this.selector),
sessionId: that.sessionId,
selector: JSON.stringify(that.selector),
additionalMessage: JSON.stringify(driverResp.value),
parentSelector: this.baseElement && JSON.stringify(this.baseElement.selector)
parentSelector: that.baseElement && JSON.stringify(that.baseElement.selector)
})
}
}
Expand Down
Loading

0 comments on commit 345c8c2

Please sign in to comment.