Skip to content

Commit 8e9272e

Browse files
authored
Merge pull request #427 from duncdrum/e2e-rewrite-3
I'll rebase my code on this
2 parents 5aafe5d + c89301f commit 8e9272e

File tree

13 files changed

+630
-446
lines changed

13 files changed

+630
-446
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
command: |
6767
pwd
6868
sleep 15
69-
npx cypress run --config defaultCommandTimeout=45000
69+
npx cypress run --config defaultCommandTimeout=55000
7070
no_output_timeout: 2m
7171
workflows:
7272
browser_build:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ sudo yum install -y rpm-build
7777
```
7878
7979
#### For Testing
80-
* [cypress.js](https://www.cypress.io) ` >= 4.1.0`.
80+
* [cypress.js](https://www.cypress.io) ` >= 7.4.0`.
8181
8282
8383

cypress/integration/01_connection_spec.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/// <reference types="Cypress" />
22
context('Connecting to Servers', () => {
3-
describe('Connection Dialogue', () => {
3+
describe('New Connection Dialogue', () => {
44
after(() => {
55
// cleanup connections after test
66
cy.clearLocalStorage('connections')
7-
cy.reload()
7+
cy.reload()
88
})
99

1010
it('should create a connection', () => {
@@ -57,46 +57,49 @@ context('Connecting to Servers', () => {
5757
cy.get('.dialogContent')
5858
// TODO(DP): #408 this needs a meaningful error message
5959
.contains('error')
60-
cy.get('.dialogControl > .theia-button').click()
60+
cy.get('.dialogControl > .theia-button').click()
6161
})
6262
})
6363

6464

65-
// TODO(DP): add Connection properties tests here (rename and contencheck)
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-
8565
it('should remove bad connection', () => {
8666
cy.get(`[node-id=${CSS.escape('badmin@' + Cypress.env('API_HOST'))}]`)
8767
.rightclick()
8868
.then(() => {
8969
cy.get('[data-command="fusion.disconnect"] > .p-Menu-itemLabel')
9070
.click()
9171
cy.get('.dialogContent')
92-
.contains('you sure')
72+
.contains('you sure')
9373
cy.get('.main').click()
9474
})
9575
cy.get('.ReactVirtualized__Grid')
9676
.should('be.visible')
97-
.should('not.contain', 'server2')
77+
.should('not.contain', 'server2')
9878
})
99-
})
10079

80+
describe('Connection Propertes Dialog', () => {
81+
// TODO(DP): add Connection properties tests here (rename and contencheck)
82+
it('should have working properties dialog', () => {
83+
cy.get(`[node-id=${CSS.escape('admin@' + Cypress.env('API_HOST'))}]`)
84+
.rightclick()
85+
.type('{alt+enter}', { force: true })
86+
cy.get('.dialogTitle')
87+
.should('contain.text', 'Edit Connection')
88+
cy.get('.dialogContent')
89+
.find('.theia-input')
90+
.should('have.length', 4)
91+
cy.get('.name-field > .theia-input')
92+
.should('have.value', 'server1')
93+
.clear()
94+
.type('local1')
95+
cy.get('.main')
96+
.should('be.visible')
97+
.click()
98+
cy.get(`[node-id=${CSS.escape('admin@' + Cypress.env('API_HOST'))}]`)
99+
.contains('local1')
100+
})
101+
})
102+
103+
})
101104

102105
})
Lines changed: 127 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,135 @@
11
/// <reference types="Cypress" />
2-
context('Basic Operations', () => {
3-
describe('working with tree view', () => {
4-
before(() => {
5-
cy.connect()
6-
})
72

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-
// (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')
3+
context('Document Operations', () => {
4+
describe('working with tree view', () => {
5+
before(() => {
6+
cy.connect()
7+
// TODO(DP): might have to improve by adding more before / after hooks to prevent dangling documents
8+
// see #400
9+
})
10+
11+
describe('db context menu', () => {
12+
it('should display creation options', () => {
13+
cy.visit('/')
14+
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
15+
.should('be.visible')
16+
cy.get('.fusion-item')
17+
.click()
18+
// all we need is the final part of the node-id attribute
19+
cy.get('[node-id$=db]')
20+
.rightclick()
21+
.then(() => {
22+
cy.get('.p-Menu')
23+
.should('be.visible')
24+
.contains('New document')
25+
.trigger('mousemove')
26+
cy.get('[data-command="fusion.new-document"] > .p-Menu-itemLabel')
27+
.should('be.visible')
28+
.click()
29+
})
30+
// (DP): start workaround for #413
31+
cy.get('[node-id$=db]')
32+
.trigger('mousemove')
33+
.type('{enter}')
34+
// end workaround for #413
35+
cy.get('.ReactVirtualized__Grid')
36+
.contains('untitled-1')
37+
38+
// TODO(DP):
39+
// - add test for #413 : change order, remove workaround, might need a call to focused()
40+
// - check if tree view is deselected (it is but need not be),
41+
// - check if Explorer is updated properly (seems inconsistent need to double click)
42+
// - check if editor window is opening the newly create doc in a new tab (it doesn't)
43+
// - two file create routes one with follow-up dialog (xquery lib) one without (txt, xml)
44+
})
45+
46+
// TODO(DP): make this work on all OS by either adjusting the key sequence ctrl+s cmd+s …
47+
// or by using the file menu UI instead
48+
// see #414
49+
it('should let users edit new document', () => {
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+
})
3466

35-
// TODO(DP):
36-
// - add test for #413 : change order, remove workaround, might need a call to focused()
37-
// - check if tree view is deselected (it is but need not be),
38-
// - check if Explorer is updated properly (seems inconsistent need to double click)
39-
// - check if editor window is opening the newly create doc in a new tab (it doesn't)
40-
// - two file create routes one with follow-up dialog (xquery lib) one without (txt, xml)
41-
})
67+
it('should display document properties', () => {
68+
cy.get('[node-id$=test\\.txt]')
69+
.rightclick()
70+
.type('{alt+enter}', { force: true })
71+
cy.get('.dialogTitle')
72+
.should('contain.text', 'Properties')
73+
// rename file -> text.xml
74+
cy.get('.value > .theia-input')
75+
.clear()
76+
.type('test.xml')
77+
// check properties table
78+
cy.get('.dialogContent')
79+
.find('.keys > tr')
80+
.should('have.length', 11)
81+
.contains('Media Type')
82+
cy.get('.dialogContent')
83+
.find('.keys > tr')
84+
.contains('Owner')
85+
// check permissions table
86+
cy.get('.dialogContent')
87+
.find('.permissions-editor > tr')
88+
.should('have.length', 3)
89+
.contains('user')
90+
cy.get('.main')
91+
.click()
92+
})
4293

43-
// TODO(DP): make this work on all OS by either adjusting the key sequence ctrl+s cmd+s …
44-
// or by using the file menu UI instead
45-
// see #414
46-
it('should let users edit new document', () => {
47-
cy.get('[node-id$=untitled-1]')
48-
.dblclick()
49-
cy.get('.view-line')
50-
.type('asdf{meta+s}')
51-
})
52-
// see #414 workaround is to run this after editing and saving the document,
53-
// we should be able to rename before entering content
54-
it('should let users rename documents', () => {
55-
cy.get('[node-id$=untitled-1]')
56-
.rightclick()
57-
cy.get('[data-command="fusion.rename"] > .p-Menu-itemLabel')
58-
.should('be.visible')
59-
.click()
60-
.focused()
61-
.type('test.txt{enter}')
62-
})
94+
it('should not create duplicate documents', () => {
95+
cy.get('[node-id$=db]')
96+
.rightclick()
97+
.then(() => {
98+
cy.get('.p-Menu')
99+
.should('be.visible')
100+
.contains('New document')
101+
.trigger('mousemove')
102+
cy.get('[data-command="fusion.new-document-template:xml"] > .p-Menu-itemLabel')
103+
.should('be.visible')
104+
.click()
105+
cy.get('.fs-inline-input > .theia-input')
106+
.clear()
107+
.type('test.xml{enter}')
108+
cy.get('.error')
109+
.should('exist')
110+
.should('contain.text', 'Item already exists')
111+
})
112+
})
63113

64-
// TODO(DP): documents properties test could go here
65-
// it('Document properties', function () {
66-
// cy.waitForLoading();
67-
// cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/text_file.txt')).rightclick()
68-
// .getMenuCommand('fusion.properties').should('be.visible').click()
69-
// cy.get(dialogTitle).should('contain.text', 'Properties');
70-
// cy.get(dialogBody).should('be.visible').then(body => {
71-
// cy.wrap(body).find('td.label').contains('Name')
72-
// .find('+ td.value input.theia-input[type=text]').should('contain.value', 'text_file.txt');
73-
// cy.wrap(body).find('td.label').contains('Collection')
74-
// .find('+ td.value').should('contain.text', '/db/test_col');
75-
// cy.wrap(body).find('td.label').contains('Created')
76-
// .find('+ td.value').should('contain.text', Cypress.formatDate());
77-
// cy.wrap(body).find('td.label').contains('Modified')
78-
// .find('+ td.value').should('contain.text', Cypress.formatDate());
79-
// cy.wrap(body).find('td.label').contains('Media Type')
80-
// .find('+ td.value').should('contain.text', 'text/plain');
81-
// cy.wrap(body).find('td.label').contains('Binary')
82-
// .find('+ td.value').should('contain.text', 'Yes')
83-
// .find('button.theia-button').should('contain.text', 'Convert to non-binary');
84-
// cy.wrap(body).find('td.label').contains('Size')
85-
// .find('+ td.value').should('contain.text', '24 B');
86-
// cy.wrap(body).find('td.label').contains('Owner')
87-
// .find('+ td.value input.theia-input[type=text]').should('contain.value', 'admin');
88-
// cy.wrap(body).find('td.label').contains('Group')
89-
// .find('+ td.value input.theia-input[type=text]').should('contain.value', 'dba');
90-
// cy.wrap(body).find('table.permissions-editor tr').then(trs => {
91-
// cy.wrap(trs).eq(0).find('td').then(tds => {
92-
// cy.wrap(tds).eq(0).should('contain.text', 'user');
93-
// cy.wrap(tds).eq(1).findCheckbox().should('contain.text', 'read').checked();
94-
// cy.wrap(tds).eq(2).findCheckbox().should('contain.text', 'write').checked();
95-
// cy.wrap(tds).eq(3).findCheckbox().should('contain.text', 'execute').notChecked();
96-
// cy.wrap(tds).eq(4).findCheckbox().should('contain.text', 'setUID').notChecked();
97-
// });
98-
// cy.wrap(trs).eq(1).find('td').then(tds => {
99-
// cy.wrap(tds).eq(0).should('contain.text', 'group');
100-
// cy.wrap(tds).eq(1).findCheckbox().should('contain.text', 'read').checked();
101-
// cy.wrap(tds).eq(2).findCheckbox().should('contain.text', 'write').notChecked();
102-
// cy.wrap(tds).eq(3).findCheckbox().should('contain.text', 'execute').notChecked();
103-
// cy.wrap(tds).eq(4).findCheckbox().should('contain.text', 'setGID').notChecked();
104-
// });
105-
// cy.wrap(trs).eq(2).find('td').then(tds => {
106-
// cy.wrap(tds).eq(0).should('contain.text', 'other');
107-
// cy.wrap(tds).eq(1).findCheckbox().should('contain.text', 'read').checked();
108-
// cy.wrap(tds).eq(2).findCheckbox().should('contain.text', 'write').notChecked();
109-
// cy.wrap(tds).eq(3).findCheckbox().should('contain.text', 'execute').notChecked();
110-
// cy.wrap(tds).eq(4).findCheckbox().should('contain.text', 'sticky').notChecked();
111-
// });
112-
// });
113-
// });
114-
// cy.get(dialogSecondaryButton).should('be.visible').click();
115-
// cy.get(dialog).should('not.exist');
116-
// cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/xml_file.xml')).rightclick()
117-
// .getMenuCommand('fusion.properties').should('be.visible').click()
118-
// cy.get(dialogBody).should('be.visible').find('td.label').contains('Binary')
119-
// .find('+ td.value').should('contain.text', 'No')
120-
// .find('button.theia-button').should('contain.text', 'Convert to binary');
121-
// cy.get(dialogSecondaryButton).should('be.visible').click();
122-
// cy.get(dialog).should('not.exist');
123-
// })
124-
// TODO(DP): only allow unique document creation test should go here
125114

126-
it('should let users delete documents', () => {
127-
cy.get('[node-id$=test\\.txt]')
128-
.rightclick()
129-
cy.get('[data-command="fusion.delete"] > .p-Menu-itemLabel')
130-
.should('be.visible')
131-
.click()
132-
cy.get('.main')
133-
.click()
134-
cy.get('[node-id$=test\\.txt]')
135-
.should('not.exist')
136-
})
137-
})
115+
it('should let users delete documents', () => {
116+
cy.get('[node-id$=test\\.xml]')
117+
.rightclick()
118+
cy.get('[data-command="fusion.delete"] > .p-Menu-itemLabel')
119+
.should('be.visible')
120+
.click()
121+
cy.get('.main')
122+
.click()
123+
// make sure all test files are gone see #400
124+
cy.get('[node-id$=untitled-1]')
125+
.should('not.exist')
126+
cy.get('[node-id$=test\\.txt]')
127+
.should('not.exist')
128+
cy.get('[node-id$=test\\.xml]')
129+
.should('not.exist')
130+
cy.get('[node-id$=untitled-2]')
131+
.should('not.exist')
132+
})
138133
})
134+
})
139135
})

0 commit comments

Comments
 (0)