Skip to content

Commit db0e5e7

Browse files
committed
updated cypress tests
1 parent 12c06ee commit db0e5e7

File tree

8 files changed

+30
-52
lines changed

8 files changed

+30
-52
lines changed

cypress/integration/api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ context('Fusion Studio', function () {
2222
},
2323
}).get('#theia-top-panel', {timeout: 30000})
2424
.should('be.visible')
25-
.get('.theia-preload').should('not.be.visible');
25+
.get('.theia-preload').should('not.exist');
2626
cy.addConnection();
2727
cy.getTreeNode('admin@http://localhost:8080/db').should('exist');
2828
})
@@ -45,14 +45,14 @@ context('Fusion Studio', function () {
4545
},
4646
}).get('#theia-top-panel', {timeout: 30000})
4747
.should('be.visible')
48-
.get('.theia-preload').should('not.be.visible');
48+
.get('.theia-preload').should('not.exist');
4949
cy.addConnection();
5050
cy.get(dialogTitle).should('contain.text', 'New Connection');
5151
cy.get(dialogBody).should('be.visible')
5252
.should('contain.text', 'Outdated API "0.0.1"')
5353
.should('contain.text', 'You need to update your API to version "0.2.0" or higher');
5454
cy.get(dialogMainButton).should('be.visible').click();
55-
cy.get(dialog).should('not.be.visible');
55+
cy.get(dialog).should('not.exist');
5656
})
5757
})
5858
})

cypress/integration/eval_panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ context('Fusion Studio', function() {
44
cy.visit('http://localhost:3000')
55
.get('#theia-top-panel', {timeout: 30000})
66
.should('be.visible')
7-
.get('.theia-preload').should('not.be.visible');
7+
.get('.theia-preload').should('not.exist');
88
})
99

