enh: add e2e tests for document list

This commit is contained in:
Jonathan Rohde
2024-07-18 14:47:04 +02:00
parent 7e03624408
commit c6eba8c0a1
5 changed files with 102 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../support/index.d.ts" />
describe('Documents', () => {
const timestamp = Date.now();
before(() => {
cy.uploadTestDocument(timestamp);
});
after(() => {
cy.deleteTestDocument(timestamp);
});
context('Admin', () => {
beforeEach(() => {
// Login as the admin user
cy.loginAdmin();
// Visit the home page
cy.visit('/workspace/documents');
cy.get('button').contains('#cypress-test').click();
});
it('can see documents', () => {
cy.get('div').contains(`document-test-initial-${timestamp}.txt`).should('have.length', 1);
});
it('can see edit button', () => {
cy.get('div')
.contains(`document-test-initial-${timestamp}.txt`)
.get("button[aria-label='Edit Doc']")
.should('exist');
});
it('can see delete button', () => {
cy.get('div')
.contains(`document-test-initial-${timestamp}.txt`)
.get("button[aria-label='Delete Doc']")
.should('exist');
});
it('can see upload button', () => {
cy.get("button[aria-label='Add Docs']").should('exist');
});
});
});