Some document list bulk editor e2e tests

This commit is contained in:
Michael Shamoon
2022-03-23 15:20:29 -07:00
parent c16484f01e
commit b863b178d2
5 changed files with 72 additions and 9 deletions

View File

@@ -2,19 +2,78 @@ describe('documents-list', () => {
beforeEach(() => {
cy.intercept('http://localhost:8000/api/documents/*', {
fixture: 'documents/documents.json',
});
})
cy.intercept('http://localhost:8000/api/documents/1/thumb/', {
fixture: 'documents/lorem-ipsum.png',
});
})
cy.intercept('http://localhost:8000/api/tags/*', {
fixture: 'documents/tags.json',
})
cy.intercept('http://localhost:8000/api/correspondents/*', {
fixture: 'documents/correspondents.json',
})
cy.intercept('http://localhost:8000/api/document_types/*', {
fixture: 'documents/doctypes.json',
})
cy.visit('/documents');
});
cy.visit('/documents')
})
it('should show a list of documents rendered as cards with thumbnails', () => {
cy.contains('One document');
cy.contains('lorem-ipsum');
cy.contains('One document')
cy.contains('lorem-ipsum')
cy.get('app-document-card-small:first-of-type img')
.invoke('attr', 'src')
.should('eq', 'http://localhost:8000/api/documents/1/thumb/');
});
});
.should('eq', 'http://localhost:8000/api/documents/1/thumb/')
})
it('should apply tags', () => {
cy.intercept('http://localhost:8000/api/documents/*', {
fixture: 'documents/documents_saved.json',
})
cy.get('app-document-card-small:first-of-type').click()
cy.get('app-bulk-editor app-filterable-dropdown[title="Tags"]').within(
() => {
cy.contains('button', 'Tags').click()
cy.contains('button', 'Test Tag').click()
cy.contains('button', 'Apply').click()
}
)
cy.contains('button', 'Confirm').click()
cy.get('app-document-card-small:first-of-type').contains('Test Tag')
})
it('should apply correspondent', () => {
cy.intercept('http://localhost:8000/api/documents/*', {
fixture: 'documents/documents_saved.json',
})
cy.get('app-document-card-small:first-of-type').click()
cy.get(
'app-bulk-editor app-filterable-dropdown[title="Correspondent"]'
).within(() => {
cy.contains('button', 'Correspondent').click()
cy.contains('button', 'ABC Test Correspondent').click()
cy.contains('button', 'Apply').click()
})
cy.contains('button', 'Confirm').click()
cy.get('app-document-card-small:first-of-type').contains(
'ABC Test Correspondent'
)
})
it('should apply document type', () => {
cy.intercept('http://localhost:8000/api/documents/*', {
fixture: 'documents/documents_saved.json',
})
cy.get('app-document-card-small:first-of-type').click()
cy.get(
'app-bulk-editor app-filterable-dropdown[title="Document type"]'
).within(() => {
cy.contains('button', 'Document type').click()
cy.contains('button', 'Test Doc Type').click()
cy.contains('button', 'Apply').click()
})
cy.contains('button', 'Confirm').click()
cy.get('app-document-card-small:first-of-type').contains('Test Doc Type')
})
})