Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Rocket.Chat.Electron
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RocketChat
Rocket.Chat.Electron
Commits
0d6df06d
Commit
0d6df06d
authored
Sep 14, 2018
by
Tasso Evangelista
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helpers for menu items in e2e tests
parent
cecc1045
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
e2e/utils.js
e2e/utils.js
+47
-0
No files found.
e2e/utils.js
View file @
0d6df06d
...
...
@@ -38,3 +38,50 @@ const fetchLogs = async () => {
const
logs
=
await
app
.
client
.
getMainProcessLogs
();
logs
.
forEach
(
log
=>
console
.
log
(
log
));
};
export
const
menuItem
=
(
menuId
,
cb
)
=>
({
get
exists
()
{
return
app
.
client
.
execute
((
menuId
)
=>
{
const
{
Menu
}
=
require
(
'
electron
'
).
remote
;
const
appMenu
=
Menu
.
getApplicationMenu
();
const
menuItem
=
appMenu
.
getMenuItemById
(
menuId
);
return
!!
menuItem
;
},
menuId
).
then
(({
value
})
=>
value
);
},
get
enabled
()
{
return
app
.
client
.
execute
((
menuId
)
=>
{
const
{
Menu
}
=
require
(
'
electron
'
).
remote
;
const
appMenu
=
Menu
.
getApplicationMenu
();
const
menuItem
=
appMenu
.
getMenuItemById
(
menuId
);
return
menuItem
.
enabled
;
},
menuId
).
then
(({
value
})
=>
value
);
},
get
visible
()
{
return
app
.
client
.
execute
((
menuId
)
=>
{
const
{
Menu
}
=
require
(
'
electron
'
).
remote
;
const
appMenu
=
Menu
.
getApplicationMenu
();
const
menuItem
=
appMenu
.
getMenuItemById
(
menuId
);
return
menuItem
.
visible
;
},
menuId
).
then
(({
value
})
=>
value
);
},
get
label
()
{
return
app
.
client
.
execute
((
menuId
)
=>
{
const
{
Menu
}
=
require
(
'
electron
'
).
remote
;
const
appMenu
=
Menu
.
getApplicationMenu
();
const
menuItem
=
appMenu
.
getMenuItemById
(
menuId
);
return
menuItem
.
label
;
},
menuId
).
then
(({
value
})
=>
value
);
},
click
()
{
return
app
.
client
.
execute
((
menuId
)
=>
{
const
{
Menu
}
=
require
(
'
electron
'
).
remote
;
const
appMenu
=
Menu
.
getApplicationMenu
();
const
menuItem
=
appMenu
.
getMenuItemById
(
menuId
);
menuItem
.
click
();
},
menuId
);
}
});
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