Skip to content

Commit 38dc347

Browse files
committed
Fix integration tests (WIP)
1 parent a1b5b6a commit 38dc347

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

integration-tests/cypress.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ module.exports = defineConfig({
2323
specPattern: 'tests/**/*.cy.{js,jsx,ts,tsx}',
2424
supportFile: 'support/index.ts',
2525
},
26-
});
26+
});

integration-tests/plugins/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as wp from '@cypress/webpack-preprocessor';
1+
import wp from '@cypress/webpack-preprocessor';
22

33
module.exports = (on, config) => {
44
const options = {

integration-tests/support/login.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ declare global {
88
}
99

1010
const KUBEADMIN_USERNAME = 'kubeadmin';
11-
const loginUsername = Cypress.env('BRIDGE_KUBEADMIN_PASSWORD') ? 'user-dropdown' : 'username';
1211

1312
// This will add 'cy.login(...)'
1413
// ex: cy.login('my-user', 'my-password')
@@ -27,7 +26,7 @@ Cypress.Commands.add('login', (username: string, password: string) => {
2726
cy.get('#inputPassword').type(password || Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'));
2827
cy.get('button[type=submit]').click();
2928

30-
cy.get(`[data-test="${loginUsername}"]`).should('be.visible');
29+
cy.get('[data-test="username"]').should('be.visible');
3130
});
3231
});
3332

@@ -37,8 +36,8 @@ Cypress.Commands.add('logout', () => {
3736
if (win.SERVER_FLAGS?.authDisabled) {
3837
return;
3938
}
40-
cy.get('[data-test="user-dropdown"]').click();
39+
cy.get('[data-test="username"]').click();
4140
cy.get('[data-test="log-out"]').should('be.visible');
4241
cy.get('[data-test="log-out"]').click({ force: true });
4342
});
44-
});
43+
});

integration-tests/tests/example-page.cy.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ const PLUGIN_TEMPLATE_NAME = 'camel-openshift-console-plugin';
44
const PLUGIN_TEMPLATE_PULL_SPEC = Cypress.env('PLUGIN_TEMPLATE_PULL_SPEC');
55
export const isLocalDevEnvironment = Cypress.config('baseUrl').includes('localhost');
66

7+
export const guidedTour = {
8+
close: () => {
9+
cy.get('body').then(($body) => {
10+
if ($body.find(`[data-test="guided-tour-modal"]`).length > 0) {
11+
cy.get(`[data-test="tour-step-footer-secondary"]`).contains('Skip tour').click();
12+
}
13+
});
14+
},
15+
isOpen: () => {
16+
cy.get('body').then(($body) => {
17+
if ($body.find(`[data-test="guided-tour-modal"]`).length > 0) {
18+
cy.get(`[data-test="guided-tour-modal"]`).should('be.visible');
19+
}
20+
});
21+
},
22+
};
23+
724
const installHelmChart = (path: string) => {
825
cy.exec(
926
`cd ../../camel-openshift-console-plugin && ${path} upgrade -i ${PLUGIN_TEMPLATE_NAME} charts/camel-openshift-console-plugin -n ${PLUGIN_TEMPLATE_NAME} --create-namespace --set plugin.image=${PLUGIN_TEMPLATE_PULL_SPEC}`,
@@ -35,7 +52,8 @@ const deleteHelmChart = (path: string) => {
3552
describe('Console plugin template test', () => {
3653
before(() => {
3754
cy.login();
38-
55+
guidedTour.isOpen();
56+
guidedTour.close();
3957
if (!isLocalDevEnvironment) {
4058
console.log('this is not a local env, installig helm');
4159

@@ -73,4 +91,4 @@ describe('Console plugin template test', () => {
7391
cy.url().should('include', '/example');
7492
cy.get('[data-test="example-page-title"]').should('contain', 'Hello, Plugin!');
7593
});
76-
});
94+
});

start-console.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ if [ -x "$(command -v podman)" ]; then
5151
else
5252
BRIDGE_PLUGINS="${PLUGIN_NAME}=http://host.docker.internal:9001"
5353
docker run --pull always --platform $CONSOLE_IMAGE_PLATFORM --rm -p "$CONSOLE_PORT":9000 --env-file <(set | grep BRIDGE) $CONSOLE_IMAGE
54-
fi
54+
fi

0 commit comments

Comments
 (0)