11/// <reference types="Cypress" />
2+ import { mkApiPathUrl , fsUrl } from '../support/config.js' ;
23import '@4tw/cypress-drag-drop'
34import { treenode , dialogTitle , dialogBody , dialogMainButton , dialog } from '../support/utils' ;
45context ( 'Fusion Studio' , function ( ) {
@@ -9,102 +10,102 @@ context('Fusion Studio', function () {
910 } ) ;
1011 describe ( 'Documents and Collections' , function ( ) {
1112 it ( 'Browse to root dir "db"' , function ( ) {
12- cy . visit ( 'http://localhost:3000' )
13+ cy . visit ( fsUrl )
1314 . get ( '#theia-top-panel' , { timeout : 30000 } )
1415 . should ( 'be.visible' )
1516 . get ( '.theia-preload' ) . should ( 'not.exist' ) ;
1617 cy . addConnection ( ) ;
1718 cy . get ( '.fusion-item' ) . should ( 'have.length' , 5 ) . its ( 'length' ) . then ( count => {
18- cy . getTreeNode ( 'admin@http://localhost:8080/ db' ) . click ( ) ;
19+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db') ) . click ( ) ;
1920 cy . get ( '.fusion-item' ) . should ( 'have.length.gt' , count ) ;
2021 } ) ;
2122 } )
2223 it ( 'create test collections' , function ( ) {
23- cy . addCollection ( 'admin@http://localhost:8080/ db' , 'test_col' ) ;
24- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col' ) . click ( ) ;
25- cy . addCollection ( 'admin@http://localhost:8080/ db/test_col' , 'col1' ) ;
26- cy . addCollection ( 'admin@http://localhost:8080/ db/test_col' , 'col2' ) ;
27- cy . addCollection ( 'admin@http://localhost:8080/ db/test_col' , 'col3' ) ;
24+ cy . addCollection ( mkApiPathUrl ( 'admin' , '/ db') , 'test_col' ) ;
25+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col') ) . click ( ) ;
26+ cy . addCollection ( mkApiPathUrl ( 'admin' , '/ db/test_col') , 'col1' ) ;
27+ cy . addCollection ( mkApiPathUrl ( 'admin' , '/ db/test_col') , 'col2' ) ;
28+ cy . addCollection ( mkApiPathUrl ( 'admin' , '/ db/test_col') , 'col3' ) ;
2829 } )
2930 it ( 'create text document' , function ( ) {
30- cy . addDocument ( 'admin@http://localhost:8080/ db/test_col' , 'text_file.txt' ) ;
31+ cy . addDocument ( mkApiPathUrl ( 'admin' , '/ db/test_col') , 'text_file.txt' ) ;
3132 } )
3233 } )
3334 describe ( 'Drag and drop' , function ( ) {
3435 it ( 'drag move document' , function ( ) {
3536 cy . waitForLoading ( ) ;
36- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/text_file.txt' ) . should ( 'be.visible' )
37- . drag ( treenode ( 'admin@http://localhost:8080/ db/test_col/col1' ) ) ;
37+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/text_file.txt') ) . should ( 'be.visible' )
38+ . drag ( treenode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1') ) ) ;
3839 cy . waitForLoading ( ) ;
39- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/text_file.txt' ) . should ( 'not.exist' ) ;
40- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1/text_file.txt' ) . should ( 'be.visible' ) ;
40+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/text_file.txt') ) . should ( 'not.exist' ) ;
41+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1/text_file.txt') ) . should ( 'be.visible' ) ;
4142 } )
4243 it ( 'drag copy document' , function ( ) {
4344 cy . waitForLoading ( ) ;
44- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1/text_file.txt' )
45- . drag ( treenode ( 'admin@http://localhost:8080/ db/test_col/col2' ) , { ctrlKey : true } ) ;
45+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1/text_file.txt') )
46+ . drag ( treenode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2') ) , { ctrlKey : true } ) ;
4647 cy . waitForLoading ( ) ;
47- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1/text_file.txt' ) . should ( 'be.visible' ) ;
48- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/text_file.txt' ) . should ( 'be.visible' ) ;
48+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1/text_file.txt') ) . should ( 'be.visible' ) ;
49+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/text_file.txt') ) . should ( 'be.visible' ) ;
4950 } )
5051 it ( 'drag copy collection' , function ( ) {
5152 cy . waitForLoading ( ) ;
52- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1' ) . should ( 'be.visible' )
53- . drag ( treenode ( 'admin@http://localhost:8080/ db/test_col/col2' ) , { ctrlKey : true } ) ;
53+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1') ) . should ( 'be.visible' )
54+ . drag ( treenode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2') ) , { ctrlKey : true } ) ;
5455 cy . waitForLoading ( ) ;
55- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1' ) . should ( 'be.visible' ) ;
56- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/col1' ) . should ( 'be.visible' ) . click ( ) ;
56+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1') ) . should ( 'be.visible' ) ;
57+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/col1') ) . should ( 'be.visible' ) . click ( ) ;
5758 cy . waitForLoading ( ) ;
58- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/col1/text_file.txt' ) . should ( 'be.visible' ) ;
59+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/col1/text_file.txt') ) . should ( 'be.visible' ) ;
5960 } )
6061 it ( 'drag move collection' , function ( ) {
6162 cy . waitForLoading ( ) ;
62- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1' ) . should ( 'be.visible' )
63- . drag ( treenode ( 'admin@http://localhost:8080/ db/test_col/col3' ) ) ;
63+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1') ) . should ( 'be.visible' )
64+ . drag ( treenode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col3') ) ) ;
6465 cy . waitForLoading ( ) ;
65- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col3/col1' ) . should ( 'be.visible' ) ;
66- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col1' ) . should ( 'not.exist' ) ;
66+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col3/col1') ) . should ( 'be.visible' ) ;
67+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col1') ) . should ( 'not.exist' ) ;
6768 } )
6869 } )
6970 describe ( 'Renaming' , function ( ) {
7071 it ( 'rename a document' , function ( ) {
7172 cy . waitForLoading ( ) ;
72- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/text_file.txt' ) . should ( 'be.visible' ) . rightclick ( ) ;
73+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/text_file.txt') ) . should ( 'be.visible' ) . rightclick ( ) ;
7374 cy . getMenuCommand ( 'fusion.rename' ) . should ( 'be.visible' ) . click ( )
7475 cy . get ( '.fs-inline-input' ) . should ( 'exist' ) . find ( 'input.theia-input[type=text]' ) . should ( 'contain.value' , 'text_file.txt' ) . clear ( ) . type ( 'new_name.txt{enter}' ) ;
7576 cy . waitForLoading ( ) ;
76- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/text_file.txt' ) . should ( 'not.exist' ) ;
77- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/new_name.txt' ) . should ( 'be.visible' ) ;
77+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/text_file.txt') ) . should ( 'not.exist' ) ;
78+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/new_name.txt') ) . should ( 'be.visible' ) ;
7879 } )
7980 it ( 'rename a collection' , function ( ) {
8081 cy . waitForLoading ( ) ;
81- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/col1' ) . should ( 'be.visible' ) . rightclick ( ) ;
82+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/col1') ) . should ( 'be.visible' ) . rightclick ( ) ;
8283 cy . getMenuCommand ( 'fusion.rename' ) . should ( 'be.visible' ) . click ( )
8384 cy . get ( '.fs-inline-input' ) . should ( 'exist' ) . find ( 'input.theia-input[type=text]' ) . should ( 'contain.value' , 'col1' ) . clear ( ) . type ( 'other_col1{enter}' ) ;
8485 cy . waitForLoading ( ) ;
85- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/col1' ) . should ( 'not.exist' ) ;
86- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/other_col1' ) . should ( 'be.visible' ) ;
86+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/col1') ) . should ( 'not.exist' ) ;
87+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/other_col1') ) . should ( 'be.visible' ) ;
8788 } )
8889 } )
8990 describe ( 'Deleting' , function ( ) {
9091 it ( 'delete a document' , function ( ) {
9192 cy . waitForLoading ( ) ;
92- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/new_name.txt' ) . should ( 'be.visible' ) . rightclick ( ) ;
93+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/new_name.txt') ) . should ( 'be.visible' ) . rightclick ( ) ;
9394 cy . getMenuCommand ( 'fusion.delete' ) . should ( 'be.visible' ) . click ( )
9495 cy . get ( dialogTitle ) . should ( 'contain.text' , 'Delete document' ) ;
9596 cy . get ( dialogBody ) . should ( 'be.visible' ) . find ( 'p' ) . should ( 'contain.text' , 'Are you sure you want to delete the document: new_name.txt?' ) ;
9697 cy . get ( dialogMainButton ) . should ( 'be.visible' ) . click ( ) ;
9798 cy . get ( dialog ) . should ( 'not.exist' ) ;
9899 cy . waitForLoading ( ) ;
99- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2/new_name.txt' ) . should ( 'not.exist' ) ;
100+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2/new_name.txt') ) . should ( 'not.exist' ) ;
100101 } )
101102 it ( 'delete multiple objects' , function ( ) {
102103 cy . waitForLoading ( ) ;
103- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2' ) . should ( 'be.visible' ) . click ( ) ;
104+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2') ) . should ( 'be.visible' ) . click ( ) ;
104105 cy . get ( 'body' ) . type ( '{ctrl}' , { release : false } )
105- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col3' ) . should ( 'be.visible' ) . click ( ) ;
106+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col3') ) . should ( 'be.visible' ) . click ( ) ;
106107 cy . get ( 'body' ) . type ( '{ctrl}' )
107- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2' ) . should ( 'be.visible' ) . rightclick ( ) ;
108+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2') ) . should ( 'be.visible' ) . rightclick ( ) ;
108109 cy . getMenuCommand ( 'fusion.delete' ) . should ( 'be.visible' ) . click ( )
109110 cy . get ( dialogTitle ) . should ( 'contain.text' , 'Delete items' ) ;
110111 cy . get ( dialogBody ) . should ( 'be.visible' ) . find ( 'p' )
@@ -114,19 +115,19 @@ context('Fusion Studio', function () {
114115 cy . get ( dialogMainButton ) . should ( 'be.visible' ) . click ( ) ;
115116 cy . get ( dialog ) . should ( 'not.exist' ) ;
116117 cy . waitForLoading ( ) ;
117- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col2' ) . should ( 'not.exist' ) ;
118- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col/col3' ) . should ( 'not.exist' ) ;
118+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col2') ) . should ( 'not.exist' ) ;
119+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col/col3') ) . should ( 'not.exist' ) ;
119120 } )
120121 it ( 'delete a collection' , function ( ) {
121122 cy . waitForLoading ( ) ;
122- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col' ) . should ( 'be.visible' ) . rightclick ( ) ;
123+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col') ) . should ( 'be.visible' ) . rightclick ( ) ;
123124 cy . getMenuCommand ( 'fusion.delete' ) . should ( 'be.visible' ) . click ( )
124125 cy . get ( dialogTitle ) . should ( 'contain.text' , 'Delete collection' ) ;
125126 cy . get ( dialogBody ) . should ( 'be.visible' ) . find ( 'p' ) . should ( 'contain.text' , 'Are you sure you want to delete the collection: test_col?' ) ;
126127 cy . get ( dialogMainButton ) . should ( 'be.visible' ) . click ( ) ;
127128 cy . get ( dialog ) . should ( 'not.exist' ) ;
128129 cy . waitForLoading ( ) ;
129- cy . getTreeNode ( 'admin@http://localhost:8080/ db/test_col' ) . should ( 'not.exist' ) ;
130+ cy . getTreeNode ( mkApiPathUrl ( 'admin' , '/ db/test_col') ) . should ( 'not.exist' ) ;
130131 } )
131132 } )
132133} )
0 commit comments