diff --git a/packages/test-e2e-composable-vue3/src/components/UpdateQuery.vue b/packages/test-e2e-composable-vue3/src/components/UpdateQuery.vue new file mode 100644 index 00000000..3fc19dde --- /dev/null +++ b/packages/test-e2e-composable-vue3/src/components/UpdateQuery.vue @@ -0,0 +1,141 @@ + + + diff --git a/packages/test-e2e-composable-vue3/src/router.ts b/packages/test-e2e-composable-vue3/src/router.ts index 0ac28b7d..bd92a95e 100644 --- a/packages/test-e2e-composable-vue3/src/router.ts +++ b/packages/test-e2e-composable-vue3/src/router.ts @@ -93,5 +93,9 @@ export const router = createRouter({ layout: 'blank', }, }, + { + path: '/update-query', + component: () => import('./components/UpdateQuery.vue'), + }, ], }) diff --git a/packages/test-e2e-composable-vue3/tests/e2e/specs/updateQuery.cy.ts b/packages/test-e2e-composable-vue3/tests/e2e/specs/updateQuery.cy.ts new file mode 100644 index 00000000..ed7ee75d --- /dev/null +++ b/packages/test-e2e-composable-vue3/tests/e2e/specs/updateQuery.cy.ts @@ -0,0 +1,30 @@ +describe('updateQuery', () => { + beforeEach(() => { + cy.task('db:reset') + cy.visit('/update-query') + }) + + it('should add new message to cache using updateQuery', () => { + cy.get('.channel-btn').eq(0).click() + cy.get('.message-input').type('hello 1') + cy.get('.message').should('have.lengthOf', 0) + cy.get('.send-message-btn').click() + cy.get('.message').should('have.lengthOf', 1) + cy.get('.message-input').type('hello 2') + cy.get('.send-message-btn').click() + cy.get('.message').should('have.lengthOf', 2) + cy.contains('.message', 'hello 1') + cy.contains('.message', 'hello 2') + + cy.get('.channel-btn').eq(1).click() + cy.get('.message-input').type('hello 3') + cy.get('.message').should('have.lengthOf', 0) + cy.get('.send-message-btn').click() + cy.get('.message').should('have.lengthOf', 1) + cy.get('.message-input').type('hello 4') + cy.get('.send-message-btn').click() + cy.get('.message').should('have.lengthOf', 2) + cy.contains('.message', 'hello 3') + cy.contains('.message', 'hello 4') + }) +})