forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project-context-menu_spec.js
56 lines (49 loc) · 2.1 KB
/
project-context-menu_spec.js
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
48
49
50
51
52
53
54
55
56
/*******************************************************************************
* Copyright (c) 2021, 2023 Obeo.
* This program and the accompanying materials
* are made available under the erms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
describe('/projects/:projectId/edit - Project Context Menu', () => {
beforeEach(() => {
cy.deleteAllProjects();
cy.createProject('Cypress Project').then((res) => {
const projectId = res.body.data.createProject.project.id;
cy.visit(`/projects/${projectId}/edit`);
});
});
it('shows the project context menu and hides it by clicking outside', () => {
cy.getByTestId('more').click({ force: true });
cy.getByTestId('navbar-contextmenu').should('be.visible');
cy.get('body').click();
cy.getByTestId('navbar-contextmenu').should('not.exist');
});
it('shows the project context menu and hides it by typing esc', () => {
cy.getByTestId('more').click({ force: true });
cy.getByTestId('navbar-contextmenu').should('be.visible');
cy.getByTestId('navbar-contextmenu').type('{esc}');
cy.getByTestId('navbar-contextmenu').should('not.exist');
});
it('contains a download link', () => {
cy.getByTestId('more').click();
cy.getByTestId('download-link').should('have.attr', 'href');
});
it('can open the delete project modal', () => {
cy.getByTestId('more').click();
cy.getByTestId('navbar-contextmenu').findByTestId('delete').click();
cy.get('.MuiDialog-container').should('be.visible');
cy.getByTestId('navbar-contextmenu').should('not.be.visible');
});
it('can delete a project', () => {
cy.getByTestId('more').click();
cy.getByTestId('navbar-contextmenu').findByTestId('delete').click();
cy.getByTestId('delete-project').click();
cy.url().should('match', new RegExp(Cypress.config().baseUrl + '/projects'));
});
});