Skip to content

Commit 518a208

Browse files
joeizangAniket-Engg
authored andcommitted
handle receiving click event
1 parent 96651b4 commit 518a208

File tree

1 file changed

+65
-21
lines changed

1 file changed

+65
-21
lines changed

apps/remix-ide-e2e/src/commands/testConstantFunction.ts

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,80 @@
1-
import { NightwatchBrowser, NightwatchTestConstantFunctionExpectedInput } from 'nightwatch'
1+
import {
2+
NightwatchBrowser,
3+
NightwatchTestConstantFunctionExpectedInput
4+
} from 'nightwatch'
25
import EventEmitter from 'events'
36

47
class TestConstantFunction extends EventEmitter {
5-
command (this: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser {
8+
command(
9+
this: NightwatchBrowser,
10+
address: string,
11+
fnFullName: string,
12+
expectedInput: NightwatchTestConstantFunctionExpectedInput | null,
13+
expectedOutput: string
14+
): NightwatchBrowser {
615
console.log('TestConstantFunction ' + address + ' fnFullName')
716
this.api.perform((done) => {
8-
testConstantFunction(this.api, address, fnFullName, expectedInput, expectedOutput, () => {
9-
done()
10-
this.emit('complete')
11-
})
17+
testConstantFunction(
18+
this.api,
19+
address,
20+
fnFullName,
21+
expectedInput,
22+
expectedOutput,
23+
() => {
24+
done()
25+
this.emit('complete')
26+
}
27+
)
1228
})
1329
return this
1430
}
1531
}
1632

17-
function testConstantFunction (browser: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput, expectedOutput: string, cb: VoidFunction) {
18-
browser.waitForElementPresent('.instance button[data-title="' + fnFullName + '"]').perform(function (client, done) {
19-
client.execute(function () {
20-
document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
21-
}, [], function () {
22-
if (expectedInput) {
23-
client.waitForElementPresent('#runTabView input[data-title="' + expectedInput.types + '"]')
24-
.setValue('#runTabView input[data-title="' + expectedInput.types + '"]', expectedInput.values)
25-
}
26-
done()
33+
function testConstantFunction(
34+
browser: NightwatchBrowser,
35+
address: string,
36+
fnFullName: string,
37+
expectedInput: NightwatchTestConstantFunctionExpectedInput,
38+
expectedOutput: string,
39+
cb: VoidFunction
40+
) {
41+
browser
42+
.waitForElementPresent('.instance *[data-title="' + fnFullName + '"]')
43+
.perform(function (client, done) {
44+
client.execute(
45+
function () {
46+
document.querySelector('#runTabView').scrollTop =
47+
document.querySelector('#runTabView').scrollHeight
48+
},
49+
[],
50+
function () {
51+
if (expectedInput) {
52+
client
53+
.waitForElementPresent(
54+
'#runTabView input[data-title="' + expectedInput.types + '"]'
55+
)
56+
.setValue(
57+
'#runTabView input[data-title="' + expectedInput.types + '"]',
58+
expectedInput.values
59+
)
60+
}
61+
done()
62+
}
63+
)
2764
})
28-
})
29-
.click(`#instance${address} button[data-title="${fnFullName}"]`)
65+
.click(`#instance${address} *[data-title="${fnFullName}"]`)
3066
.pause(1000)
31-
.waitForElementPresent('#instance' + address + ' .udapp_contractActionsContainer .udapp_value')
32-
.scrollInto('#instance' + address + ' .udapp_contractActionsContainer .udapp_value')
33-
.assert.containsText('#instance' + address + ' .udapp_contractActionsContainer', expectedOutput).perform(() => {
67+
.waitForElementPresent(
68+
'#instance' + address + ' .udapp_contractActionsContainer .udapp_value'
69+
)
70+
.scrollInto(
71+
'#instance' + address + ' .udapp_contractActionsContainer .udapp_value'
72+
)
73+
.assert.containsText(
74+
'#instance' + address + ' .udapp_contractActionsContainer',
75+
expectedOutput
76+
)
77+
.perform(() => {
3478
cb()
3579
})
3680
}

0 commit comments

Comments
 (0)