22
33context ( 'Talking to the api directly' , ( ) => {
44 describe ( 'API version' , ( ) => {
5- before ( function ( ) {
6- cy . connect ( ) ;
7- cy . visit ( '/' ) ;
8- } ) ;
9- it ( 'should fail to connect with older api' , ( ) => {
10- cy . intercept ( 'GET' , Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/version' , { fixture : 'bad_api' } ) ;
11- cy . get ( '.fusion-item' ) . click ( ) . then ( ( ) => {
12- cy . get ( '.dialogTitle' ) . should ( 'contain.text' , 'New Connection' ) ;
13- cy . get ( '.dialogContent' ) . should ( 'be.visible' )
14- . should ( 'contain.text' , 'Outdated API "0.0.1"' )
15- . should ( 'contain.text' , 'You need to update your API to version "0.2.0" or higher' ) ;
16- cy . get ( '.theia-button.main' ) . should ( 'be.visible' ) . click ( ) ;
17- cy . get ( '.dialogBlock' ) . should ( 'not.exist' ) ;
18- } ) ;
19- } ) ;
20- it ( 'should connect with newer api' , ( ) => {
21- cy . window ( ) . then ( function ( win ) {
22- const fetchSpy = cy . spy ( win , 'fetch' ) ;
23- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/version' ) . as ( '/version' ) ;
24- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/explorer?uri=/' ) . as ( '/explorer' ) ;
25- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/user' ) . as ( '/user' ) ;
26- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/group' ) . as ( '/group' ) ;
27- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/index' ) . as ( '/index' ) ;
28- fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/restxq' ) . as ( '/restxq' ) ;
29- cy . get ( '.fusion-item' ) . click ( ) ;
5+ before ( function ( ) {
6+ cy . connect ( )
7+ cy . visit ( '/' )
8+ } )
9+ describe ( 'With outdated API' , ( ) => {
10+ it ( 'should fail to connect with older api' , ( ) => {
11+ cy . intercept ( 'GET' , Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/version' , { fixture : 'bad_api' } )
12+ cy . get ( '.fusion-item' ) . click ( ) . then ( ( ) => {
13+ cy . get ( '.dialogTitle' ) . should ( 'contain.text' , 'New Connection' )
14+ cy . get ( '.dialogContent' ) . should ( 'be.visible' )
15+ . should ( 'contain.text' , 'Outdated API "0.0.1"' )
16+ . should ( 'contain.text' , 'You need to update your API to version "0.2.0" or higher' )
17+ cy . get ( '.theia-button.main' ) . should ( 'be.visible' ) . click ( )
18+ cy . get ( '.dialogBlock' ) . should ( 'not.exist' )
19+ } )
20+ } )
21+ } )
22+ describe ( 'With current API' , ( ) => {
23+ it ( 'should reach all api endpoints' , ( ) => {
24+ cy . window ( ) . then ( function ( win ) {
25+ const fetchSpy = cy . spy ( win , 'fetch' )
26+ fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/version' ) . as ( '/version' )
27+ fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/explorer?uri=/' ) . as ( '/explorer' )
28+ fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/user' ) . as ( '/user' )
29+ fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/group' ) . as ( '/group' )
30+ fetchSpy . withArgs ( Cypress . env ( 'API_HOST' ) + '/exist/restxq/fusiondb/index' ) . as ( '/index' )
31+ // See #508
32+ // fetchSpy.withArgs(Cypress.env('API_HOST') + '/exist/restxq/fusiondb/restxq').as('/restxq')
33+ cy . get ( '.fusion-item' ) . click ( )
34+ cy . get ( '@/version' ) . should ( 'be.called' )
35+ cy . get ( '@/explorer' ) . should ( 'be.called' )
36+ cy . get ( '@/user' ) . should ( 'be.called' )
37+ cy . get ( '@/group' ) . should ( 'be.called' )
38+ cy . get ( '@/index' ) . should ( 'be.called' )
39+ // See #508
40+ // cy.get('@/restxq').should('be.called')
41+ } )
42+ } )
43+
44+ // (DP) we might want to merge the three cases again at a future time
45+ it ( 'should display db tree item' , ( ) => {
46+ cy . contains ( 'localhost' ) . click ( )
3047 cy . get ( '.fusion-view' )
3148 . should ( 'contain' , 'db' )
32- . should ( 'contain' , 'RestXQ' ) ;
33- cy . get ( '@/version' ) . should ( 'be.called' ) ;
34- cy . get ( '@/explorer' ) . should ( 'be.called' ) ;
35- cy . get ( '@/user' ) . should ( 'be.called' ) ;
36- cy . get ( '@/group' ) . should ( 'be.called' ) ;
37- cy . get ( '@/index' ) . should ( 'be.called' ) ;
38- cy . get ( '@/restxq' ) . should ( 'be.called' ) ;
39- } ) ;
40- } ) ;
41- } ) ;
42- } )
49+ // .should('contain', 'Security')
50+ // .should('contain', 'RestXQ')
51+ } )
52+
53+ it ( 'should display security tree item' , ( ) => {
54+ cy . contains ( 'localhost' )
55+ cy . get ( '.fusion-view' )
56+ . should ( 'contain' , 'Security' )
57+ } )
58+
59+ // see #508
60+ it . skip ( 'should display restxq tree item' , ( ) => {
61+ cy . contains ( 'localhost' )
62+ cy . get ( '.fusion-view' )
63+ . should ( 'contain' , 'RestXQ' )
64+ } )
65+ } )
66+ } )
67+ } )
0 commit comments