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
e00a7f88
Commit
e00a7f88
authored
Feb 09, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add rename/remove file
parent
da4d28f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
1 deletion
+78
-1
contracts.js
test-browser/helpers/contracts.js
+78
-1
No files found.
test-browser/helpers/contracts.js
View file @
e00a7f88
...
@@ -17,7 +17,10 @@ module.exports = {
...
@@ -17,7 +17,10 @@ module.exports = {
createContract
,
createContract
,
modalFooterOKClick
,
modalFooterOKClick
,
setEditorValue
,
setEditorValue
,
getEditorValue
getEditorValue
,
testEditorValue
,
renameFile
,
removeFile
}
}
function
getCompiledContracts
(
browser
,
compiled
,
callback
)
{
function
getCompiledContracts
(
browser
,
compiled
,
callback
)
{
...
@@ -184,6 +187,13 @@ function getEditorValue (callback) {
...
@@ -184,6 +187,13 @@ function getEditorValue (callback) {
return
this
return
this
}
}
function
testEditorValue
(
testvalue
,
callback
)
{
this
.
getEditorValue
((
value
)
=>
{
this
.
assert
.
equal
(
testvalue
,
value
)
callback
()
})
}
function
modalFooterOKClick
()
{
function
modalFooterOKClick
()
{
this
.
perform
((
client
,
done
)
=>
{
this
.
perform
((
client
,
done
)
=>
{
this
.
execute
(
function
()
{
this
.
execute
(
function
()
{
...
@@ -215,6 +225,73 @@ function addFile (browser, name, content, done) {
...
@@ -215,6 +225,73 @@ function addFile (browser, name, content, done) {
})
})
}
}
function
renameFile
(
browser
,
path
,
newFileName
,
renamedPath
,
done
)
{
browser
.
execute
(
function
(
path
)
{
function
contextMenuClick
(
element
)
{
var
evt
=
element
.
ownerDocument
.
createEvent
(
'MouseEvents'
)
var
RIGHT_CLICK_BUTTON_CODE
=
2
// the same for FF and IE
evt
.
initMouseEvent
(
'contextmenu'
,
true
,
true
,
element
.
ownerDocument
.
defaultView
,
1
,
0
,
0
,
0
,
0
,
false
,
false
,
false
,
false
,
RIGHT_CLICK_BUTTON_CODE
,
null
)
if
(
document
.
createEventObject
)
{
// dispatch for IE
return
element
.
fireEvent
(
'onclick'
,
evt
)
}
else
{
// dispatch for firefox + others
return
!
element
.
dispatchEvent
(
evt
)
}
}
contextMenuClick
(
document
.
querySelector
(
'[data-path="'
+
path
+
'"]'
))
},
[
path
],
function
(
result
)
{
browser
.
click
(
'#menuitemrename'
)
.
perform
((
client
,
doneSetValue
)
=>
{
browser
.
execute
(
function
(
path
,
addvalue
)
{
document
.
querySelector
(
'[data-path="'
+
path
+
'"]'
).
innerHTML
=
addvalue
},
[
path
,
newFileName
],
()
=>
{
doneSetValue
()
})
})
.
click
(
'body'
)
// blur
.
pause
(
500
)
.
click
(
'#modal-footer-ok'
)
.
waitForElementNotPresent
(
'[data-path="'
+
path
+
'"]'
)
.
waitForElementPresent
(
'[data-path="'
+
renamedPath
+
'"]'
)
.
perform
(()
=>
{
done
()
})
})
}
function
removeFile
(
browser
,
path
,
done
)
{
browser
.
execute
(
function
(
path
,
value
)
{
function
contextMenuClick
(
element
)
{
var
evt
=
element
.
ownerDocument
.
createEvent
(
'MouseEvents'
)
var
RIGHT_CLICK_BUTTON_CODE
=
2
// the same for FF and IE
evt
.
initMouseEvent
(
'contextmenu'
,
true
,
true
,
element
.
ownerDocument
.
defaultView
,
1
,
0
,
0
,
0
,
0
,
false
,
false
,
false
,
false
,
RIGHT_CLICK_BUTTON_CODE
,
null
)
if
(
document
.
createEventObject
)
{
// dispatch for IE
return
element
.
fireEvent
(
'onclick'
,
evt
)
}
else
{
// dispatch for firefox + others
return
!
element
.
dispatchEvent
(
evt
)
}
}
contextMenuClick
(
document
.
querySelector
(
'[data-path="'
+
path
+
'"]'
))
},
[
path
],
function
(
result
)
{
browser
.
click
(
'#menuitemdelete'
)
.
pause
(
500
)
.
click
(
'#modal-footer-ok'
)
.
waitForElementNotPresent
(
'[data-path="'
+
path
+
'"]'
)
.
perform
((
client
)
=>
{
done
()
})
})
}
function
useFilter
(
browser
,
filter
,
test
,
done
)
{
function
useFilter
(
browser
,
filter
,
test
,
done
)
{
if
(
browser
.
options
.
desiredCapabilities
.
browserName
===
'chrome'
)
{
// nightwatch deos not handle well that part.... works locally
if
(
browser
.
options
.
desiredCapabilities
.
browserName
===
'chrome'
)
{
// nightwatch deos not handle well that part.... works locally
done
()
done
()
...
...
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