-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathEnvOverviewAction.ts
More file actions
61 lines (48 loc) · 1.92 KB
/
EnvOverviewAction.ts
File metadata and controls
61 lines (48 loc) · 1.92 KB
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
57
58
59
60
61
import EnvOverviewRepository from 'cypress/support/repositories/envOverview/EnvOverviewRepository';
const environment = new EnvOverviewRepository();
export default class EnvOverviewAction {
doEnvTypeCheck() {
environment.getEnvType().should('have.text', 'production');
}
doDeployTypeCheck() {
environment.getDeployType().should('have.text', 'branch');
}
doSourceCheck() {
environment.getSource().should($anchorTag => {
expect($anchorTag).to.have.attr('target', '_blank');
expect($anchorTag).to.have.attr('href', 'https://example.com/git/lagoon-demo/tree/main');
});
}
doRoutesCheck() {
environment.getRoutes().each(($element, index) => {
cy.wrap($element)
.find('a')
.should('have.attr', 'href')
.and(
'eq',
index === 0 ? 'https://lagoondemo.example.org' : 'https://nginx.main.lagoon-demo.ui-kubernetes.lagoon.sh'
);
});
}
doDeleteEnvironment(branch: string) {
environment.getDeleteButton().click();
cy.getBySel('confirm-input').type(branch);
environment.getDeleteButtonConfirm().click();
cy.wait('@gqldeleteEnvironmentMutation');
cy.url().should('include', '/projects/lagoon-demo');
}
doDeleteEnvironmentError(branch: string) {
environment.getDeleteButton().click();
cy.getBySel('confirm-input').type(branch);
environment.getDeleteButtonConfirm().click();
const errorMessage = `Unauthorized: You don\'t have permission to "delete:${
branch === 'main' ? 'production' : 'development'
}" on "environment"`;
cy.wait('@gqldeleteEnvironmentMutation').then(interception => {
expect(interception.response?.statusCode).to.eq(200);
expect(interception.response?.body).to.have.property('errors');
cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage });
});
environment.getDeleteInfo().invoke('text').should('eq', errorMessage);
}
}