Management e2e tests

This commit is contained in:
Michael Shamoon
2022-03-23 14:38:59 -07:00
parent 40b07572a9
commit dccea9434a
3 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
describe('documents-list', () => {
beforeEach(() => {
cy.intercept('http://localhost:8000/api/correspondents/*', {
fixture: 'manage/correspondents.json',
})
cy.intercept('http://localhost:8000/api/tags/*', {
fixture: 'manage/tags.json',
})
})
it('should show a list of correspondents with bottom pagination as well', () => {
cy.visit('/correspondents')
cy.get('tbody').find('tr').its('length').should('eq', 25)
cy.get('ngb-pagination').its('length').should('eq', 2)
})
it('should show a list of tags without bottom pagination', () => {
cy.visit('/tags')
cy.get('tbody').find('tr').its('length').should('eq', 8)
cy.get('ngb-pagination').its('length').should('eq', 1)
})
it('should show a list of documents filtered by tag', () => {
cy.intercept('http://localhost:8000/api/documents/*', (req) => {
if (req.url.indexOf('tags__id__all=4'))
req.reply({ count: 3, next: null, previous: null, results: [] })
})
cy.visit('/tags')
cy.get('tbody').find('button').contains('Documents').first().click() // id = 4
cy.contains('3 documents')
})
})