File size: 1,129 Bytes
bd87891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// 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');
		});
	});
});