diff --git a/cypress/e2e/tables-table.cy.js b/cypress/e2e/tables-table.cy.js index 7e5faaa92..a2b898c00 100644 --- a/cypress/e2e/tables-table.cy.js +++ b/cypress/e2e/tables-table.cy.js @@ -23,13 +23,35 @@ describe('Manage a table', () => { cy.get('.tile').contains('ToDo').click({ force: true }) cy.get('.modal__content').should('be.visible') cy.get('.modal__content input[type="text"]').clear().type('to do list') - cy.contains('button', 'Create table').click() + cy.contains('button', 'Create table').scrollIntoView().click() cy.contains('button', 'Create row').should('be.visible') cy.contains('h1', 'to do list').should('be.visible') cy.contains('table th', 'Task').should('exist') }) + it('Create with import', () => { + cy.uploadFile('test-import.csv', 'text/csv') + cy.contains('.app-menu-entry--label', 'Tables').click() + cy.contains('button', 'Create new table').click() + cy.get('.tile').contains('Import').click({ force: true }) + cy.get('.modal__content').should('be.visible') + cy.get('.modal__content input[type="text"]').clear().type('import list') + cy.contains('button', 'Create table').scrollIntoView().click() + cy.contains('h2', 'Import').should('be.visible') + + cy.get('.modal__content button').contains('Select a file').click() + cy.get('.file-picker__files').contains('test-import').click() + cy.get('.file-picker button span').contains('Choose test-import.csv').click() + cy.get('.modal__content button').contains('Import').click() + cy.get('[data-cy="importResultColumnsFound"]').should('contain.text', '4') + cy.get('[data-cy="importResultColumnsMatch"]').should('contain.text', '0') + cy.get('[data-cy="importResultColumnsCreated"]').should('contain.text', '4') + cy.get('[data-cy="importResultRowsInserted"]').should('contain.text', '3') + cy.get('[data-cy="importResultParsingErrors"]').should('contain.text', '0') + cy.get('[data-cy="importResultRowErrors"]').should('contain.text', '0') + }) + it('Update title', () => { cy.get('.app-navigation__list').contains('to do list').click({ force: true }) cy.get('[data-cy="customTableAction"] button').click() diff --git a/src/modules/modals/CreateTable.vue b/src/modules/modals/CreateTable.vue index 9270394c6..21fc16f26 100644 --- a/src/modules/modals/CreateTable.vue +++ b/src/modules/modals/CreateTable.vue @@ -36,6 +36,14 @@ :tabbable="true" @set-template="setTemplate('custom')" /> +
+ +
item.name === name) || '' this.icon = templateObject?.icon @@ -126,7 +137,7 @@ export default { } if (!this.customTitleChosen) { - if (name === 'custom') { + if (name === 'custom' || name === 'import') { this.title = '' } else { const templateObject = this.templates?.find(item => item.name === name) || '' @@ -150,6 +161,9 @@ export default { const newTableId = await this.sendNewTableToBE(this.templateChoice) if (newTableId) { await this.$router.push('/table/' + newTableId) + if (this.templateChoice === 'import') { + emit('tables:modal:import', { element: { tableId: newTableId, id: newTableId }, isView: false }) + } this.actionCancel() } }