Skip to content

Commit 751a00a

Browse files
Merge pull request #2049 from alfonsomthd/cs-4.19
E2E: upgrade CatalogSource to 4.19
2 parents 21445e8 + 7c4ea20 commit 751a00a

File tree

8 files changed

+195
-197
lines changed

8 files changed

+195
-197
lines changed

cypress/support/login.ts

Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { KUBEADMIN_IDP, KUBEADMIN_USERNAME } from '../consts';
1+
import { KUBEADMIN_IDP, KUBEADMIN_USERNAME, SECOND } from '../consts';
22
import { submitButton, masthead } from './views';
33

44
declare global {
@@ -9,7 +9,6 @@ declare global {
99
username?: string,
1010
password?: string
1111
): Chainable<Element>;
12-
logout(): Chainable<Element>;
1312
}
1413
}
1514
}
@@ -25,68 +24,77 @@ Cypress.Commands.add(
2524

2625
cy.window().then((win: any) => {
2726
if (win.SERVER_FLAGS?.authDisabled) {
28-
cy.task(
29-
'log',
30-
' skipping login, console is running with auth disabled'
31-
);
32-
return;
33-
}
34-
35-
cy.origin(
36-
Cypress.env('OAUTH_BASE_ADDRESS'),
37-
{
38-
args: {
27+
cy.log('Skipping login, console is running with auth disabled');
28+
} else {
29+
cy.origin(
30+
Cypress.env('OAUTH_BASE_ADDRESS'),
31+
{
32+
args: {
33+
provider,
34+
username,
35+
password,
36+
KUBEADMIN_IDP,
37+
KUBEADMIN_USERNAME,
38+
SECOND,
39+
submitButton,
40+
},
41+
},
42+
({
43+
/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/naming-convention */
3944
provider,
4045
username,
4146
password,
4247
KUBEADMIN_IDP,
4348
KUBEADMIN_USERNAME,
49+
SECOND,
4450
submitButton,
45-
},
46-
},
47-
({
48-
/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/naming-convention */
49-
provider,
50-
username,
51-
password,
52-
KUBEADMIN_IDP,
53-
KUBEADMIN_USERNAME,
54-
submitButton,
55-
/* eslint-enable @typescript-eslint/no-shadow, @typescript-eslint/naming-convention */
56-
}) => {
57-
const idp = provider || KUBEADMIN_IDP;
51+
/* eslint-enable @typescript-eslint/no-shadow, @typescript-eslint/naming-convention */
52+
}) => {
53+
const idp = provider || KUBEADMIN_IDP;
5854

59-
cy.task(
60-
'log',
61-
` Logging in as ${username || KUBEADMIN_USERNAME}`
62-
);
63-
cy.get('[data-test-id="login"]', { timeout: 10000 }).should(
64-
'be.visible'
65-
);
55+
cy.log(`Logging in as ${username || KUBEADMIN_USERNAME}`);
56+
// We cannot use byLegacyTestID here.
57+
cy.get('[data-test-id="login"]', {
58+
timeout: 10 * SECOND,
59+
}).should('be.visible');
6660

67-
// eslint-disable-next-line cypress/require-data-selectors
68-
cy.get('body').then(($body) => {
69-
if ($body.text().includes(idp)) {
70-
cy.contains(idp).should('be.visible').click();
71-
}
72-
});
61+
// eslint-disable-next-line cypress/require-data-selectors
62+
cy.get('body').then(($body) => {
63+
if ($body.text().includes(idp)) {
64+
cy.contains(idp).should('be.visible').click();
65+
}
66+
});
7367

74-
/* eslint-disable cypress/require-data-selectors */
75-
cy.get('#inputUsername').type(username || KUBEADMIN_USERNAME);
76-
cy.get('#inputPassword').type(
77-
password || Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'),
78-
{
79-
log: false,
80-
}
81-
);
82-
cy.get(submitButton).click();
83-
}
84-
);
68+
/* eslint-disable cypress/require-data-selectors */
69+
cy.get('#inputUsername').type(username || KUBEADMIN_USERNAME);
70+
cy.get('#inputPassword').type(
71+
password || Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'),
72+
{
73+
log: false,
74+
}
75+
);
76+
cy.get(submitButton).click();
77+
}
78+
);
8579

86-
// Back to the console's origin and ensure user is logged in.
87-
cy.visit('');
88-
/* eslint-enable cypress/require-data-selectors */
89-
masthead.username.shouldBeVisible();
80+
// Ensure the user is logged in.
81+
/* eslint-enable cypress/require-data-selectors */
82+
masthead.username.shouldBeVisible();
83+
}
84+
85+
// Close console tour modal.
86+
cy.byTestID('detail-item-title')
87+
.contains('Cluster API address')
88+
.should('be.visible');
89+
// eslint-disable-next-line cypress/require-data-selectors
90+
cy.get('body').then(($body) => {
91+
if ($body.find(`[data-test="guided-tour-modal"]`).length > 0) {
92+
cy.byTestID('tour-step-footer-secondary')
93+
.contains('Skip tour')
94+
.click();
95+
cy.byTestID('guided-tour-modal').should('not.exist');
96+
}
97+
});
9098
});
9199
},
92100
{ cacheAcrossSpecs: true }

