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

Fix/545 reset frontend filter on table/view change #551

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
67 changes: 67 additions & 0 deletions cypress/e2e/tables-fe-filters.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
let localUser

describe('The Home Page', () => {

before(function() {
cy.createRandomUser().then(user => {
localUser = user
})
})

beforeEach(function() {
cy.login(localUser)
cy.visit('apps/tables')
})

it('FE Search in table', () => {
cy.get('.app-navigation-entry-link').contains('Tutorial').click({ force: true })

// test case-sensitive
cy.contains('Edit a row').should('exist')
cy.get('.searchAndFilter input').type('tables')
cy.contains('Edit a row').should('not.exist')
cy.contains('Read the docs').should('exist')

// test not case-sensitive
cy.get('.searchAndFilter input').clear()
cy.get('.searchAndFilter input').type('TABLES')
cy.contains('Edit a row').should('not.exist')
cy.contains('Read the docs').should('exist')

// test search for number regarding a check field
cy.get('.searchAndFilter input').clear()
cy.get('.searchAndFilter input').type('3')
cy.contains('Edit a row').should('not.exist')
cy.contains('Read the docs').should('exist')
})

it.only('Reset FE filter on table or view change', () => {
datenangebot marked this conversation as resolved.
Show resolved Hide resolved
// create a table and view, so we can change the active table and view later on
cy.createTable('first table')
cy.createTextLineColumn('colA', true)

cy.createTable('second table')
cy.createTextLineColumn('col1', true)

// change between tables
cy.loadTable('first table')
cy.sortTableColumn('colA')
cy.get('.info').contains('Reset local adjustments').should('be.visible')
cy.loadTable('second table')
cy.get('.info').contains('Reset local adjustments').should('not.exist')

// change from view to table
cy.createView('view for second table')
cy.sortTableColumn('col1')
cy.get('.info').contains('Reset local adjustments').should('be.visible')
cy.loadTable('second table')
cy.get('.info').contains('Reset local adjustments').should('not.exist')

// change from table to view
cy.loadTable('first table')
cy.sortTableColumn('colA')
cy.get('.info').contains('Reset local adjustments').should('be.visible')
cy.loadView('view for second table')
cy.get('.info').contains('Reset local adjustments').should('not.exist')
})
})
37 changes: 0 additions & 37 deletions cypress/e2e/tables-search.cy.js

This file was deleted.

21 changes: 19 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ addCommands()

Cypress.Commands.add('createTable', (title) => {
cy.contains('.app-menu-entry--label', 'Tables').click()
cy.contains('button', 'Create new table').click()
cy.get('button[aria-label="Create new table"]').click()
cy.get('.tile').contains('Custom table').click({ force: true })
cy.get('.modal__content input[type="text"]').clear().type(title)
cy.contains('button', 'Create table').click()
Expand All @@ -45,7 +45,11 @@ Cypress.Commands.add('createView', (title) => {

cy.get('.modal-container #settings-section_title input').type(title)

cy.intercept({ method: 'POST', url: '**/apps/tables/view' }).as('createView')
cy.intercept({ method: 'PUT', url: '**/apps/tables/view/*' }).as('updateView')
cy.contains('button', 'Create View').click()
cy.wait('@createView')
cy.wait('@updateView')

cy.contains('.app-navigation-entry-link span', title).should('exist')
})
Expand All @@ -55,8 +59,21 @@ Cypress.Commands.add('clickOnTableThreeDotMenu', (optionName) => {
cy.get('.v-popper__popper li button span').contains(optionName).click({ force: true })
})

Cypress.Commands.add('sortTableColumn', (columnTitle, mode = 'ASC') => {
cy.get('th').contains(columnTitle).click()
if (mode === 'ASC') {
cy.get('ul li.action button[aria-label="Sort asc"]').click()
} else {
cy.get('ul li.action button[aria-label="Sort desc"]').click()
}
})

Cypress.Commands.add('loadTable', (name) => {
cy.get('.app-navigation-entry-link').contains(name).click({ force: true })
cy.get('.app-navigation-entry a[title="' + name + '"]').click({ force: true })
})

Cypress.Commands.add('loadView', (name) => {
cy.get('.app-navigation-entry a[title="' + name + '"]').click({ force: true })
})

Cypress.Commands.add('unifiedSearch', (term) => {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/main/sections/MainWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
if (!this.lastActiveElement || this.element.id !== this.lastActiveElement.id || this.isView !== this.lastActiveElement.isView || force) {
this.localLoading = true

if (this.isView) this.viewSetting = {}
this.viewSetting = {}

await this.$store.dispatch('loadColumnsFromBE', {
view: this.isView ? this.element : null,
Expand Down