Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/packages/console-app/console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
"importRedirectURL": { "$codeRef": "perspective.getImportRedirectURL" }
}
},
{
"type": "console.flag",
"properties": {
"handler": { "$codeRef": "detectIntegrationTest.handler" }
}
},
{
"type": "INTERNAL_DO_NOT_USE.guided-tour",
"properties": {
"perspective": "admin",
"tour": { "$codeRef": "getGuidedTour" }
},
"flags": {
"disallowed": ["INTEGRATION_TEST"]
}
},
{
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/console-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"consolePlugin": {
"exposedModules": {
"detectIntegrationTest": "src/features/integration-test.ts",
"tourContext": "src/components/tour/tour-context.ts",
"quickStartContext": "src/components/quick-starts/utils/quick-start-context.tsx",
"quickStartConfiguration": "src/components/quick-starts/QuickStartConfiguration.tsx",
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/console-app/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const ACM_PERSPECTIVE_ID = 'acm';
export const ADMIN_PERSPECTIVE_ID = 'admin';
export const FLAG_CAN_GET_CONSOLE_OPERATOR_CONFIG = 'CAN_GET_CONSOLE_OPERATOR_CONFIG';
export const FLAG_TECH_PREVIEW = 'TECH_PREVIEW';
export const FLAG_INTEGRATION_TEST = 'INTEGRATION_TEST';

export const FAVORITES_CONFIG_MAP_KEY = 'console.favorites';
export const FAVORITES_LOCAL_STORAGE_KEY = `${STORAGE_PREFIX}/favorites`;
18 changes: 18 additions & 0 deletions frontend/packages/console-app/src/features/integration-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { FeatureFlagHandler } from '@console/dynamic-plugin-sdk/src/extensions/feature-flags';
import { FLAG_INTEGRATION_TEST } from '../consts';

const INTEGRATION_TEST_USER_AGENT = 'ConsoleIntegrationTestEnvironment';

/**
* Detect Cypress via a custom user agent we set in `cypress.config.js` in
* each cypress run configuration.
*
* This is used to disable certain features during integration tests to
* increase test reliability.
*/
export const handler: FeatureFlagHandler = (callback) => {
const userAgent = window.navigator.userAgent ?? '';

// No need to watch this as user agent cannot change during a session
callback(FLAG_INTEGRATION_TEST, userAgent === INTEGRATION_TEST_USER_AGENT);
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ module.exports = defineConfig({
experimentalMemoryManagement: true,
numTestsKeptInMemory: 5,
injectDocumentDomain: true,
userAgent: 'ConsoleIntegrationTestEnvironment',
},
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';

/* eslint-disable no-console, promise/catch-or-return */
before(() => {
cy.login();
cy.document().its('readyState').should('eq', 'complete');
guidedTour.close();
});

after(() => {
Expand Down
3 changes: 3 additions & 0 deletions frontend/packages/dev-console/console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"properties": {
"perspective": "dev",
"tour": { "$codeRef": "getGuidedTour" }
},
"flags": {
"disallowed": ["INTEGRATION_TEST"]
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ module.exports = defineConfig({
experimentalMemoryManagement: true,
numTestsKeptInMemory: 5,
injectDocumentDomain: true,
userAgent: 'ConsoleIntegrationTestEnvironment',
},
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@getting-started @dev-console
# Guided tour is disabled in cypress due to endless flakes
@getting-started @dev-console @manual
Feature: Getting Started tour of developer perspective
As a user I want to take tour of developer perspective

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { modal } from '@console/cypress-integration-tests/views/modal';
import { nav } from '@console/cypress-integration-tests/views/nav';
import { topologyPO } from '@console/topology/integration-tests/support/page-objects/topology-po';
Expand Down Expand Up @@ -53,7 +52,6 @@ export const perspective = {
nav.sidenav.switcher.changePerspectiveTo(perspectiveName);
app.waitForLoad();
if (perspectiveName === switchPerspective.Developer) {
guidedTour.close();
// Commenting below line, because due to this pipeline runs feature file is failing
// cy.testA11y('Developer perspective');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';

export const checkDeveloperPerspective = () => {
guidedTour.close();
cy.get('body').then(($body) => {
cy.byLegacyTestID('perspective-switcher-toggle').then(($switcher) => {
// switcher is present
Expand Down Expand Up @@ -32,7 +29,5 @@ export const checkDeveloperPerspective = () => {
cy.document().its('readyState').should('eq', 'complete');
cy.log('perspective switcher menu refreshed');
});

guidedTour.close();
});
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { topologyPage } from '@console/topology/integration-tests/support/pages/topology';
import { devNavigationMenu, addOptions, pageTitle } from '../../constants';
import { formPO, topologyPO } from '../../pageObjects';
import { addPage, gitPage } from '../add-flow';
import { createForm, navigateTo } from '../app';

export const selectImportFromGitQuickCreate = () => {
guidedTour.close();
cy.get('[data-test="quick-create-dropdown"]').click();
cy.get('[data-test="qc-import-from-git"] [role="menuitem"]')
.should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { modal } from '@console/cypress-integration-tests/views/modal';
import { nav } from '@console/cypress-integration-tests/views/nav';
import { switchPerspective, devNavigationMenu, adminNavigationMenu } from '../../constants';
Expand All @@ -14,15 +13,13 @@ Given('user has logged in as a basic user', () => {
const password = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
cy.login(idp, username, password);
app.waitForLoad();
guidedTour.close();
});

Given('user is at developer perspective', () => {
checkDeveloperPerspective();
perspective.switchTo(switchPerspective.Developer);
// Due to bug ODC-6231
// cy.testA11y('Developer perspective with guide tour modal');
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
// Commenting below line, because it is executing on every test scenario - we will remove this in future releases
// cy.testA11y('Developer perspective');
Expand Down Expand Up @@ -66,7 +63,6 @@ Given('user is at namespace {string}', (projectName: string) => {

When('user switches to developer perspective', () => {
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
});

When('user selects {string} option from Actions menu', (option: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Given } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { operators } from '../../constants';
import {
installPipelinesOperatorUsingCLI,
Expand All @@ -26,7 +25,6 @@ Given(
(operator: operators, namespace: string) => {
cy.logout();
cy.login(); // make sure we are logged in as kubeadmin
guidedTour.close();
verifyAndInstallOperator(operator, namespace);
},
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { nav } from '@console/cypress-integration-tests/views/nav';
import { switchPerspective } from '../../constants';
import { app, perspective } from '../../pages';

Given('user has logged in as admin user', () => {
cy.login();
perspective.switchTo(switchPerspective.Administrator);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Administrator);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { nav } from '@console/cypress-integration-tests/views/nav';
import { devNavigationMenu, switchPerspective } from '../../constants';
import { topologyPO } from '../../pageObjects';
Expand Down Expand Up @@ -40,7 +39,6 @@ When(
detailsPage.titleShouldContain('Edit health checks');
cy.get('.odc-heath-check-probe__successText').should('have.length', 3);
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
navigateTo(devNavigationMenu.Topology);
},
Expand All @@ -55,7 +53,6 @@ Then(
detailsPage.titleShouldContain('Edit health checks');
cy.get('.odc-heath-check-probe__successText').contains(`${probe} added`).should('be.visible');
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
navigateTo(devNavigationMenu.Topology);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { nav } from '@console/cypress-integration-tests/views/nav';
import {
topologyPage,
Expand All @@ -19,7 +18,6 @@ When('user applies cronjob YAML', () => {

Then('user will see cron job with name {string} on topology page', (name: string) => {
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
topologyPage.verifyWorkloadInTopologyPage(`${name}`);
});
Expand All @@ -30,7 +28,6 @@ When('user applies job YAML', () => {

Then('user will see job with name {string} on topology page', (name: string) => {
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
topologyPage.verifyWorkloadInTopologyPage(`${name}`);
});
Expand All @@ -41,7 +38,6 @@ When('user applies pod YAML', () => {

Then('user will see pod with name {string} on topology page', (name: string) => {
perspective.switchTo(switchPerspective.Developer);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Developer);
topologyPage.verifyWorkloadInTopologyPage(`${name}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ module.exports = defineConfig({
experimentalMemoryManagement: true,
numTestsKeptInMemory: 5,
injectDocumentDomain: true,
userAgent: 'ConsoleIntegrationTestEnvironment',
},
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';

// To ignore the resizeObserverLoopErrors on CI, adding below code
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
/* eslint-disable consistent-return */
Expand All @@ -22,7 +20,6 @@ before(() => {
});
// Default helm repo has been changed to a new repo, so executing below line to fix that issue
cy.exec('oc apply -f test-data/red-hat-helm-charts.yaml');
guidedTour.close();
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { modal } from '@console/cypress-integration-tests/views/modal';
import { nav } from '@console/cypress-integration-tests/views/nav';
import {
Expand Down Expand Up @@ -120,6 +119,5 @@ Given('user is at Add page', () => {
Given('user has logged in as admin user', () => {
cy.login();
perspective.switchTo(switchPerspective.Administrator);
guidedTour.close();
nav.sidenav.switcher.shouldHaveText(switchPerspective.Administrator);
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ module.exports = defineConfig({
experimentalMemoryManagement: true,
numTestsKeptInMemory: 5,
injectDocumentDomain: true,
userAgent: 'ConsoleIntegrationTestEnvironment',
},
});
4 changes: 0 additions & 4 deletions frontend/packages/integration-tests-cypress/support/admin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { guidedTour } from '../views/guided-tour';
import { nav } from '../views/nav';

declare global {
Expand All @@ -19,7 +18,6 @@ Cypress.Commands.add('initAdmin', () => {
cy.log('ensure perspective switcher is set to Core platform');
nav.sidenav.switcher.changePerspectiveTo('Core platform');
nav.sidenav.switcher.shouldHaveText('Core platform');
guidedTour.close();
});

Cypress.Commands.add('initDeveloper', () => {
Expand All @@ -28,10 +26,8 @@ Cypress.Commands.add('initDeveloper', () => {
cy.byTestID('loading-indicator').should('not.exist');
cy.document().its('readyState').should('eq', 'complete');
cy.log('ensure perspective switcher is set to Developer');
guidedTour.close();
nav.sidenav.switcher.changePerspectiveTo('Developer');
cy.log('switched perspective to Developer');
nav.sidenav.switcher.shouldHaveText('Developer');
cy.log('Developer perspective confirmed ');
guidedTour.close();
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { checkErrors, testName } from '../../support';
import { detailsPage } from '../../views/details-page';
import { guidedTour } from '../../views/guided-tour';
import * as yamlEditor from '../../views/yaml-editor';

const POD_NAME = 'pod1';
Expand Down Expand Up @@ -68,7 +67,7 @@ spec:
capabilities:
drop:
- ALL
---
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -107,7 +106,6 @@ spec:
describe('Admission Webhook warning notification', () => {
before(() => {
cy.login();
guidedTour.close();
cy.createProjectWithCLI(testName);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { checkErrors } from '../../support';
import { guidedTour } from '../../views/guided-tour';
import { masthead } from '../../views/masthead';
import { nav } from '../../views/nav';

Expand All @@ -25,10 +24,8 @@ describe('Auth test', () => {
cy.login(idp, username, passwd);
cy.url().should('include', Cypress.config('baseUrl'));

// test Developer perspective is default for test user and guided tour is displayed
// test Developer perspective is default for test user
// Below line to be uncommented after pr https://github.com/openshift/console-operator/pull/954 is merged
guidedTour.isOpen();
guidedTour.close();
masthead.username.shouldHaveText(username);

cy.log('switches from dev to admin perspective');
Expand Down Expand Up @@ -72,8 +69,6 @@ describe('Auth test', () => {
if (!Cypress.config('baseUrl').includes('localhost')) {
// nav.sidenav.switcher.changePerspectiveTo('Developer');
// nav.sidenav.switcher.shouldHaveText('Developer');
guidedTour.isOpen();
guidedTour.close();
nav.sidenav.switcher.changePerspectiveTo('Core platform');
nav.sidenav.switcher.shouldHaveText('Core platform');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { checkErrors, testName } from '../../support';
import { detailsPage } from '../../views/details-page';
import { guidedTour } from '../../views/guided-tour';
import { listPage } from '../../views/list-page';
import * as yamlEditor from '../../views/yaml-editor';

Expand Down Expand Up @@ -29,7 +28,6 @@ spec:
describe('Debug pod', () => {
before(() => {
cy.login();
guidedTour.close();
cy.createProjectWithCLI(testName);
});

Expand Down
Loading