@@ -7,6 +7,7 @@ var Lib = require('@src/lib');
77var createGraphDiv = require ( '../assets/create_graph_div' ) ;
88var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
99var selectButton = require ( '../assets/modebar_button' ) ;
10+ var customMatchers = require ( '../assets/custom_matchers' ) ;
1011
1112/*
1213 * WebGL interaction test cases fail on the CircleCI
@@ -18,6 +19,10 @@ var selectButton = require('../assets/modebar_button');
1819describe ( 'Test plot structure' , function ( ) {
1920 'use strict' ;
2021
22+ beforeEach ( function ( ) {
23+ jasmine . addMatchers ( customMatchers ) ;
24+ } ) ;
25+
2126 afterEach ( destroyGraphDiv ) ;
2227
2328 describe ( 'gl3d plots' , function ( ) {
@@ -148,7 +153,7 @@ describe('Test plot structure', function() {
148153
149154 describe ( 'buttons resetCameraDefault3d and resetCameraLastSave3d' , function ( ) {
150155 // changes in scene objects are not instantaneous
151- var DELAY = 1000 ;
156+ var DELAY = 200 ;
152157
153158 it ( 'should update the scene camera' , function ( done ) {
154159 var sceneLayout = gd . _fullLayout . scene ,
@@ -166,22 +171,22 @@ describe('Test plot structure', function() {
166171 expect ( sceneLayout . camera . eye )
167172 . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
168173 expect ( scene . camera . eye )
169- . toEqual ( [ 1.2500000000000002 , 1.25 , 1.25 ] ) ;
174+ . toBeCloseToArray ( [ 1.25 , 1.25 , 1.25 ] , 4 ) ;
170175 expect ( sceneLayout2 . camera . eye )
171176 . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } , 'does not change the layout objects' ) ;
172177 expect ( scene2 . camera . eye )
173- . toEqual ( [ 1.2500000000000002 , 1.25 , 1.25 ] ) ;
178+ . toBeCloseToArray ( [ 1.25 , 1.25 , 1.25 ] , 4 ) ;
174179
175180 selectButton ( modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
176181 setTimeout ( function ( ) {
177182 expect ( sceneLayout . camera . eye )
178183 . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
179184 expect ( scene . camera . eye )
180- . toEqual ( [ 0.10000000000000016 , 0.10000000000000016 , 1 ] ) ;
185+ . toBeCloseToArray ( [ 0.1 , 0.1 , 1 ] , 4 ) ;
181186 expect ( sceneLayout2 . camera . eye )
182187 . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } , 'does not change the layout objects' ) ;
183188 expect ( scene2 . camera . eye )
184- . toEqual ( [ 2.500000000000001 , 2.5000000000000004 , 2.5000000000000004 ] ) ;
189+ . toBeCloseToArray ( [ 2.5 , 2.5 , 2.5 ] , 4 ) ;
185190
186191 done ( ) ;
187192 } , DELAY ) ;
0 commit comments