Skip to content

Commit 2110a85

Browse files
committed
refactor(collection_spec): split ops into docs and collections
add TODOs to old specs scaffold more specs see #413 #398 #378
1 parent 1491513 commit 2110a85

File tree

8 files changed

+166
-100
lines changed

8 files changed

+166
-100
lines changed

cypress/integration/01_connection_spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,27 @@ context('Connecting to Servers', () => {
6161
})
6262
})
6363

64+
65+
// TODO(DP): add Connection properties test here
66+
// it('Connection properties', function () {
67+
// cy.waitForLoading();
68+
// cy.getTreeNode(mkApiPathUrl('admin')).rightclick()
69+
// .getMenuCommand('fusion.properties').should('be.visible').click()
70+
// cy.get(dialogTitle).should('contain.text', 'Edit Connection');
71+
// cy.get(dialogBody).should('be.visible').then(body => {
72+
// cy.wrap(body).find('.vertical-form .name-field span').contains('Connection Name:')
73+
// .find('+ input.theia-input[type=text]').should('have.value', 'localhost');
74+
// cy.wrap(body).find('.vertical-form .server-field span').contains('Server URI:')
75+
// .find('+ input.theia-input[type=text]').should('have.value', apiHost + apiPort);
76+
// cy.wrap(body).find('.vertical-form .username-field span').contains('Username:')
77+
// .find('+ input.theia-input[type=text]').should('have.value', 'admin');
78+
// cy.wrap(body).find('.vertical-form .password-field span').contains('Password')
79+
// .find('+ input.theia-input[type=password]').should('have.value', '');
80+
// cy.get(dialogSecondaryButton).should('be.visible').click();
81+
// cy.get(dialog).should('not.exist');
82+
// });
83+
// })
84+
6485
it('should remove bad connection', () => {
6586
cy.get(`[node-id=${CSS.escape('badmin@' + Cypress.env('API_HOST'))}]`)
6687
.rightclick()

cypress/integration/02_api-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
context('Talking to the api directly', () => {
44
describe('API version', () => {
5-
it('should connect with newer api', () => {
5+
it.skip('should connect with newer api', () => {
66
cy.visit('/')
77
// TODO: Why does this have UUID is the ID stable, this needs a meaningful selector
88
.get('#d184cace-9938-4ad5-b8df-925a91942661')
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/// <reference types="Cypress" />
2+
context('Basic Operations', () => {
3+
describe('working with tree view', () => {
4+
before(() => {
5+
cy.connect()
6+
})
7+
8+
describe('db context menu', () => {
9+
it('should display creation options', () => {
10+
cy.visit('/')
11+
cy.get('.ReactVirtualized__Grid', {timeout: 55000})
12+
.should('be.visible')
13+
cy.get('.fusion-item')
14+
.click()
15+
// all we need is the final part of the node-id attribute
16+
cy.get('[node-id$=db]')
17+
.rightclick()
18+
.then(() => {
19+
cy.get('.p-Menu')
20+
.should('be.visible')
21+
.contains('New document')
22+
.trigger('mousemove')
23+
cy.get('[data-command="fusion.new-document"] > .p-Menu-itemLabel')
24+
.should('be.visible')
25+
.click()
26+
})
27+
// TODO(DP): start workaround for #413
28+
cy.get('[node-id$=db]')
29+
.trigger('mousemove')
30+
.type('{enter}')
31+
// end workaround for #413
32+
cy.get('.ReactVirtualized__Grid')
33+
.contains('untitled-1')
34+
35+
// TODO(DP):
36+
// - add test for #413,
37+
// - check if tree view is deselected,
38+
// - check if Explorer is updated properly,
39+
// - check if editor window is opening the newly create doc in a new tab
40+
// - two routes one with follow-up dialog (xquery lib) one without (txt, xml)
41+
})
42+
43+
// Get rid of this:
44+
// cy.addDocument(mkApiPathUrl('admin', '/db/test_col'), 'text_file.txt');
45+
46+
// TODO(DP): make this work on all OS by either adjusting the key sequence ctrl+s cmd+s …
47+
// or by cicking through the file menu instead
48+
// see #414
49+
it('should let us edit the file', () => {
50+
cy.get('[node-id$=untitled-1]')
51+
.dblclick()
52+
cy.get('.view-line')
53+
.type('asdf{meta+s}')
54+
})
55+
// see #414 workaround is to run this after editing and saving the document,
56+
// we should be able to rename before entering content
57+
it('should let users rename documents', () => {
58+
cy.get('[node-id$=untitled-1]')
59+
.rightclick()
60+
cy.get('[data-command="fusion.rename"] > .p-Menu-itemLabel')
61+
.should('be.visible')
62+
.click()
63+
.focused()
64+
.type('test.txt{enter}')
65+
})
66+
67+
// TODO(DP): file properties test could go here
68+
69+
// TODO(DP): only allow unique file creation test should go here
70+
71+
it('should let users delete documents', () => {
72+
cy.get('[node-id$=test\\.txt]')
73+
.rightclick()
74+
cy.get('[data-command="fusion.delete"] > .p-Menu-itemLabel')
75+
.should('be.visible')
76+
.click()
77+
cy.get('.main')
78+
.click()
79+
cy.get('[node-id$=test\\.txt]')
80+
.should('not.exist')
81+
})
82+
})
83+
})
84+
})

cypress/integration/04_operations_spec.js

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference types="Cypress" />
2+
3+
context('Talking to the api directly', () => {
4+
describe('API version', () => {
5+
it.skip('should connect with newer api', () => {
6+
cy.visit('/')
7+
// TODO: Why does this have UUID is the ID stable, this needs a meaningful selector
8+
.get('#d184cace-9938-4ad5-b8df-925a91942661')
9+
.should('be.visible')
10+
})
11+
12+
})
13+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference types="Cypress" />
2+
3+
context('Talking to the api directly', () => {
4+
describe('API version', () => {
5+
it.skip('should connect with newer api', () => {
6+
cy.visit('/')
7+
// TODO: Why does this have UUID is the ID stable, this needs a meaningful selector
8+
.get('#d184cace-9938-4ad5-b8df-925a91942661')
9+
.should('be.visible')
10+
})
11+
12+
})
13+
})

cypress/integration/operations_spec.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ context('Fusion Studio', function () {
8989
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/col1')).should('not.exist');
9090
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/other_col1')).should('be.visible');
9191
})
92+
// TODO(DP): add to connection_spec
9293
it('rename a connection', function () {
9394
cy.waitForLoading();
9495
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').rightclick();
@@ -140,19 +141,19 @@ context('Fusion Studio', function () {
140141
cy.waitForLoading();
141142
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col')).should('not.exist');
142143
})
143-
it('delete a connection', function () {
144-
cy.waitForLoading();
145-
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').rightclick();
146-
cy.getMenuCommand('fusion.disconnect').should('be.visible').click()
147-
cy.get(dialogTitle).should('contain.text', 'Remove Connection');
148-
cy.get(dialogBody).should('be.visible').find('p')
149-
.should('contain.text', 'Are you sure you want to remove the connection: new_name?')
150-
.should('contain.text', `Server URI: ${apiHost}${apiPort}`)
151-
.should('contain.text', 'Username: admin');
152-
cy.get(dialogMainButton).should('be.visible').click();
153-
cy.get(dialog).should('not.exist');
154-
cy.waitForLoading();
155-
cy.getTreeNode(mkApiPathUrl('admin')).should('not.exist');
144+
// it('delete a connection', function () {
145+
// cy.waitForLoading();
146+
// cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').rightclick();
147+
// cy.getMenuCommand('fusion.disconnect').should('be.visible').click()
148+
// cy.get(dialogTitle).should('contain.text', 'Remove Connection');
149+
// cy.get(dialogBody).should('be.visible').find('p')
150+
// .should('contain.text', 'Are you sure you want to remove the connection: new_name?')
151+
// .should('contain.text', `Server URI: ${apiHost}${apiPort}`)
152+
// .should('contain.text', 'Username: admin');
153+
// cy.get(dialogMainButton).should('be.visible').click();
154+
// cy.get(dialog).should('not.exist');
155+
// cy.waitForLoading();
156+
// cy.getTreeNode(mkApiPathUrl('admin')).should('not.exist');
156157
})
157158
})
158159
})

cypress/integration/properties.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ context('Properties dialog', function () {
3333
cy.addDocument(mkApiPathUrl('admin', '/db/test_col'), 'xml_file.xml', 'xml')
3434
})
3535
describe('Correct information', function () {
36+
// TODO(DP): decide what to do with this add to operations_spec
37+
// switch to bevaior testing, sumary testing every single box that is visible
3638
it('Document properties', function () {
3739
cy.waitForLoading();
3840
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/text_file.txt')).rightclick()
@@ -140,24 +142,24 @@ context('Properties dialog', function () {
140142
cy.get(dialog).should('not.exist');
141143
});
142144
})
143-
it('Connection properties', function () {
144-
cy.waitForLoading();
145-
cy.getTreeNode(mkApiPathUrl('admin')).rightclick()
146-
.getMenuCommand('fusion.properties').should('be.visible').click()
147-
cy.get(dialogTitle).should('contain.text', 'Edit Connection');
148-
cy.get(dialogBody).should('be.visible').then(body => {
149-
cy.wrap(body).find('.vertical-form .name-field span').contains('Connection Name:')
150-
.find('+ input.theia-input[type=text]').should('have.value', 'localhost');
151-
cy.wrap(body).find('.vertical-form .server-field span').contains('Server URI:')
152-
.find('+ input.theia-input[type=text]').should('have.value', apiHost + apiPort);
153-
cy.wrap(body).find('.vertical-form .username-field span').contains('Username:')
154-
.find('+ input.theia-input[type=text]').should('have.value', 'admin');
155-
cy.wrap(body).find('.vertical-form .password-field span').contains('Password')
156-
.find('+ input.theia-input[type=password]').should('have.value', '');
157-
cy.get(dialogSecondaryButton).should('be.visible').click();
158-
cy.get(dialog).should('not.exist');
159-
});
160-
})
145+
// it('Connection properties', function () {
146+
// cy.waitForLoading();
147+
// cy.getTreeNode(mkApiPathUrl('admin')).rightclick()
148+
// .getMenuCommand('fusion.properties').should('be.visible').click()
149+
// cy.get(dialogTitle).should('contain.text', 'Edit Connection');
150+
// cy.get(dialogBody).should('be.visible').then(body => {
151+
// cy.wrap(body).find('.vertical-form .name-field span').contains('Connection Name:')
152+
// .find('+ input.theia-input[type=text]').should('have.value', 'localhost');
153+
// cy.wrap(body).find('.vertical-form .server-field span').contains('Server URI:')
154+
// .find('+ input.theia-input[type=text]').should('have.value', apiHost + apiPort);
155+
// cy.wrap(body).find('.vertical-form .username-field span').contains('Username:')
156+
// .find('+ input.theia-input[type=text]').should('have.value', 'admin');
157+
// cy.wrap(body).find('.vertical-form .password-field span').contains('Password')
158+
// .find('+ input.theia-input[type=password]').should('have.value', '');
159+
// cy.get(dialogSecondaryButton).should('be.visible').click();
160+
// cy.get(dialog).should('not.exist');
161+
// });
162+
// })
161163
})
162164
describe('Renaming objects', function () {
163165
it('Rename a connection', function () {

0 commit comments

Comments
 (0)