Skip to content

Commit 25875b6

Browse files
committed
fix(doc_spec): WIP flakey doc tests
see #517 #516
1 parent 93b08cb commit 25875b6

File tree

1 file changed

+67
-21
lines changed

1 file changed

+67
-21
lines changed

cypress/integration/04_document_spec.js

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,66 @@
11
/// <reference types="Cypress" />
22

3-
context.skip('Document Operations', () => {
3+
context('Document Operations', () => {
44
describe('working with tree view', () => {
55
before(() => {
66
cy.connect()
77
cy.visit('/')
88
cy.get(`[node-id=${CSS.escape('admin@' + Cypress.env('API_HOST'))}]`)
9-
// TODO(DP): might have to improve by adding more before / after hooks to prevent dangling documents
10-
// see #400
9+
.should('be.visible')
10+
// TODO(DP): might have to improve by adding more before / after hooks to prevent dangling documents
11+
// see #400
1112
})
1213

1314
describe('db context menu', () => {
15+
it.only('should display creation options', () => {
16+
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
17+
.should('be.visible')
18+
cy.get('.fusion-item')
19+
.should('be.visible')
20+
.click()
21+
// all we need is the final part of the node-id attribute
22+
cy.get('[node-id$=db]')
23+
.should('be.visible')
24+
.rightclick()
25+
.then(() => {
26+
cy.get('.p-Menu')
27+
.should('be.visible')
28+
.contains('New document')
29+
.trigger('mousemove')
30+
cy.get('[data-command="fusion.new-document"] > .p-Menu-itemLabel')
31+
.should('be.visible')
32+
.click()
33+
})
34+
// (DP): start workaround for #413
35+
cy.get('.fusion-item')
36+
.should('be.visible')
37+
.click()
38+
cy.get('[node-id$=db]')
39+
.should('be.visible')
40+
.focused()
41+
.type('{enter}')
42+
// end workaround for #413
43+
cy.get('.ReactVirtualized__Grid')
44+
.should('be.visible')
45+
.contains('untitled-1')
46+
47+
// TODO(DP):
48+
// - add test for #413 : change order, remove workaround, might need a call to focused()
49+
// - check if tree view is deselected (it is but need not be),
50+
// - check if Explorer is updated properly (seems inconsistent need to double click)
51+
// - check if editor window is opening the newly create doc in a new tab (it doesn't)
52+
// - two file create routes one with follow-up dialog (xquery lib) one without (txt, xml)
53+
})
54+
1455
it('should display creation options', () => {
1556
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
1657
.should('be.visible')
1758
cy.get('.fusion-item')
59+
.should('be.visible')
1860
.click()
19-
// all we need is the final part of the node-id attribute
61+
// all we need is the final part of the node-id attribute
2062
cy.get('[node-id$=db]')
63+
.should('be.visible')
2164
.rightclick()
2265
.then(() => {
2366
cy.get('.p-Menu')
@@ -28,14 +71,17 @@ context.skip('Document Operations', () => {
2871
.should('be.visible')
2972
.click()
3073
})
31-
// (DP): start workaround for #413
74+
// (DP): start workaround for #413
3275
cy.get('.fusion-item')
33-
.click()
76+
.should('be.visible')
77+
.click()
3478
cy.get('[node-id$=db]')
79+
.should('be.visible')
3580
.trigger('mousemove')
3681
.type('{enter}')
37-
// end workaround for #413
82+
// end workaround for #413
3883
cy.get('.ReactVirtualized__Grid')
84+
.should('be.visible')
3985
.contains('untitled-1')
4086

4187
// TODO(DP):
@@ -50,18 +96,18 @@ context.skip('Document Operations', () => {
5096
// see #414
5197

5298
it('should let users edit new document', () => {
53-
cy.get('[node-id$=untitled-1]')
54-
.dblclick()
55-
if( Cypress.platform === 'darwin') {
56-
cy.get('.view-line')
99+
cy.get('[node-id$=untitled-1]')
100+
.dblclick()
101+
if (Cypress.platform === 'darwin') {
102+
cy.get('.view-line')
57103
.type('asdf{meta+s}')
58-
} else {
59-
cy.get('.view-line')
104+
} else {
105+
cy.get('.view-line')
60106
.type('asdf{ctrl+s}')
61-
}
62-
})
63-
// see #414 workaround is to run this after editing and saving the document,
64-
// we should be able to rename before entering content
107+
}
108+
})
109+
// see #414 workaround is to run this after editing and saving the document,
110+
// we should be able to rename before entering content
65111
it('should let users rename documents', () => {
66112
cy.get('[node-id$=untitled-1]')
67113
.rightclick()
@@ -78,19 +124,19 @@ context.skip('Document Operations', () => {
78124
.type('{alt+enter}', { force: true })
79125
cy.get('.dialogTitle')
80126
.should('contain.text', 'Properties')
81-
// rename file -> text.xml
127+
// rename file -> text.xml
82128
cy.get('.value > .theia-input')
83129
.clear()
84130
.type('test.xml')
85-
// check properties table
131+
// check properties table
86132
cy.get('.dialogContent')
87133
.find('.keys > tr')
88134
.should('have.length', 11)
89135
.contains('Media Type')
90136
cy.get('.dialogContent')
91137
.find('.keys > tr')
92138
.contains('Owner')
93-
// check permissions table
139+
// check permissions table
94140
cy.get('.dialogContent')
95141
.find('.permissions-editor > tr')
96142
.should('have.length', 3)
@@ -127,7 +173,7 @@ context.skip('Document Operations', () => {
127173
.click()
128174
cy.get('.main')
129175
.click()
130-
// make sure all test files are gone see #400
176+
// make sure all test files are gone see #400
131177
cy.get('[node-id$=untitled-1]')
132178
.should('not.exist')
133179
cy.get('[node-id$=test\\.txt]')

0 commit comments

Comments
 (0)