Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken e2e test runs #2601

Merged
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
4 changes: 3 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export default defineConfig({
// required for the SSO redirect
chromeWebSecurity: false,
video: false,
setupNodeEvents() {
setupNodeEvents(on, config) {
require('cypress-localstorage-commands/plugin')(on, config);
return config;
// implement node event listeners here
},
},
Expand Down
7 changes: 7 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ Cypress.Commands.add('login', () => {
() => {
cy.intercept({ url: '/beta/apps/*', times: 1 }, {});
cy.intercept({ url: '/api/', times: 4 }, {});
// This JS file causes randomly an uncaught exception on login page which blocks the tests
// Cannot read properties of undefined (reading 'setAttribute')
cy.intercept({ url: 'https://sso.stage.redhat.com/auth/resources/0833r/login/rhd-theme/dist/pfelements/bundle.js' }, {});
cy.visit('/');
// disable analytics integrations
cy.setLocalStorage('chrome:analytics:disable', 'true');
cy.setLocalStorage('chrome:segment:disable', 'true');

cy.wait(1000);
// login into the session
cy.get('#username-verification').type(Cypress.env('E2E_USER'));
Expand Down
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// Import commands.js using ES2015 syntax:
import './commands';
import 'cypress-localstorage-commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.3",
"cypress": "^12.7.0",
"cypress-localstorage-commands": "^2.2.3",
"eslint": "^8.35.0",
"fork-ts-checker-webpack-plugin": "^7.3.0",
"git-revision-webpack-plugin": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/SegmentProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const SegmentProvider: React.FC<SegmentProviderProps> = ({ activeModule, childre
}
analytics.current = AnalyticsBrowser.load(
{ writeKey: newKey },
{ initialPageview: false, disableClientPersistence: true, integrations: { All: !isITLessEnv } }
{ initialPageview: false, disableClientPersistence: true, integrations: { All: !isITLessEnv && !disableIntegrations } }
);
window.segment = analytics.current;
resetIntegrations(analytics.current);
Expand Down
Loading