Skip to content
Merged
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
56 changes: 30 additions & 26 deletions e2e/specs/httpCache.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,37 +141,41 @@ describe('HTTP cache tests', () => {
})
})

it('invalidates /camp/{campId}/categories for new category', () => {
const uri = '/api/camps/3c79b99ab424/categories'

Cypress.session.clearAllSavedSessions()
cy.login('[email protected]')

// warm up cache
cy.expectCacheMiss(uri)
cy.expectCacheHit(uri)
it(
'invalidates /camp/{campId}/categories for new category',
{ retries: { runMode: 3 } },
() => {
const uri = '/api/camps/3c79b99ab424/categories'

// add new category to camp
cy.apiPost('/api/categories', {
camp: '/api/camps/3c79b99ab424',
short: 'new',
name: 'new Category',
color: '#000000',
numberingStyle: '1',
}).then((response) => {
const newContentNodeUri = response.body._links.self.href
Cypress.session.clearAllSavedSessions()
cy.login('[email protected]')

// ensure cache was invalidated
// warm up cache
cy.expectCacheMiss(uri)
cy.expectCacheHit(uri)

// delete newly created contentNode
cy.apiDelete(newContentNodeUri)

// ensure cache was invalidated
cy.expectCacheMiss(uri)
})
})
// add new category to camp
cy.apiPost('/api/categories', {
camp: '/api/camps/3c79b99ab424',
short: 'new',
name: 'new Category',
color: '#000000',
numberingStyle: '1',
}).then((response) => {
const newContentNodeUri = response.body._links.self.href

// ensure cache was invalidated
cy.expectCacheMiss(uri)
cy.expectCacheHit(uri)

// delete newly created contentNode
cy.apiDelete(newContentNodeUri)

// ensure cache was invalidated
cy.expectCacheMiss(uri)
})
}
)

it('invalidates cached data when user leaves a camp', () => {
Cypress.session.clearAllSavedSessions()
Expand Down
Loading