documents.cy.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // eslint-disable-next-line @typescript-eslint/triple-slash-reference
  2. /// <reference path="../support/index.d.ts" />
  3. describe('Documents', () => {
  4. const timestamp = Date.now();
  5. before(() => {
  6. cy.uploadTestDocument(timestamp);
  7. });
  8. after(() => {
  9. cy.deleteTestDocument(timestamp);
  10. });
  11. context('Admin', () => {
  12. beforeEach(() => {
  13. // Login as the admin user
  14. cy.loginAdmin();
  15. // Visit the home page
  16. cy.visit('/workspace/documents');
  17. cy.get('button').contains('#cypress-test').click();
  18. });
  19. it('can see documents', () => {
  20. cy.get('div').contains(`document-test-initial-${timestamp}.txt`).should('have.length', 1);
  21. });
  22. it('can see edit button', () => {
  23. cy.get('div')
  24. .contains(`document-test-initial-${timestamp}.txt`)
  25. .get("button[aria-label='Edit Doc']")
  26. .should('exist');
  27. });
  28. it('can see delete button', () => {
  29. cy.get('div')
  30. .contains(`document-test-initial-${timestamp}.txt`)
  31. .get("button[aria-label='Delete Doc']")
  32. .should('exist');
  33. });
  34. it('can see upload button', () => {
  35. cy.get("button[aria-label='Add Docs']").should('exist');
  36. });
  37. });
  38. });