@@ -38,6 +38,30 @@ describe('element().getRect() command', function () {
38
38
assert . deepStrictEqual ( resultValue , { height : 34 , width : 443 , x : 356 , y : 381.5 } ) ;
39
39
} ) ;
40
40
41
+ it ( 'test .element().rect()' , async function ( ) {
42
+ MockServer . addMock ( {
43
+ url : '/session/13521-10219-202/element/0/rect' ,
44
+ method : 'GET' ,
45
+ response : JSON . stringify ( {
46
+ value : { height : 34 , width : 443 , x : 356 , y : 381.5 }
47
+ } )
48
+ } , true ) ;
49
+
50
+ const resultPromise = this . client . api . element ( '#signupSection' ) . rect ( ) ;
51
+ assert . strictEqual ( resultPromise instanceof Element , false ) ;
52
+ assert . strictEqual ( typeof resultPromise . find , 'undefined' ) ;
53
+
54
+ assert . strictEqual ( resultPromise instanceof Promise , false ) ;
55
+ assert . strictEqual ( typeof resultPromise . then , 'function' ) ;
56
+
57
+ const result = await resultPromise ;
58
+ assert . strictEqual ( result instanceof WebElement , false ) ;
59
+ assert . deepStrictEqual ( result , { height : 34 , width : 443 , x : 356 , y : 381.5 } ) ;
60
+
61
+ const resultValue = await resultPromise . value ;
62
+ assert . deepStrictEqual ( resultValue , { height : 34 , width : 443 , x : 356 , y : 381.5 } ) ;
63
+ } ) ;
64
+
41
65
it ( 'test .element().getSize()' , async function ( ) {
42
66
MockServer . addMock ( {
43
67
url : '/session/13521-10219-202/element/0/rect' ,
@@ -133,4 +157,5 @@ describe('element().getRect() command', function () {
133
157
const resultValue = await resultPromise . value ;
134
158
assert . deepStrictEqual ( resultValue , { height : 34 , width : 443 , x : 356 , y : 381.5 } ) ;
135
159
} ) ;
160
+
136
161
} ) ;
0 commit comments