Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End-to-end Rewrite 4 #429

Merged
merged 10 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
command: |
pwd
sleep 15
npx cypress run --config defaultCommandTimeout=55000
npx cypress run --config defaultCommandTimeout=58000
no_output_timeout: 2m
workflows:
browser_build:
Expand Down
1 change: 0 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"baseUrl": "http://localhost:3000",
"ignoreTestFiles": "**/integration/examples/*.*",
"projectId": "ftw148",
"experimentalFetchPolyfill": true,
"env": {
"API_HOST": "http://localhost:8080"
}
Expand Down
26 changes: 0 additions & 26 deletions cypress/integration/00_temp_spec.js

This file was deleted.

File renamed without changes.
15 changes: 10 additions & 5 deletions cypress/integration/04_document_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ 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
})

describe('db context menu', () => {
it('should display creation options', () => {
cy.visit('/')
cy.get('.ReactVirtualized__Grid', { timeout: 55000 })
.should('be.visible')
cy.get('.fusion-item')
Expand Down Expand Up @@ -43,14 +44,19 @@ context('Document Operations', () => {
// - two file create routes one with follow-up dialog (xquery lib) one without (txt, xml)
})

// TODO(DP): make this work on all OS by either adjusting the key sequence ctrl+s cmd+s …
// or by using the file menu UI instead
// see https://github.com/cypress-io/cypress/pull/15388/files#
// see #414

it('should let users edit new document', () => {
cy.get('[node-id$=untitled-1]')
.dblclick()
cy.get('.view-line')
if( Cypress.platform === 'darwin') {
cy.get('.view-line')
.type('asdf{meta+s}')
} 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
Expand Down Expand Up @@ -111,7 +117,6 @@ context('Document Operations', () => {
})
})


it('should let users delete documents', () => {
cy.get('[node-id$=test\\.xml]')
.rightclick()
Expand Down
281 changes: 152 additions & 129 deletions cypress/integration/05_collection_spec.js
Original file line number Diff line number Diff line change
@@ -1,141 +1,164 @@
/// <reference types="Cypress" />

context('Collection Operations', () => {
describe('working with tree view', () => {
before(() => {
cy.connect()
})
let fetchSpy;
describe('working with tree view', () => {
before(() => {
cy.connect()
cy.visit('/');
})
beforeEach(() => {
cy.window().then(win => fetchSpy = cy.spy(win, 'fetch').as('fetch'));
})

describe('db context menu', () => {
it('should display creation options', () => {
cy.visit('/')
cy.get('.ReactVirtualized__Grid')
.should('be.visible')
cy.get('.fusion-item')
.click()
// all we need is the final part of the node-id attribute
cy.get('[node-id$=db]')
.rightclick()
.then(() => {
cy.get('.p-Menu')
.should('be.visible')
.contains('New collection')
.trigger('mousemove')
cy.get('[data-command="fusion.new-collection"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
})
// (DP): start workaround for #413
cy.get('[node-id$=db]')
.trigger('mousemove')
.type('{enter}')
// end workaround for #413
cy.get('.ReactVirtualized__Grid')
.contains('untitled-1')
})
describe('db context menu', () => {
it('should display creation options', () => {
cy.get('.fusion-view')
.should('be.visible')
cy.get('.fusion-item')
.click()
// all we need is the final part of the node-id attribute
// (DP): start workaround for #413
cy.get('[node-id$=db]')
.click()
cy.get('.fa-spinner')
.should('not.exist')
// (DP): end workaround for #413
cy.get('@fetch').should('be.calledWith', Cypress.env('API_HOST') + '/exist/restxq/fusiondb/explorer?uri=/db');
cy.get('[node-id$=db]')
.rightclick();
cy.get('.p-Menu')
.should('be.visible')
.find('[data-command="fusion.new-collection"]')
.should('be.visible')
.contains('New collection')
.click()
cy.focused()
.type('{enter}')
cy.get('.fusion-view')
.contains('untitled-1')
cy.get('@fetch').should('be.calledWithMatch', Cypress.env('API_HOST') + '/exist/restxq/fusiondb/collection?uri=/db/untitled-1', { method: 'PUT' });
})

it('should let users rename collection', () => {
cy.get('[node-id$=untitled-1]')
.rightclick()
cy.get('[data-command="fusion.rename"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
.focused()
.type('test_col{enter}')
})
it('should let users rename collection', () => {
cy.get('[node-id$=untitled-1]')
.rightclick()
cy.get('[data-command="fusion.rename"]')
.should('be.visible')
.contains('Rename')
.click()
cy.focused()
.type('test_col{enter}')
cy.get('@fetch').should('be.calledWithMatch', Cypress.env('API_HOST') + '/exist/restxq/fusiondb/collection?uri=/db/test_col', {
method: 'PUT',
headers: { 'x-fs-move-source': '/db/untitled-1' },
});
cy.get('.fusion-view')
.contains('test_col')
cy.get('[node-id$=untitled-1]')
.should('not.exist')
})

it('should display collection properties', () => {
cy.get('[node-id$=test_col]')
.rightclick()
.type('{alt+enter}', { force: true })
cy.get('.dialogTitle')
.should('contain.text', 'Properties')
// rename file -> text.xml
cy.get('.value > .theia-input')
.clear()
.type('test_col2')
// check properties table
cy.get('.dialogContent')
.find('.keys > tr')
.should('have.length', 7)
.contains('Created')
cy.get('.dialogContent')
.find('.keys > tr')
.contains('Owner')
// check permissions table
cy.get('.dialogContent')
.find('.permissions-editor > tr')
.should('have.length', 3)
.contains('user')
cy.get('.main')
.click()
})
it('should display collection properties', () => {
cy.get('[node-id$=test_col]')
.click()
.type('{alt+enter}', { force: true })
cy.get('.dialogTitle')
.should('contain.text', 'Properties')
// rename file -> text.xml
cy.get('.value > .theia-input')
.should('have.value', 'test_col')
.clear()
.type('test_col2')
// check properties table
cy.get('.dialogContent')
.find('.keys > tr')
.should('have.length', 7)
.should('contain', 'Created')
.should('contain', 'Owner')
.should('contain', 'Group')
// check permissions table
cy.get('.dialogContent')
.find('.permissions-editor > tr')
.should('have.length', 3)
.should('contain', 'user')
.should('contain', 'group')
.should('contain', 'other')
cy.get('.main')
.click()
cy.get('.dialogBlock')
.should('not.exist');
cy.get('[node-id$=test_col2]')
.should('exist')
cy.get('[node-id$=test_col]')
.should('not.exist')
})

it('should not create duplicate collection', () => {
cy.get('[node-id$=db]')
.rightclick()
.then(() => {
cy.get('.p-Menu')
.should('be.visible')
.contains('New collection')
.trigger('mousemove')
cy.get('[data-command="fusion.new-collection"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
cy.get('.fs-inline-input > .theia-input')
.clear()
.type('test_col2{enter}')
cy.get('.error')
.should('exist')
.should('contain.text', 'Item already exists')
})
})
it('should not create duplicate collection', () => {
cy.get('[node-id$=db]')
.rightclick()
.then(() => {
cy.get('.p-Menu')
.should('be.visible')
.contains('New collection')
.trigger('mousemove')
cy.get('[data-command="fusion.new-collection"]')
.should('be.visible')
.click()
cy.focused()
.clear()
.type('test_col2{enter}')
cy.get('.error')
.should('exist')
.should('contain.text', 'Item already exists')
})
})

it('should create nested collection', () => {
cy.get('[node-id$=test_col2]')
.rightclick()
.then(() => {
cy.get('.p-Menu')
.should('be.visible')
.contains('New collection')
.trigger('mousemove')
cy.get('[data-command="fusion.new-collection"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
cy.get('.fs-inline-input > .theia-input')
.clear()
.type('test_colA{enter}')
// TODO(DP): we migh want to check the proper nesting more explicitely,
// but that is already covered by checking for this collection after deleting
// its parent collection
cy.get('.ReactVirtualized__Grid')
.contains('test_colA')
})
})
it('should create nested collection', () => {
cy.get('[node-id$=test_col2]')
.click()
.rightclick()
cy.get('.p-Menu')
.should('be.visible')
.contains('New collection')
cy.get('[data-command="fusion.new-collection"]')
.should('be.visible')
.click()
cy.focused()
.clear()
.type('test_colA{enter}')
// TODO(DP): we migh want to check the proper nesting more explicitely,
// but that is already covered by checking for this collection after deleting
// its parent collection
cy.get('.fusion-view')
.contains('test_colA')
})


it('should let users delete collection', () => {
cy.get('[node-id$=test_col2]')
.rightclick()
cy.get('[data-command="fusion.delete"] > .p-Menu-itemLabel')
.should('be.visible')
.click()
cy.get('.main')
.click()
// make sure all test files are gone see #400
cy.get('[node-id$=untitled-1]')
.should('not.exist')
cy.get('[node-id$=untitled-2]')
.should('not.exist')
cy.get('[node-id$=test_col]')
.should('not.exist')
cy.get('[node-id$=test_col1]')
.should('not.exist')
cy.get('[node-id$=test_col2]')
.should('not.exist')
cy.get('[node-id$=test_colA]')
.should('not.exist')
})
})
it('should let users delete collection', () => {
cy.get('[node-id$=test_col2]')
.rightclick()
cy.get('[data-command="fusion.delete"]')
.should('be.visible')
.contains('Delete')
.click()
cy.get('.main')
.click()
cy.get('@fetch').should('be.calledWithMatch', Cypress.env('API_HOST') + '/exist/restxq/fusiondb/collection?uri=/db/test_col2', { method: 'DELETE' });
// make sure all test files are gone see #400, including those produced by failed create commands
cy.get('[node-id$=untitled-1]')
.should('not.exist')
cy.get('[node-id$=untitled-2]')
.should('not.exist')
cy.get('[node-id$=test_col]')
.should('not.exist')
cy.get('[node-id$=test_col1]')
.should('not.exist')
cy.get('[node-id$=test_col2]')
.should('not.exist')
cy.get('[node-id$=test_colA]')
.should('not.exist')
})
})
})
})
Loading