1010
describe('Evaluation panel', function() {

cypress/integration/operations_spec.js

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ context('Fusion Studio', function () {
1212
cy.visit('http://localhost:3000')
1313
.get('#theia-top-panel', { timeout: 30000 })
1414
.should('be.visible')
15-
.get('.theia-preload').should('not.be.visible');
15+
.get('.theia-preload').should('not.exist');
1616
cy.addConnection();
1717
cy.get('.fusion-item').should('have.length', 5).its('length').then(count => {
1818
cy.getTreeNode('admin@http://localhost:8080/db').click();
@@ -27,21 +27,7 @@ context('Fusion Studio', function () {
2727
cy.addCollection('admin@http://localhost:8080/db/test_col', 'col3');
2828
})
2929
it('create text document', function () {
30-
cy.waitForLoading();
31-
cy.getTreeNode('admin@http://localhost:8080/db/test_col').rightclick()
32-
cy.getSubMenu('New document...').should('be.visible').trigger('mousemove')
33-
cy.getMenuCommand('fusion.new-document').should('be.visible').click()
34-
cy.get(dialogTitle).should('contain.text', 'New document');
35-
cy.get(dialogBody).should('be.visible').find('input.theia-input[type=text]').should('contain.value', 'untitled').type('text_file.txt');
36-
cy.get(dialogMainButton).should('be.visible').click();
37-
cy.get(dialog).should('not.be.visible');
38-
cy.getTreeNode('admin@http://localhost:8080/db/test_col/text_file.txt').should('be.visible');
39-
cy.get('.p-Widget.p-TabBar li[title=' + CSS.escape('admin@http://localhost:8080/db/test_col/text_file.txt') + ']')
40-
.should('be.visible').click()
41-
.should('have.class', 'p-mod-current');
42-
cy.get('[role=presentation].editor-scrollable').click().type('Sample text file content');
43-
cy.get('#theia-top-panel .p-MenuBar-item').contains('File').click()
44-
cy.get('.p-Menu-item[data-type=command][data-command=core\\.save]').click()
30+
cy.addDocument('admin@http://localhost:8080/db/test_col', 'text_file.txt');
4531
})
4632
})
4733
describe('Drag and drop', function () {
@@ -85,24 +71,18 @@ context('Fusion Studio', function () {
8571
cy.waitForLoading();
8672
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/text_file.txt').should('be.visible').rightclick();
8773
cy.getMenuCommand('fusion.rename').should('be.visible').click()
88-
cy.get(dialogTitle).should('contain.text', 'Rename document');
89-
cy.get(dialogBody).should('be.visible').find('input.theia-input[type=text]').should('contain.value', 'text_file.txt').type('new_name.txt');
90-
cy.get(dialogMainButton).should('be.visible').click();
91-
cy.get(dialog).should('not.be.visible');
74+
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}');
9275
cy.waitForLoading();
93-
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/text_file.txt').should('not.be.visible');
76+
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/text_file.txt').should('not.exist');
9477
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/new_name.txt').should('be.visible');
9578
})
9679
it('rename a collection', function () {
9780
cy.waitForLoading();
9881
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/col1').should('be.visible').rightclick();
9982
cy.getMenuCommand('fusion.rename').should('be.visible').click()
100-
cy.get(dialogTitle).should('contain.text', 'Rename collection');
101-
cy.get(dialogBody).should('be.visible').find('input.theia-input[type=text]').should('contain.value', 'col1').type('other_col1');
102-
cy.get(dialogMainButton).should('be.visible').click();
103-
cy.get(dialog).should('not.be.visible');
83+
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'col1').clear().type('other_col1{enter}');
10484
cy.waitForLoading();
105-
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/col1').should('not.be.visible');
85+
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/col1').should('not.exist');
10686
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/other_col1').should('be.visible');
10787
})
10888
})
@@ -114,7 +94,7 @@ context('Fusion Studio', function () {
11494
cy.get(dialogTitle).should('contain.text', 'Delete document');
11595
cy.get(dialogBody).should('be.visible').find('p').should('contain.text', 'Are you sure you want to delete the document: new_name.txt?');
11696
cy.get(dialogMainButton).should('be.visible').click();
117-
cy.get(dialog).should('not.be.visible');
97+
cy.get(dialog).should('not.exist');
11898
cy.waitForLoading();
11999
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2/new_name.txt').should('not.exist');
120100
})
@@ -132,7 +112,7 @@ context('Fusion Studio', function () {
132112
.should('contain.text', 'col2')
133113
.should('contain.text', 'col3');
134114
cy.get(dialogMainButton).should('be.visible').click();
135-
cy.get(dialog).should('not.be.visible');
115+
cy.get(dialog).should('not.exist');
136116
cy.waitForLoading();
137117
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col2').should('not.exist');
138118
cy.getTreeNode('admin@http://localhost:8080/db/test_col/col3').should('not.exist');
@@ -144,7 +124,7 @@ context('Fusion Studio', function () {
144124
cy.get(dialogTitle).should('contain.text', 'Delete collection');
145125
cy.get(dialogBody).should('be.visible').find('p').should('contain.text', 'Are you sure you want to delete the collection: test_col?');
146126
cy.get(dialogMainButton).should('be.visible').click();
147-
cy.get(dialog).should('not.be.visible');
127+
cy.get(dialog).should('not.exist');
148128
cy.waitForLoading();
149129
cy.getTreeNode('admin@http://localhost:8080/db/test_col').should('not.exist');
150130
})

cypress/integration/properties.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ context('Properties dialog', function () {
1717
cy.visit('http://localhost:3000')
1818
.get('#theia-top-panel', { timeout: 30000 })
1919
.should('be.visible')
20-
.get('.theia-preload').should('not.be.visible');
20+
.get('.theia-preload').should('not.exist');
2121
cy.addConnection();
2222
cy.waitForLoading();
2323
cy.getTreeNode('admin@http://localhost:8080/db').click();
@@ -78,14 +78,14 @@ context('Properties dialog', function () {
7878
});
7979
});
8080
cy.get(dialogSecondaryButton).should('be.visible').click();
81-
cy.get(dialog).should('not.be.visible');
81+
cy.get(dialog).should('not.exist');
8282
cy.getTreeNode('admin@http://localhost:8080/db/test_col/xml_file.xml').rightclick()
8383
.getMenuCommand('fusion.properties').should('be.visible').click()
8484
cy.get(dialogBody).should('be.visible').find('td.label').contains('Binary')
8585
.find('+ td.value').should('contain.text', 'No')
8686
.find('button.theia-button').should('contain.text', 'Convert to binary');
8787
cy.get(dialogSecondaryButton).should('be.visible').click();
88-
cy.get(dialog).should('not.be.visible');
88+
cy.get(dialog).should('not.exist');
8989
})
9090
it('Collection properties', function () {
9191
cy.waitForLoading();
@@ -127,12 +127,12 @@ context('Properties dialog', function () {
127127
});
128128
});
129129
cy.get(dialogSecondaryButton).should('be.visible').click();
130-
cy.get(dialog).should('not.be.visible');
130+
cy.get(dialog).should('not.exist');
131131
cy.getTreeNode('admin@http://localhost:8080/db').rightclick()
132132
.getMenuCommand('fusion.properties').should('be.visible').click()
133133
cy.get(dialogBody).should('be.visible').find('td.label').should('not.contain.text', 'Collection');
134134
cy.get(dialogSecondaryButton).should('be.visible').click();
135-
cy.get(dialog).should('not.be.visible');
135+
cy.get(dialog).should('not.exist');
136136
});
137137
})
138138
})
@@ -146,7 +146,7 @@ context('Properties dialog', function () {
146146
.find('td.label').contains('Name')
147147
.find('+ td.value input.theia-input[type=text]').should('contain.value', 'text_file.txt').type('new_name.txt');
148148
cy.get(dialogMainButton).should('be.visible').click();
149-
cy.get(dialog).should('not.be.visible');
149+
cy.get(dialog).should('not.exist');
150150
cy.waitForLoading();
151151
cy.getTreeNode('admin@http://localhost:8080/db/test_col/text_file.txt').should('not.exist');
152152
cy.getTreeNode('admin@http://localhost:8080/db/test_col/new_name.txt').should('be.visible');
@@ -160,7 +160,7 @@ context('Properties dialog', function () {
160160
.find('td.label').contains('Name')
161161
.find('+ td.value input.theia-input[type=text]').should('contain.value', 'test_col').type('new_test_col');
162162
cy.get(dialogMainButton).should('be.visible').click();
163-
cy.get(dialog).should('not.be.visible');
163+
cy.get(dialog).should('not.exist');
164164
cy.waitForLoading();
165165
cy.getTreeNode('admin@http://localhost:8080/db/test_col').should('not.exist');
166166
cy.getTreeNode('admin@http://localhost:8080/db/new_test_col').should('be.visible');

cypress/integration/tree_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ context('Fusion Studio', function() {
55
cy.visit('http://localhost:3000')
66
.get('#theia-top-panel', {timeout: 30000})
77
.should('be.visible')
8-
.get('.theia-preload').should('not.be.visible');
8+
.get('.theia-preload').should('not.exist');
99
})
1010
it('create a new connection', function(){
1111
// trigger new connection dialog
@@ -69,7 +69,7 @@ context('Fusion Studio', function() {
6969
cy.visit('http://localhost:3000')
7070
.get('#theia-top-panel', {timeout: 30000})
7171
.should('be.visible')
72-
.get('.theia-preload').should('not.be.visible');
72+
.get('.theia-preload').should('not.exist');
7373
cy.get(':nth-child(1) > .p-MenuBar-itemLabel')
7474
.click()
7575
.then(() => {

cypress/support/utils.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,17 @@ Cypress.Commands.add('addConnection', (name = 'localhost', server = 'http://loca
5656
Cypress.Commands.add('addCollection', (id, name) => {
5757
cy.waitForLoading();
5858
cy.getTreeNode(id).rightclick()
59-
cy.getMenuCommand('fusion.new-collection').should('be.visible').click()
60-
cy.get(dialogTitle).should('contain.text', 'New collection');
61-
cy.get(dialogBody).should('be.visible').find('input.theia-input[type=text]').should('contain.value', 'untitled').type(name);
62-
cy.get(dialogMainButton).should('be.visible').click();
63-
cy.get(dialog).should('not.be.visible');
59+
cy.getMenuCommand('fusion.new-collection').should('be.visible').click();
60+
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'untitled').type(name + '{enter}').should('not.exist');
61+
cy.waitForLoading();
6462
cy.getTreeNode(id + '/' + name).should('be.visible');
6563
});
6664
Cypress.Commands.add('addDocument', (collection, name, type = '') => {
6765
cy.waitForLoading();
6866
const command = 'fusion.new-document' + (type ? '-template:' + type : '');
6967
cy.getTreeNode(collection).rightclick()
70-
cy.getSubMenu('New document...').trigger('mousemove').getMenuCommand(command).should('be.visible').click()
71-
cy.get(dialogBody).find('input.theia-input[type=text]').clear().type(name);
72-
cy.get(dialogMainButton).click();
68+
cy.getSubMenu('New document...').trigger('mousemove').getMenuCommand(command).should('be.visible').click();
69+
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'untitled').clear().type(name + '{enter}');
7370
if (type === '') {
7471
cy.get('.p-Widget.p-TabBar li[title=' + CSS.escape(collection + '/' + name) + ']').click();
7572
cy.get('[role=presentation].editor-scrollable').click().type('Sample text file content');

fusion-studio-extension/src/browser/dialogs/new-from-template-dialog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { injectable, inject } from "inversify";
2-
import { DialogProps, AbstractDialog, DialogMode, DialogError, Message } from "@theia/core/lib/browser";
2+
import { DialogProps, AbstractDialog, Message } from "@theia/core/lib/browser";
33
import { FSTemplate } from "../../classes/template";
4-
import { IDialogField, IDialogFields, createField } from "../../classes/dialog-field";
4+
import { IDialogFields, createField } from "../../classes/dialog-field";
55

66
@injectable()
77
export class FSNewFromTemplateDialogProps extends DialogProps {

fusion-studio-extension/src/browser/widget/main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class FSViewWidget extends TreeWidget {
158158
>{errorMessage}</div>
159159
<input
160160
ref={input}
161+
type="text"
161162
className="theia-input"
162163
value={value}
163164
onChange={e => setValue(e.target.value)}

0 commit comments

Comments
 (0)