Skip to content

Commit

Permalink
test: add e2e test for navigation filtering
Browse files Browse the repository at this point in the history
- add new created views to its table objects in store
- rename test context
- add tests

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian Steffens committed Sep 15, 2023
1 parent 61c58a3 commit 5b6fefe
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
38 changes: 37 additions & 1 deletion cypress/e2e/tables-fe-filters.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let localUser

describe('The Home Page', () => {
describe('FE sorting and filtering', () => {

before(function() {
cy.createRandomUser().then(user => {
Expand Down Expand Up @@ -64,4 +64,40 @@ describe('The Home Page', () => {
cy.loadView('view for second table')
cy.get('.info').contains('Reset local adjustments').should('not.exist')
})

it.only('Navigation filtering', () => {
cy.viewport('macbook-15')
cy.createTable('first table')
cy.createTable('second table')
cy.createTable('third table πŸ™‡')
cy.createTextLineColumn('col1', true)
cy.createView('view for third tab')

// all tables and views should be visible
cy.get('.app-navigation-entry__title').contains('first table').should('be.visible')
cy.get('.app-navigation-entry__title').contains('second table').should('be.visible')
cy.get('.app-navigation-entry__title').contains('third table πŸ™‡').should('be.visible')
cy.get('.app-navigation-entry__title').contains('view for third tab').should('be.visible')

// only tables should be visible
cy.get('.filter-box input').clear().type('table')
cy.get('.app-navigation-entry__title').contains('first table').should('be.visible')
cy.get('.app-navigation-entry__title').contains('second table').should('be.visible')
cy.get('.app-navigation-entry__title').contains('third table πŸ™‡').should('be.visible')
cy.get('.app-navigation-entry__title').contains('view for third tab').should('not.exist')

// only the second table should be visible
cy.get('.filter-box input').clear().type('second')
cy.get('.app-navigation-entry__title').contains('first table').should('not.exist')
cy.get('.app-navigation-entry__title').contains('second table').should('be.visible')
cy.get('.app-navigation-entry__title').contains('third table πŸ™‡').should('not.exist')
cy.get('.app-navigation-entry__title').contains('view for third tab').should('not.exist')

// only the third table and it's view should be visible
cy.get('.filter-box input').clear().type('view for third')
cy.get('.app-navigation-entry__title').contains('first table').should('not.exist')
cy.get('.app-navigation-entry__title').contains('second table').should('not.exist')
cy.get('.app-navigation-entry__title').contains('third table πŸ™‡').should('be.visible')
cy.get('.app-navigation-entry__title').contains('view for third tab').should('be.visible')
})
})
5 changes: 5 additions & 0 deletions src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ export default new Vuex.Store({
const views = state.views
views.push(res.data)
commit('setViews', views)

const tables = state.tables
const table = tables.find(t => t.id === res.data.tableId)
table.views.push(res.data)

return res.data.id
},
async updateView({ state, commit, dispatch }, { id, data }) {
Expand Down

0 comments on commit 5b6fefe

Please sign in to comment.