cypress/support/views.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
export const submitButton = 'button[type=submit]';
22
export const masthead = {
33
username: {
4-
shouldBeVisible: () =>
5-
cy
6-
.byTestID(
7-
Cypress.env('BRIDGE_KUBEADMIN_PASSWORD')
8-
? 'user-dropdown'
9-
: 'username'
10-
)
11-
.should('be.visible'),
4+
shouldBeVisible: () => cy.byTestID('username').should('be.visible'),
125
shouldHaveText: (text: string) =>
13-
cy
14-
.byTestID(
15-
Cypress.env('BRIDGE_KUBEADMIN_PASSWORD')
16-
? 'user-dropdown'
17-
: 'username'
18-
)
19-
.should('have.text', text),
6+
cy.byTestID('username').should('have.text', text),
207
},
218
clickMastheadLink: (path: string) => {
229
return cy.byTestID(path).click();

cypress/tests/add-capacity.spec.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ describe('OCS Operator Expansion of Storage Class Test', () => {
8888
];
8989
const replicas =
9090
initialState.storageCluster?.spec?.storageDeviceSets?.[0]?.replica;
91+
const provisionedCapacity = initialCapacity * replicas;
9192
cy.byTestID('requestSize').should('have.value', String(initialCapacity));
9293
cy.byTestID('provisioned-capacity').contains(
93-
`${(initialCapacity * replicas).toFixed(0)} TiB`
94+
`${Number.isInteger(provisionedCapacity) ? provisionedCapacity : provisionedCapacity.toFixed(2)} TiB`
9495
);
9596
cy.byTestID('add-cap-sc-dropdown', { timeout: 10000 }).should(
9697
'be.visible'
@@ -100,14 +101,9 @@ describe('OCS Operator Expansion of Storage Class Test', () => {
100101

101102
ODFCommon.visitStorageDashboard();
102103
ODFCommon.visitStorageSystemList();
103-
// Wait for the storage cluster to reach Ready
104-
// Storage Cluster CR flickers so wait for 10 seconds
105-
// Disablng until ocs-operator fixes above issue
106-
// eslint-disable-next-line cypress/no-unnecessary-waiting
107-
cy.wait(10000);
108-
// eslint-disable-next-line cypress/require-data-selectors
109-
cy.get('td[id="status"]', { timeout: 5 * MINUTE }).contains('Ready', {
110-
timeout: 900000,
104+
105+
cy.get('[data-label="status"]').contains('Ready', {
106+
timeout: 20 * MINUTE,
111107
});
112108
});
113109
cy.exec(

cypress/tests/storage-pool-in-storageclass-form.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
showAvailablePoolsInSCForm,
1515
} from '../views/storage-pool';
1616

17-
describe('Test storage pool creation when creating a new StorageClass', () => {
17+
// Skip until https://issues.redhat.com/browse/DFBUGS-2139 is fixed.
18+
describe.skip('Storage pool creation when creating a new StorageClass', () => {
1819
beforeEach(() => {
1920
cy.clickNavLink(['Storage', 'StorageClasses']);
2021
cy.byTestID('item-create').click();

0 commit comments

Comments
 (0)