Skip to content

Commit

Permalink
fix(doc_spec): WIP flakey doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
duncdrum committed Sep 15, 2021
1 parent 93b08cb commit 25875b6
Showing 1 changed file with 67 additions and 21 deletions.
88 changes: 67 additions & 21 deletions cypress/integration/04_document_spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
/// <reference types="Cypress" />

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

describe('db context menu', () => {
it.only('should display creation options', () => {
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
.should('be.visible')
cy.get('.fusion-item')
.should('be.visible')
.click()
// all we need is the final part of the node-id attribute
cy.get('[node-id$=db]')
.should('be.visible')
.rightclick()
.then(() => {
cy.get('.p-Menu')
.should('be.visible')
.contains('New document')
.trigger('mousemove')
cy.get('[data-command="fusion.new-document"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
})
// (DP): start workaround for #413
cy.get('.fusion-item')
.should('be.visible')
.click()
cy.get('[node-id$=db]')
.should('be.visible')
.focused()
.type('{enter}')
// end workaround for #413
cy.get('.ReactVirtualized__Grid')
.should('be.visible')
.contains('untitled-1')

// TODO(DP):
// - add test for #413 : change order, remove workaround, might need a call to focused()
// - check if tree view is deselected (it is but need not be),
// - check if Explorer is updated properly (seems inconsistent need to double click)
// - check if editor window is opening the newly create doc in a new tab (it doesn't)
// - two file create routes one with follow-up dialog (xquery lib) one without (txt, xml)
})

it('should display creation options', () => {
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
.should('be.visible')
cy.get('.fusion-item')
.should('be.visible')
.click()
// all we need is the final part of the node-id attribute
// all we need is the final part of the node-id attribute
cy.get('[node-id$=db]')
.should('be.visible')
.rightclick()
.then(() => {
cy.get('.p-Menu')
Expand All @@ -28,14 +71,17 @@ context.skip('Document Operations', () => {
.should('be.visible')
.click()
})
// (DP): start workaround for #413
// (DP): start workaround for #413
cy.get('.fusion-item')
.click()
.should('be.visible')
.click()
cy.get('[node-id$=db]')
.should('be.visible')
.trigger('mousemove')
.type('{enter}')
// end workaround for #413
// end workaround for #413
cy.get('.ReactVirtualized__Grid')
.should('be.visible')
.contains('untitled-1')

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

it('should let users edit new document', () => {
cy.get('[node-id$=untitled-1]')
.dblclick()
if( Cypress.platform === 'darwin') {
cy.get('.view-line')
cy.get('[node-id$=untitled-1]')
.dblclick()
if (Cypress.platform === 'darwin') {
cy.get('.view-line')
.type('asdf{meta+s}')
} else {
cy.get('.view-line')
} else {
cy.get('.view-line')
.type('asdf{ctrl+s}')
}
})
// see #414 workaround is to run this after editing and saving the document,
// we should be able to rename before entering content
}
})
// see #414 workaround is to run this after editing and saving the document,
// we should be able to rename before entering content
it('should let users rename documents', () => {
cy.get('[node-id$=untitled-1]')
.rightclick()
Expand All @@ -78,19 +124,19 @@ context.skip('Document Operations', () => {
.type('{alt+enter}', { force: true })
cy.get('.dialogTitle')
.should('contain.text', 'Properties')
// rename file -> text.xml
// rename file -> text.xml
cy.get('.value > .theia-input')
.clear()
.type('test.xml')
// check properties table
// check properties table
cy.get('.dialogContent')
.find('.keys > tr')
.should('have.length', 11)
.contains('Media Type')
cy.get('.dialogContent')
.find('.keys > tr')
.contains('Owner')
// check permissions table
// check permissions table
cy.get('.dialogContent')
.find('.permissions-editor > tr')
.should('have.length', 3)
Expand Down Expand Up @@ -127,7 +173,7 @@ context.skip('Document Operations', () => {
.click()
cy.get('.main')
.click()
// make sure all test files are gone see #400
// make sure all test files are gone see #400
cy.get('[node-id$=untitled-1]')
.should('not.exist')
cy.get('[node-id$=test\\.txt]')
Expand Down

0 comments on commit 25875b6

Please sign in to comment.