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
61f5bd77
Commit
61f5bd77
authored
Jul 31, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added gist tests
parent
fe5a5e48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
1 deletion
+138
-1
getModalBody.ts
apps/remix-ide-e2e/src/commands/getModalBody.ts
+17
-0
modalFooterCancelClick.ts
apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
+20
-0
gist.test.ts
apps/remix-ide-e2e/src/tests/gist.test.ts
+98
-0
index.d.ts
apps/remix-ide-e2e/src/types/index.d.ts
+3
-1
No files found.
apps/remix-ide-e2e/src/commands/getModalBody.ts
0 → 100644
View file @
61f5bd77
import
{
NightwatchBrowser
}
from
"nightwatch"
import
EventEmitter
from
"events"
class
GetModalBody
extends
EventEmitter
{
command
(
this
:
NightwatchBrowser
,
callback
:
CallableFunction
)
{
this
.
api
.
waitForElementVisible
(
'.modal-body'
)
.
getText
(
'.modal-body'
,
(
result
)
=>
{
console
.
log
(
result
)
callback
(
result
.
value
,
()
=>
{
this
.
emit
(
'complete'
)
})
})
return
this
}
}
module
.
exports
=
GetModalBody
apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
0 → 100644
View file @
61f5bd77
import
{
NightwatchBrowser
}
from
'nightwatch'
import
EventEmitter
from
"events"
class
ModalFooterOKClick
extends
EventEmitter
{
command
(
this
:
NightwatchBrowser
):
NightwatchBrowser
{
this
.
api
.
waitForElementVisible
(
'#modal-footer-cancel'
).
perform
((
client
,
done
)
=>
{
this
.
api
.
execute
(
function
()
{
const
elem
=
document
.
querySelector
(
'#modal-footer-cancel'
)
as
HTMLElement
elem
.
click
()
},
[],
()
=>
{
done
()
this
.
emit
(
'complete'
)
})
})
return
this
}
}
module
.
exports
=
ModalFooterOKClick
apps/remix-ide-e2e/src/tests/gist.test.ts
0 → 100644
View file @
61f5bd77
'use strict'
import
{
NightwatchBrowser
}
from
"nightwatch"
const
init
=
require
(
'../helpers/init'
)
const
sauce
=
require
(
'./sauce'
)
const
testData
=
{
validGistId
:
'1859c97c6e1efc91047d725d5225888e'
,
invalidGistId
:
'6368b389f9302v32902msk2402'
}
// 99266d6da54cc12f37f11586e8171546c7700d67
module
.
exports
=
{
before
:
function
(
browser
:
NightwatchBrowser
,
done
:
VoidFunction
)
{
init
(
browser
,
done
)
},
'UploadToGists'
:
function
(
browser
:
NightwatchBrowser
)
{
/*
- set the access token
- publish to gist
- retrieve the gist
- switch to a file in the new gist
*/
console
.
log
(
'token'
,
process
.
env
.
gist_token
)
const
runtimeBrowser
=
browser
.
capabilities
.
browserName
browser
.
waitForElementVisible
(
'*[data-id="remixIdeIconPanel"]'
,
10000
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
rightClick
(
'[data-path="browser/1_Storage.sol"]'
)
.
click
(
'*[id="menuitemcreate folder"]'
)
.
waitForElementVisible
(
'*[data-id="modalDialogContainer"]'
)
.
setValue
(
'*[data-id="modalDialogCustomPromptText"]'
,
'Browser_Tests'
)
.
modalFooterOKClick
()
.
waitForElementVisible
(
'*[data-id="treeViewLibrowser/Browser_Tests"]'
)
.
addFile
(
'File.sol'
,
{
content
:
''
})
.
click
(
'*[data-id="fileExplorerNewFilepublishToGist"]'
)
.
modalFooterOKClick
()
.
getModalBody
((
value
,
done
)
=>
{
const
reg
=
/gist.github.com
\/([^
.
]
+
)
/
const
id
=
value
.
match
(
reg
)
console
.
log
(
'gist regex'
,
id
)
if
(
!
id
)
{
browser
.
assert
.
fail
(
'cannot get the gist id'
,
''
,
''
)
}
else
{
const
gistid
=
id
[
1
]
browser
.
modalFooterCancelClick
()
.
executeScript
(
`remix.loadgist('
${
gistid
}
')`
)
.
perform
((
done
)
=>
{
if
(
runtimeBrowser
===
'chrome'
)
{
browser
.
openFile
(
'browser/gists'
)
}
done
()
})
.
openFile
(
`browser/gists/
${
gistid
}
/1_Storage.sol`
)
.
perform
(
done
)
}
})
},
'Load Gist Modal'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
clickLaunchIcon
(
'home'
)
.
waitForElementVisible
(
'*[data-id="remixIdeIconPanel"]'
,
10000
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
scrollAndClick
(
'*[data-id="landingPageImportFromGistButton"]'
)
.
waitForElementVisible
(
'*[data-id="modalDialogModalTitle"]'
)
.
assert
.
containsText
(
'*[data-id="modalDialogModalTitle"]'
,
'Load a Gist'
)
.
waitForElementVisible
(
'*[data-id="modalDialogModalBody"]'
)
.
assert
.
containsText
(
'*[data-id="modalDialogModalBody"]'
,
'Enter the ID of the Gist or URL you would like to load.'
)
.
waitForElementVisible
(
'*[data-id="modalDialogCustomPromptText"]'
)
.
modalFooterCancelClick
()
},
'Display Error Message For Invalid Gist ID'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementVisible
(
'*[data-id="remixIdeIconPanel"]'
,
10000
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
scrollAndClick
(
'*[data-id="landingPageImportFromGistButton"]'
)
.
waitForElementVisible
(
'*[data-id="modalDialogCustomPromptText"]'
)
.
setValue
(
'*[data-id="modalDialogCustomPromptText"]'
,
testData
.
invalidGistId
)
.
modalFooterOKClick
()
.
waitForElementVisible
(
'*[data-id="modalDialogModalBody"]'
)
.
assert
.
containsText
(
'*[data-id="modalDialogModalBody"]'
,
'Gist load error: Not Found'
)
.
modalFooterOKClick
()
},
'Import From Gist For Valid Gist ID'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementVisible
(
'*[data-id="remixIdeIconPanel"]'
,
10000
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
scrollAndClick
(
'*[data-id="landingPageImportFromGistButton"]'
)
.
waitForElementVisible
(
'*[data-id="modalDialogCustomPromptText"]'
)
.
setValue
(
'*[data-id="modalDialogCustomPromptText"]'
,
testData
.
validGistId
)
.
modalFooterOKClick
()
.
openFile
(
`browser/gists/
${
testData
.
validGistId
}
/ApplicationRegistry`
)
.
waitForElementVisible
(
`div[title='browser/gists/
${
testData
.
validGistId
}
/ApplicationRegistry']`
)
.
assert
.
containsText
(
`div[title='browser/gists/
${
testData
.
validGistId
}
/ApplicationRegistry'] > span`
,
'ApplicationRegistry'
)
.
end
()
},
tearDown
:
sauce
}
apps/remix-ide-e2e/src/types/index.d.ts
View file @
61f5bd77
...
@@ -30,7 +30,9 @@ declare module "nightwatch" {
...
@@ -30,7 +30,9 @@ declare module "nightwatch" {
editorScroll
(
direction
:
'up'
|
'down'
,
numberOfTimes
:
number
):
NightwatchBrowser
,
editorScroll
(
direction
:
'up'
|
'down'
,
numberOfTimes
:
number
):
NightwatchBrowser
,
renameFile
(
path
:
string
,
newFileName
:
string
,
renamedPath
:
string
):
NightwatchBrowser
,
renameFile
(
path
:
string
,
newFileName
:
string
,
renamedPath
:
string
):
NightwatchBrowser
,
rightClick
(
cssSelector
:
string
):
NightwatchBrowser
,
rightClick
(
cssSelector
:
string
):
NightwatchBrowser
,
waitForElementContainsText
(
id
:
string
,
value
:
string
):
NightwatchBrowser
waitForElementContainsText
(
id
:
string
,
value
:
string
):
NightwatchBrowser
,
getModalBody
(
callback
:
CallableFunction
):
NightwatchBrowser
,
modalFooterCancelClick
():
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