-
Notifications
You must be signed in to change notification settings - Fork 737
Expand file tree
/
Copy pathsource.cy.ts
More file actions
113 lines (98 loc) · 4.16 KB
/
Copy pathsource.cy.ts
File metadata and controls
113 lines (98 loc) · 4.16 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import { checkErrors, testName } from '../../../support';
import { detailsPage } from '../../../views/details-page';
import { secrets } from '../../../views/secret';
describe('Source secrets', () => {
const basicSourceSecretName = `basic-source-secret-${testName}`;
const basicSourceSecretUsername = 'username';
const basicSourceSecretUsernameUpdated = 'usernameUpdated';
const basicSourceSecretPassword = 'password';
const basicSourceSecretPasswordUpdated = 'passwordUpdated';
const sshSourceSecretName = `ssh-source-secret-${testName}`;
const sshSourceSecretSSHKey = 'sshKey';
const sshSourceSecretSSHKeUpdated = 'sshKeyUpdated';
before(() => {
cy.login();
cy.createProjectWithCLI(testName);
});
beforeEach(() => {
// ensure the test project is selected to avoid flakes
cy.visit(`/k8s/cluster/projects/${testName}`);
cy.visit(`/k8s/ns/${testName}/secrets/`);
secrets.clickCreateSecretDropdownButton('source');
});
afterEach(() => {
cy.exec(`oc delete secret -n ${testName} ${basicSourceSecretName} ${sshSourceSecretName}`, {
failOnNonZeroExit: false,
});
checkErrors();
});
after(() => {
cy.deleteProjectWithCLI(testName);
});
xit(`Creates, edits, and deletes a basic source secret`, () => {
cy.log('Create secret');
cy.byTestID('page-heading').contains('Create source secret');
secrets.enterSecretName(basicSourceSecretName);
cy.byTestID('secret-username').type(basicSourceSecretUsername);
cy.byTestID('secret-password').type(basicSourceSecretPassword);
secrets.save();
cy.byTestID('loading-indicator').should('not.exist');
secrets.detailsPageIsLoaded(basicSourceSecretName);
cy.log('Verify secret');
secrets.checkSecret({
password: basicSourceSecretPassword,
username: basicSourceSecretUsername,
});
cy.log('Edit secret');
detailsPage.clickPageActionFromDropdown('Edit Secret');
// Wait for form to load and hydrate with current values
cy.byTestID('page-heading').contains('Edit source secret');
cy.byTestID('secret-username').should('have.value', basicSourceSecretUsername);
cy.byTestID('secret-password').should('have.value', basicSourceSecretPassword);
cy.byTestID('secret-username').clear();
cy.byTestID('secret-username').type(basicSourceSecretUsernameUpdated);
cy.byTestID('secret-password').clear();
cy.byTestID('secret-password').type(basicSourceSecretPasswordUpdated);
secrets.save();
cy.byTestID('loading-indicator').should('not.exist');
cy.log('Verify edit');
secrets.detailsPageIsLoaded(basicSourceSecretName);
secrets.checkSecret({
password: basicSourceSecretPasswordUpdated,
username: basicSourceSecretUsernameUpdated,
});
cy.log('Delete secret');
secrets.deleteSecret(basicSourceSecretName);
});
it(`Creates, edits, and deletes a SSH source secret`, () => {
cy.log('Create secret');
cy.byTestID('page-heading').contains('Create source secret');
secrets.enterSecretName(sshSourceSecretName);
cy.byLegacyTestID('dropdown-button').click();
cy.byTestDropDownMenu('kubernetes.io/ssh-auth').click();
cy.byLegacyTestID('file-input-textarea').type(sshSourceSecretSSHKey);
secrets.save();
cy.byTestID('loading-indicator').should('not.exist');
secrets.detailsPageIsLoaded(sshSourceSecretName);
cy.log('Verify secret');
secrets.checkSecret({
'ssh-privatekey': sshSourceSecretSSHKey,
});
cy.log('Edit secret');
detailsPage.clickPageActionFromDropdown('Edit Secret');
// Wait for form to load and hydrate with current values
cy.byTestID('page-heading').contains('Edit source secret');
cy.byLegacyTestID('file-input-textarea').should('contain.value', sshSourceSecretSSHKey);
cy.byLegacyTestID('file-input-textarea').clear();
cy.byLegacyTestID('file-input-textarea').type(sshSourceSecretSSHKeUpdated);
secrets.save();
cy.byTestID('loading-indicator').should('not.exist');
cy.log('Verify edit');
secrets.detailsPageIsLoaded(sshSourceSecretName);
secrets.checkSecret({
'ssh-privatekey': sshSourceSecretSSHKeUpdated,
});
cy.log('Delete secret');
secrets.deleteSecret(sshSourceSecretName);
});
});