Skip to content

Commit 8fa8586

Browse files
ioedeveloperAniket-Engg
authored andcommitted
Debug plugin api test
1 parent 3b5fdd3 commit 8fa8586

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,25 @@ function App() {
125125
<label>events</label>
126126
<Logger id="events" log={events}></Logger>
127127
<input className="form-control w-100" type="text" id="payload" placeholder="Enter payload here..." value={payload} onChange={handleChange} data-id="payload-input" />
128-
{profiles.map((profile: Profile) => {
129-
const methods = profile.methods.map((method: string) => {
128+
{profiles.map((profile: Profile, index: number) => {
129+
const methods = profile.methods.map((method: string, index: number) => {
130130
return (
131-
<button id={`${profile.name}-${method}-${profile.name}`} data-id={`${profile.name}-${method}`} key={method} className="btn btn-primary btn-sm ms-1 mb-1" onClick={async () => await clientMethod(profile, method)}>
131+
<button id={`${profile.name}-${method}-${profile.name}`} data-id={`${profile.name}-${method}`} key={index} className="btn btn-primary btn-sm ms-1 mb-1" onClick={async () => await clientMethod(profile, method)}>
132132
{method}
133133
</button>
134134
)
135135
})
136136
const events = profile.events
137-
? profile.events.map((event: string) => {
137+
? profile.events.map((event: string, index: number) => {
138138
return (
139-
<label key={event} className="m-1">
139+
<label key={index} className="m-1">
140140
{event}
141141
</label>
142142
)
143143
})
144144
: null
145145
return (
146-
<div key={profile.name} className="small border-bottom">
146+
<div key={index} className="small border-bottom">
147147
<label className="text-uppercase">{profile.name}</label>
148148
<br/>
149149
{methods}

apps/remix-ide-e2e/src/tests/plugin_api.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const clearPayLoad = async (browser: NightwatchBrowser) => {
6262
const clickButton = async (browser: NightwatchBrowser, buttonText: string, waitResult: boolean = true) => { // eslint-disable-line
6363
return new Promise((resolve) => {
6464
browser
65+
.scrollInto(`[data-id='${buttonText}']`)
6566
.useXpath()
6667
.waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
6768
.click(`//*[@data-id='${buttonText}']`, async () => {
@@ -167,7 +168,7 @@ module.exports = {
167168
})
168169
},
169170

170-
'Should connect a local plugin': function (browser: NightwatchBrowser) {
171+
'Should connect a local plugin #pr': function (browser: NightwatchBrowser) {
171172
browser.addLocalPlugin(localPluginData, true)
172173
// @ts-ignore
173174
.frame(0).useXpath()
@@ -262,66 +263,66 @@ module.exports = {
262263
await clickAndCheckLog(browser, 'fileManager-closeAllFiles', null, { event: 'noFileSelected', args: []}, null)
263264
},
264265

265-
'Should switch to file #group2': async function (browser: NightwatchBrowser) {
266+
'Should switch to file #group2 #pr': async function (browser: NightwatchBrowser) {
266267
await clickAndCheckLog(browser, 'fileManager-switchFile', null, { event: 'currentFileChanged', args: ['contracts/1_Storage.sol']}, 'contracts/1_Storage.sol')
267268
await clickAndCheckLog(browser, 'fileManager-getCurrentFile', 'contracts/1_Storage.sol', null, null)
268269
await clickAndCheckLog(browser, 'fileManager-switchFile', null, { event: 'currentFileChanged', args: ['README.txt']}, 'README.txt')
269270
await clickAndCheckLog(browser, 'fileManager-getCurrentFile', 'README.txt', null, null)
270271
},
271-
'Should write to file #group2': async function (browser: NightwatchBrowser) {
272+
'Should write to file #group2 #pr': async function (browser: NightwatchBrowser) {
272273
await clickAndCheckLog(browser, 'fileManager-writeFile', null, { event: 'fileSaved', args: ['README.txt']}, ['README.txt', 'test'])
273274
browser.pause(4000, async () => {
274275
await clickAndCheckLog(browser, 'fileManager-getFile', 'test', null, 'README.txt')
275276
})
276277
},
277-
'Should set file #group2': async function (browser: NightwatchBrowser) {
278+
'Should set file #group2 #pr': async function (browser: NightwatchBrowser) {
278279
await clickAndCheckLog(browser, 'fileManager-setFile', null, { event: 'fileAdded', args: ['new.sol']}, ['new.sol', 'test'])
279280
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'new.sol')
280281
},
281-
'Should write to new file #group2': async function (browser: NightwatchBrowser) {
282+
'Should write to new file #group2 #pr': async function (browser: NightwatchBrowser) {
282283
await clickAndCheckLog(browser, 'fileManager-writeFile', null, { event: 'fileAdded', args: ['testing.txt']}, ['testing.txt', 'test'])
283284
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'testing.txt')
284285
},
285-
'Should rename file #group2': async function (browser: NightwatchBrowser) {
286+
'Should rename file #group2 #pr': async function (browser: NightwatchBrowser) {
286287
await clickAndCheckLog(browser, 'fileManager-rename', null, null, ['testing.txt', 'testrename.txt'])
287288
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'testrename.txt')
288289
},
289290

290-
'Should create empty workspace #group2': async function (browser: NightwatchBrowser) {
291+
'Should create empty workspace #group2 #pr': async function (browser: NightwatchBrowser) {
291292
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, ['emptyworkspace', true])
292293
await clickAndCheckLog(browser, 'filePanel-getCurrentWorkspace', { name: 'emptyworkspace', isLocalhost: false, absolutePath: '.workspaces/emptyworkspace' }, null, null)
293294
await clickAndCheckLog(browser, 'fileManager-readdir', {}, null, '/')
294295
},
295-
'Should create workspace #group2': async function (browser: NightwatchBrowser) {
296+
'Should create workspace #group2 #pr': async function (browser: NightwatchBrowser) {
296297
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, 'testspace')
297298
await clickAndCheckLog(browser, 'filePanel-getCurrentWorkspace', { name: 'testspace', isLocalhost: false, absolutePath: '.workspaces/testspace' }, null, null)
298299
await clickAndCheckLog(browser, 'fileManager-readdir', {
299-
contracts: { isDirectory: true },
300-
scripts: { isDirectory: true },
301-
tests: { isDirectory: true },
302-
'remix.config.json': { isDirectory: false },
303-
'README.txt': { isDirectory: false },
304-
'.prettierrc.json': { isDirectory: false }
300+
"contracts": { "isDirectory": true },
301+
"scripts": { "isDirectory": true },
302+
"tests": { "isDirectory": true },
303+
"README.txt": { "isDirectory": false },
304+
".prettierrc.json": { "isDirectory": false },
305+
"remix.config.json": { "isDirectory": false },
305306
}, null, '/')
306307
},
307-
'Should get all workspaces #group2': async function (browser: NightwatchBrowser) {
308+
'Should get all workspaces #group2 #pr': async function (browser: NightwatchBrowser) {
308309
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"default_workspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }, { name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }, { name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
309310
},
310-
'Should have set workspace event #group2': async function (browser: NightwatchBrowser) {
311+
'Should have set workspace event #group2 #pr': async function (browser: NightwatchBrowser) {
311312
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }]}, 'newspace')
312313
},
313-
'Should have event when switching workspace #group2': async function (browser: NightwatchBrowser) {
314+
'Should have event when switching workspace #group2 #pr': async function (browser: NightwatchBrowser) {
314315
// @ts-ignore
315316
browser.frameParent().useCss().clickLaunchIcon('filePanel').switchWorkspace('default_workspace').useXpath().click('//*[@data-id="verticalIconsKindlocalPlugin"]').frame(0, async () => {
316317
await clickAndCheckLog(browser, null, null, { event: 'setWorkspace', args: [{ name: 'default_workspace', isLocalhost: false }]}, null)
317318
})
318319
},
319320

320-
'Should rename workspace #group2': async function (browser: NightwatchBrowser) {
321+
'Should rename workspace #group2 #pr': async function (browser: NightwatchBrowser) {
321322
await clickAndCheckLog(browser, 'filePanel-renameWorkspace', null, null, ['default_workspace', 'renamed'])
322323
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
323324
},
324-
'Should delete workspace #group2': async function (browser: NightwatchBrowser) {
325+
'Should delete workspace #group2 #pr': async function (browser: NightwatchBrowser) {
325326
await clickAndCheckLog(browser, 'filePanel-deleteWorkspace', null, null, ['testspace'])
326327
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
327328
},

0 commit comments

Comments
 (0)