1
1
const Application = require ( "spectron" ) . Application ;
2
2
const electronPath = require ( "electron" ) ;
3
3
const libnut = require ( "../.." ) ;
4
- const { POS_X , POS_Y , WIDTH , HEIGTH , TITLE } = require ( "./constants" ) ;
4
+ const { POS_X , POS_Y , WIDTH , HEIGTH , TITLE } = require ( "./constants" ) ;
5
5
6
6
const sleep = async ( ms ) => {
7
7
return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
@@ -67,11 +67,17 @@ describe("getActiveWindow", () => {
67
67
// GIVEN
68
68
const xPosition = 42 ;
69
69
const yPosition = 25 ;
70
+ if ( process . arch === 'darwin' ) {
71
+ await app . browserWindow . setPosition ( xPosition , yPosition ) ;
72
+ await sleep ( 1000 ) ;
73
+ }
70
74
71
75
// WHEN
72
76
const activeWindowHandle = libnut . getActiveWindow ( ) ;
73
- libnut . moveWindow ( activeWindowHandle , { x : xPosition , y : yPosition } ) ;
74
- await sleep ( 1000 ) ;
77
+ if ( process . arch !== 'darwin' ) {
78
+ libnut . moveWindow ( activeWindowHandle , { x : xPosition , y : yPosition } ) ;
79
+ await sleep ( 1000 ) ;
80
+ }
75
81
const activeWindowRect = libnut . getWindowRect ( activeWindowHandle ) ;
76
82
77
83
// THEN
@@ -83,11 +89,17 @@ describe("getActiveWindow", () => {
83
89
// GIVEN
84
90
const newWidth = 400 ;
85
91
const newHeight = 250 ;
92
+ if ( process . arch === 'darwin' ) {
93
+ await app . browserWindow . setSize ( newWidth , newHeight ) ;
94
+ await sleep ( 1000 ) ;
95
+ }
86
96
87
97
// WHEN
88
98
const activeWindowHandle = libnut . getActiveWindow ( ) ;
89
- libnut . resizeWindow ( activeWindowHandle , { width : newWidth , height : newHeight } ) ;
90
- await sleep ( 1000 ) ;
99
+ if ( process . arch !== 'darwin' ) {
100
+ libnut . resizeWindow ( activeWindowHandle , { width : newWidth , height : newHeight } ) ;
101
+ await sleep ( 1000 ) ;
102
+ }
91
103
const activeWindowRect = libnut . getWindowRect ( activeWindowHandle ) ;
92
104
93
105
// THEN
0 commit comments