@@ -15,6 +15,7 @@ import {
1515 testFileLocations ,
1616 testSetup ,
1717 keyRight ,
18+ contextMenuItems ,
1819} from './test_setup.js' ;
1920
2021suite ( 'Menus test' , function ( ) {
@@ -27,20 +28,47 @@ suite('Menus test', function () {
2728 await this . browser . pause ( PAUSE_TIME ) ;
2829 } ) ;
2930
30- test ( 'Menu action opens menu ' , async function ( ) {
31+ test ( 'Menu on block ' , async function ( ) {
3132 // Navigate to draw_circle_1.
3233 await tabNavigateToWorkspace ( this . browser ) ;
3334 await focusOnBlock ( this . browser , 'draw_circle_1' ) ;
3435 await this . browser . pause ( PAUSE_TIME ) ;
3536 await this . browser . keys ( [ Key . Ctrl , Key . Return ] ) ;
3637 await this . browser . pause ( PAUSE_TIME ) ;
37- chai . assert . isTrue (
38- await contextMenuExists ( this . browser , 'Collapse Block' ) ,
39- 'The menu should be openable on a block' ,
38+
39+ chai . assert . deepEqual (
40+ process . platform === 'darwin'
41+ ? [
42+ { 'text' : 'Duplicate D' } ,
43+ { 'text' : 'Add Comment' } ,
44+ { 'text' : 'External Inputs' } ,
45+ { 'text' : 'Collapse Block' } ,
46+ { 'text' : 'Disable Block' } ,
47+ { 'text' : 'Delete 2 Blocks Delete' } ,
48+ { 'text' : 'Move Block M' } ,
49+ { 'text' : 'Edit Block contents Right' } ,
50+ { 'text' : 'Cut ⌘ X' } ,
51+ { 'text' : 'Copy ⌘ C' } ,
52+ { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
53+ ]
54+ : [
55+ { 'text' : 'Duplicate D' } ,
56+ { 'text' : 'Add Comment' } ,
57+ { 'text' : 'External Inputs' } ,
58+ { 'text' : 'Collapse Block' } ,
59+ { 'text' : 'Disable Block' } ,
60+ { 'text' : 'Delete 2 Blocks Delete' } ,
61+ { 'text' : 'Move Block M' } ,
62+ { 'text' : 'Edit Block contents Right' } ,
63+ { 'text' : 'Cut Ctrl + X' } ,
64+ { 'text' : 'Copy Ctrl + C' } ,
65+ { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
66+ ] ,
67+ await contextMenuItems ( this . browser ) ,
4068 ) ;
4169 } ) ;
4270
43- test ( 'Menu action returns true in the toolbox' , async function ( ) {
71+ test ( 'Menu on block in the toolbox' , async function ( ) {
4472 // Navigate to draw_circle_1.
4573 await tabNavigateToWorkspace ( this . browser ) ;
4674 await focusOnBlock ( this . browser , 'draw_circle_1' ) ;
@@ -51,13 +79,60 @@ suite('Menus test', function () {
5179 await this . browser . keys ( [ Key . Ctrl , Key . Return ] ) ;
5280 await this . browser . pause ( PAUSE_TIME ) ;
5381
54- chai . assert . isTrue (
55- await contextMenuExists ( this . browser , 'Help' ) ,
56- 'The menu should be openable on a block in the toolbox' ,
82+ chai . assert . deepEqual (
83+ process . platform === 'darwin'
84+ ? [
85+ { 'text' : 'Help' } ,
86+ { 'disabled' : true , 'text' : 'Move Block M' } ,
87+ { 'disabled' : true , 'text' : 'Cut ⌘ X' } ,
88+ { 'text' : 'Copy ⌘ C' } ,
89+ { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
90+ ]
91+ : [
92+ { 'text' : 'Help' } ,
93+ { 'disabled' : true , 'text' : 'Move Block M' } ,
94+ { 'disabled' : true , 'text' : 'Cut Ctrl + X' } ,
95+ { 'text' : 'Copy Ctrl + C' } ,
96+ { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
97+ ] ,
98+ await contextMenuItems ( this . browser ) ,
99+ ) ;
100+ } ) ;
101+
102+ test ( 'Menu on workspace' , async function ( ) {
103+ // Navigate to draw_circle_1.
104+ await tabNavigateToWorkspace ( this . browser ) ;
105+ await this . browser . keys ( 'w' ) ;
106+ await this . browser . keys ( [ Key . Ctrl , Key . Return ] ) ;
107+ await this . browser . pause ( PAUSE_TIME ) ;
108+
109+ chai . assert . deepEqual (
110+ process . platform === 'darwin'
111+ ? [
112+ { 'disabled' : true , 'text' : 'Undo' } ,
113+ { 'disabled' : true , 'text' : 'Redo' } ,
114+ { 'text' : 'Clean up Blocks' } ,
115+ { 'text' : 'Collapse Blocks' } ,
116+ { 'disabled' : true , 'text' : 'Expand Blocks' } ,
117+ { 'text' : 'Delete 4 Blocks' } ,
118+ { 'text' : 'Add Comment' } ,
119+ { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
120+ ]
121+ : [
122+ { 'disabled' : true , 'text' : 'Undo' } ,
123+ { 'disabled' : true , 'text' : 'Redo' } ,
124+ { 'text' : 'Clean up Blocks' } ,
125+ { 'text' : 'Collapse Blocks' } ,
126+ { 'disabled' : true , 'text' : 'Expand Blocks' } ,
127+ { 'text' : 'Delete 4 Blocks' } ,
128+ { 'text' : 'Add Comment' } ,
129+ { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
130+ ] ,
131+ await contextMenuItems ( this . browser ) ,
57132 ) ;
58133 } ) ;
59134
60- test ( 'Menu action returns false during drag' , async function ( ) {
135+ test ( 'Menu on block during drag is not shown ' , async function ( ) {
61136 // Navigate to draw_circle_1.
62137 await tabNavigateToWorkspace ( this . browser ) ;
63138 await focusOnBlock ( this . browser , 'draw_circle_1' ) ;
0 commit comments