Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
42babc67
Commit
42babc67
authored
Oct 17, 2021
by
bunsenstraat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addlocalplugin command
parent
f5c59acf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
59 deletions
+71
-59
addLocalPlugin.ts
apps/remix-ide-e2e/src/commands/addLocalPlugin.ts
+46
-0
app.tsx
apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
+1
-4
logger.tsx
apps/remix-ide-e2e/src/local-plugin/src/app/logger.tsx
+0
-3
plugin_api.ts
apps/remix-ide-e2e/src/tests/plugin_api.ts
+23
-52
index.d.ts
apps/remix-ide-e2e/src/types/index.d.ts
+1
-0
No files found.
apps/remix-ide-e2e/src/commands/addLocalPlugin.ts
0 → 100644
View file @
42babc67
import
{
NightwatchBrowser
}
from
'nightwatch'
import
EventEmitter
from
'events'
import
{
ExternalProfile
,
LocationProfile
,
Profile
}
from
'@remixproject/plugin-utils'
class
AddLocalPlugin
extends
EventEmitter
{
command
(
this
:
NightwatchBrowser
,
profile
:
Profile
&
LocationProfile
&
ExternalProfile
):
NightwatchBrowser
{
this
.
api
.
perform
((
done
)
=>
{
addLocalPlugin
(
this
.
api
,
profile
,
()
=>
{
done
()
this
.
emit
(
'complete'
)
})
})
return
this
}
}
function
addLocalPlugin
(
browser
:
NightwatchBrowser
,
profile
:
Profile
&
LocationProfile
&
ExternalProfile
,
callback
:
VoidFunction
)
{
browser
.
waitForElementVisible
(
'*[data-id="remixIdeSidePanel"]'
)
.
pause
(
3000
).
element
(
'css selector'
,
'*[data-id="pluginManagerComponentPluginManager"]'
,
function
(
result
)
{
if
(
result
.
status
===
0
)
{
browser
.
click
(
'*[plugin="pluginManager"]'
)
}
})
browser
.
waitForElementVisible
(
'*[data-id="pluginManagerComponentPluginManager"]'
)
.
execute
(
function
()
{
window
.
testmode
=
true
})
.
click
(
'*[data-id="pluginManagerComponentPluginSearchButton"]'
)
.
waitForElementVisible
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogContainer-react"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalBody-react"]'
)
.
waitForElementVisible
(
'*[data-id="localPluginName"]'
)
.
clearValue
(
'*[data-id="localPluginName"]'
).
setValue
(
'*[data-id="localPluginName"]'
,
profile
.
name
)
.
clearValue
(
'*[data-id="localPluginDisplayName"]'
).
setValue
(
'*[data-id="localPluginDisplayName"]'
,
profile
.
displayName
)
.
clearValue
(
'*[data-id="localPluginUrl"]'
).
setValue
(
'*[data-id="localPluginUrl"]'
,
profile
.
url
)
.
clearValue
(
'*[data-id="localPluginCanActivate"]'
).
setValue
(
'*[data-id="localPluginCanActivate"]'
,
profile
.
canActivate
.
join
(
','
))
.
click
(
'*[data-id="localPluginRadioButtoniframe"]'
)
.
click
(
profile
.
location
===
'sidePanel'
?
'*[data-id="localPluginRadioButtonsidePanel"]'
:
'*[data-id="localPluginRadioButtonmainPanel"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialog-modal-footer-ok-react'
)
.
waitForElementVisible
(
'[data-id="verticalIconsKindlocalPlugin"]'
)
.
click
(
'[data-id="verticalIconsKindlocalPlugin"]'
)
.
perform
(
function
()
{
callback
()
})
}
module
.
exports
=
AddLocalPlugin
apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
View file @
42babc67
...
@@ -20,7 +20,7 @@ import { Profile } from '@remixproject/plugin-utils'
...
@@ -20,7 +20,7 @@ import { Profile } from '@remixproject/plugin-utils'
import
'./app.css'
import
'./app.css'
export
const
client
=
new
RemixPlugin
()
const
client
=
new
RemixPlugin
()
function
App
()
{
function
App
()
{
const
[
payload
,
setPayload
]
=
useState
<
string
>
(
''
)
const
[
payload
,
setPayload
]
=
useState
<
string
>
(
''
)
...
@@ -47,9 +47,7 @@ function App () {
...
@@ -47,9 +47,7 @@ function App () {
profiles
.
map
((
profile
:
Profile
)
=>
{
profiles
.
map
((
profile
:
Profile
)
=>
{
if
(
profile
.
events
)
{
if
(
profile
.
events
)
{
profile
.
events
.
map
((
event
:
string
)
=>
{
profile
.
events
.
map
((
event
:
string
)
=>
{
console
.
log
(
profile
.
name
,
event
)
client
.
on
(
profile
.
name
as
any
,
event
,
(...
args
:
any
)
=>
{
client
.
on
(
profile
.
name
as
any
,
event
,
(...
args
:
any
)
=>
{
console
.
log
(
event
,
args
)
setEvents
({
setEvents
({
event
:
event
,
event
:
event
,
args
:
args
args
:
args
...
@@ -62,7 +60,6 @@ function App () {
...
@@ -62,7 +60,6 @@ function App () {
},
[])
},
[])
const
setAppendChange
=
({
target
}:
any
)
=>
{
const
setAppendChange
=
({
target
}:
any
)
=>
{
console
.
log
(
'append'
,
target
.
checked
)
setAppend
(
target
.
checked
)
setAppend
(
target
.
checked
)
}
}
...
...
apps/remix-ide-e2e/src/local-plugin/src/app/logger.tsx
View file @
42babc67
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
client
}
from
'./app'
interface
loggerProps
{
interface
loggerProps
{
append
:
boolean
,
append
:
boolean
,
log
:
any
,
log
:
any
,
...
...
apps/remix-ide-e2e/src/tests/plugin_api.ts
View file @
42babc67
'use strict'
'use strict'
import
{
ExternalProfile
,
LocationProfile
,
Profile
}
from
'@remixproject/plugin-utils'
import
{
NightwatchBrowser
}
from
'nightwatch'
import
{
NightwatchBrowser
}
from
'nightwatch'
import
init
from
'../helpers/init'
import
init
from
'../helpers/init'
...
@@ -6,11 +7,12 @@ declare global {
...
@@ -6,11 +7,12 @@ declare global {
interface
Window
{
testmode
:
boolean
;
}
interface
Window
{
testmode
:
boolean
;
}
}
}
const
localPluginData
=
{
const
localPluginData
:
Profile
&
LocationProfile
&
ExternalProfile
=
{
pluginName
:
'localPlugin'
,
name
:
'localPlugin'
,
pluginDisplayName
:
'Local Plugin'
,
displayName
:
'Local Plugin'
,
pluginCanActivate
:
'dGitProvider,flattener,solidityUnitTesting'
,
canActivate
:
[
'dGitProvider'
,
'flattener'
,
'solidityUnitTesting'
],
pluginUrl
:
'http://localhost:2020'
url
:
'http://localhost:2020'
,
location
:
'sidePanel'
}
}
const
getBrowserLogs
=
function
(
browser
:
NightwatchBrowser
)
{
const
getBrowserLogs
=
function
(
browser
:
NightwatchBrowser
)
{
...
@@ -18,24 +20,19 @@ const getBrowserLogs = function (browser: NightwatchBrowser) {
...
@@ -18,24 +20,19 @@ const getBrowserLogs = function (browser: NightwatchBrowser) {
console
.
log
(
logEntries
)
console
.
log
(
logEntries
)
})
})
}
}
/*
* PLUGINACTION
const
clickAndCheckLog
=
function
(
browser
:
NightwatchBrowser
,
buttonText
:
string
,
msg
:
any
,
payload
:
string
)
{
* buttonText: which button to click
* msg: what to expect from the log
* payload: extra param for the call
*/
const
pluginAction
=
function
(
browser
:
NightwatchBrowser
,
buttonText
:
string
,
msg
:
any
,
payload
:
string
)
{
if
(
payload
)
{
if
(
payload
)
{
browser
.
clearValue
(
'//*[@id="payload"]'
).
setValue
(
'//*[@id="payload"]'
,
payload
).
pause
(
1000
)
browser
.
clearValue
(
'//*[@id="payload"]'
).
setValue
(
'//*[@id="payload"]'
,
payload
).
pause
(
1000
)
}
}
if
(
msg
&&
typeof
msg
!==
'string'
)
msg
=
JSON
.
stringify
(
msg
)
if
(
msg
&&
typeof
msg
!==
'string'
)
msg
=
JSON
.
stringify
(
msg
)
browser
browser
.
useXpath
().
waitForElementVisible
(
`//*[
text()='
${
buttonText
}
']`
).
click
(
`//*[text()
='
${
buttonText
}
']`
)
.
useXpath
().
waitForElementVisible
(
`//*[
@data-id='
${
buttonText
}
']`
).
click
(
`//*[@data-id
='
${
buttonText
}
']`
)
.
pause
(
2000
)
.
pause
(
2000
)
getBrowserLogs
(
browser
)
getBrowserLogs
(
browser
)
if
(
msg
)
{
if
(
msg
)
{
browser
.
waitForElementVisible
(
'//*[@id="
log"]'
).
verify
.
containsText
(
'//*[@id="log
"]'
,
msg
)
browser
.
waitForElementVisible
(
'//*[@id="
methods"]'
).
verify
.
containsText
(
'//*[@id="methods
"]'
,
msg
)
}
}
}
}
...
@@ -54,55 +51,29 @@ module.exports = {
...
@@ -54,55 +51,29 @@ module.exports = {
})
})
},
},
'Should Load Plugin Manager'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementVisible
(
'*[data-id="remixIdeSidePanel"]'
)
.
pause
(
3000
)
.
click
(
'*[plugin="pluginManager"]'
)
.
pause
(
3000
)
.
waitForElementVisible
(
'*[data-id="pluginManagerComponentPluginManager"]'
)
.
assert
.
containsText
(
'*[data-id="sidePanelSwapitTitle"]'
,
'PLUGIN MANAGER'
)
},
'Should connect a local plugin'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should connect a local plugin'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementVisible
(
'*[data-id="pluginManagerComponentPluginManager"]'
)
browser
.
addLocalPlugin
(
localPluginData
)
.
execute
(
function
()
{
window
.
testmode
=
true
})
.
click
(
'*[data-id="pluginManagerComponentPluginSearchButton"]'
)
.
waitForElementVisible
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogContainer-react"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalBody-react"]'
)
.
waitForElementVisible
(
'*[data-id="localPluginName"]'
)
.
clearValue
(
'*[data-id="localPluginName"]'
).
setValue
(
'*[data-id="localPluginName"]'
,
localPluginData
.
pluginName
)
.
clearValue
(
'*[data-id="localPluginDisplayName"]'
).
setValue
(
'*[data-id="localPluginDisplayName"]'
,
localPluginData
.
pluginDisplayName
)
.
clearValue
(
'*[data-id="localPluginUrl"]'
).
setValue
(
'*[data-id="localPluginUrl"]'
,
localPluginData
.
pluginUrl
)
.
clearValue
(
'*[data-id="localPluginCanActivate"]'
).
setValue
(
'*[data-id="localPluginCanActivate"]'
,
localPluginData
.
pluginCanActivate
)
.
click
(
'*[data-id="localPluginRadioButtoniframe"]'
)
.
click
(
'*[data-id="localPluginRadioButtonsidePanel"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialog-modal-footer-ok-react'
)
.
waitForElementVisible
(
'[data-id="verticalIconsKindlocalPlugin"]'
)
.
click
(
'[data-id="verticalIconsKindlocalPlugin"]'
)
// @ts-ignore
// @ts-ignore
.
frame
(
0
)
.
frame
(
0
)
},
},
'Should get current workspace'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should get current workspace'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'get w
orkspace'
,
{
name
:
'default_workspace'
,
isLocalhost
:
false
,
absolutePath
:
'.workspaces/default_workspace'
},
null
)
clickAndCheckLog
(
browser
,
'filePanel:getCurrentW
orkspace'
,
{
name
:
'default_workspace'
,
isLocalhost
:
false
,
absolutePath
:
'.workspaces/default_workspace'
},
null
)
},
},
'Should get current files'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should get current files'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'
readdir'
,
{
contracts
:
{
isDirectory
:
true
},
scripts
:
{
isDirectory
:
true
},
tests
:
{
isDirectory
:
true
},
'README.txt'
:
{
isDirectory
:
false
}
},
null
)
clickAndCheckLog
(
browser
,
'fileManager:
readdir'
,
{
contracts
:
{
isDirectory
:
true
},
scripts
:
{
isDirectory
:
true
},
tests
:
{
isDirectory
:
true
},
'README.txt'
:
{
isDirectory
:
false
}
},
null
)
},
},
'Should throw error on current file'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should throw error on current file'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'getcurrentf
ile'
,
'Error from IDE : Error: No such file or directory No file selected'
,
null
)
clickAndCheckLog
(
browser
,
'fileManager:getCurrentF
ile'
,
'Error from IDE : Error: No such file or directory No file selected'
,
null
)
},
},
'Should open readme.txt'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should open readme.txt'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'openfile
'
,
null
,
'README.txt'
)
clickAndCheckLog
(
browser
,
'fileManager:open
'
,
null
,
'README.txt'
)
},
},
'Should have current file'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should have current file'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'getcurrentf
ile'
,
'README.txt'
,
null
)
clickAndCheckLog
(
browser
,
'fileManager:getCurrentF
ile'
,
'README.txt'
,
null
)
},
},
'Should activate solidityUnitTesting'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should activate solidityUnitTesting'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'activate
'
,
null
,
'solidityUnitTesting'
)
clickAndCheckLog
(
browser
,
'manager:activatePlugin
'
,
null
,
'solidityUnitTesting'
)
browser
.
frameParent
()
browser
.
frameParent
()
assertPluginIsActive
(
browser
,
'solidityUnitTesting'
)
assertPluginIsActive
(
browser
,
'solidityUnitTesting'
)
// @ts-ignore
// @ts-ignore
...
@@ -110,13 +81,13 @@ module.exports = {
...
@@ -110,13 +81,13 @@ module.exports = {
},
},
'Should switch to file'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should switch to file'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'switch to f
ile'
,
null
,
'contracts/1_Storage.sol'
)
clickAndCheckLog
(
browser
,
'fileManager:switchF
ile'
,
null
,
'contracts/1_Storage.sol'
)
pluginAction
(
browser
,
'getcurrentf
ile'
,
'contracts/1_Storage.sol'
,
null
)
clickAndCheckLog
(
browser
,
'fileManager:getCurrentF
ile'
,
'contracts/1_Storage.sol'
,
null
)
pluginAction
(
browser
,
'switch to f
ile'
,
null
,
'README.txt'
)
clickAndCheckLog
(
browser
,
'fileManager:switchF
ile'
,
null
,
'README.txt'
)
pluginAction
(
browser
,
'getcurrentf
ile'
,
'README.txt'
,
null
)
clickAndCheckLog
(
browser
,
'fileManager:getCurrentF
ile'
,
'README.txt'
,
null
)
},
},
'Should write to file'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should write to file'
:
function
(
browser
:
NightwatchBrowser
)
{
pluginAction
(
browser
,
'writ
e'
,
'README.txt'
,
null
)
clickAndCheckLog
(
browser
,
'fileManager:writeFil
e'
,
'README.txt'
,
null
)
}
}
}
}
apps/remix-ide-e2e/src/types/index.d.ts
View file @
42babc67
...
@@ -57,6 +57,7 @@ declare module 'nightwatch' {
...
@@ -57,6 +57,7 @@ declare module 'nightwatch' {
checkAnnotationsNotPresent
(
type
:
string
):
NightwatchBrowser
checkAnnotationsNotPresent
(
type
:
string
):
NightwatchBrowser
getLastTransactionHash
(
callback
:
(
hash
:
string
)
=>
void
)
getLastTransactionHash
(
callback
:
(
hash
:
string
)
=>
void
)
currentWorkspaceIs
(
name
:
string
):
NightwatchBrowser
currentWorkspaceIs
(
name
:
string
):
NightwatchBrowser
addLocalPlugin
(
this
:
NightwatchBrowser
,
profile
:
Profile
&
LocationProfile
&
ExternalProfile
):
NightwatchBrowser
}
}
export
interface
NightwatchBrowser
{
export
interface
NightwatchBrowser
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment