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

[stable] Update build #2710

Merged
merged 41 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
816542f
Collect coverage from cypress component tests.
Hyperkid123 Nov 14, 2023
b9899a3
Merge branch 'master' into cypres-code-coverage
Hyperkid123 Nov 22, 2023
4e16cbd
Use insights text for landing page check.
Hyperkid123 Nov 23, 2023
eaaf92f
Merge pull request #2709 from Hyperkid123/use-different-hit-landing
Hyperkid123 Nov 24, 2023
d94be01
Merge branch 'master' into cypres-code-coverage
Hyperkid123 Nov 24, 2023
ea8d948
Merge pull request #2700 from Hyperkid123/cypres-code-coverage
Hyperkid123 Nov 24, 2023
e394022
Use correct docs api link
karelhala Nov 27, 2023
7e77b8c
Merge pull request #2712 from karelhala/api-docs-redirect
Hyperkid123 Nov 27, 2023
52c2696
Replace Cognito with Keycloak and remove cognito
aneelac22 Nov 27, 2023
5bdd93b
Merge pull request #2708 from aneelac22/feature/remove-cognito
florkbr Nov 27, 2023
2ce74a8
Add new Auth connectors.
Hyperkid123 Nov 22, 2023
4ba6bbf
Generalize JWT auth methods.
Hyperkid123 Nov 22, 2023
e9beb38
Hook chrome UI into the new AUTH API.
Hyperkid123 Nov 22, 2023
221659c
Remove the keycloak-js library.
Hyperkid123 Nov 22, 2023
21e41a5
Update auth tests.
Hyperkid123 Nov 22, 2023
891ddaf
Add missing RHFULL scope handling
Hyperkid123 Nov 23, 2023
7d1c15f
Update cypress snapshot image size.
Hyperkid123 Nov 24, 2023
cafebeb
Adjust KC for itless env.
Hyperkid123 Nov 28, 2023
a894df7
Update sso url for prod itless
aneelac22 Nov 28, 2023
6147125
Merge pull request #2713 from aneelac22/prod-update
aneelac22 Nov 28, 2023
60d3036
Merge branch 'master' into scope-refresh
Hyperkid123 Nov 30, 2023
bbf6b35
Merge pull request #2702 from Hyperkid123/scope-refresh
Hyperkid123 Nov 30, 2023
58c8ae8
OIDC migration hot fix: fix stale user reference when using chrome utils
florkbr Nov 30, 2023
a1449e2
Merge pull request #2715 from florkbr/fix-stale-user-ref-in-chrome-utils
florkbr Nov 30, 2023
0ddf9b1
Bump @adobe/css-tools from 4.3.1 to 4.3.2
dependabot[bot] Dec 1, 2023
341f716
Merge pull request #2716 from RedHatInsights/dependabot/npm_and_yarn/…
Hyperkid123 Dec 1, 2023
0fa923f
Replace user object from redux by chrome auth context value.
Hyperkid123 Dec 1, 2023
995742d
Merge pull request #2717 from Hyperkid123/use-chrome-auth
Hyperkid123 Dec 1, 2023
068400b
Ensure platform URL will always end with trailing /
Hyperkid123 Dec 4, 2023
7031d66
Merge pull request #2719 from Hyperkid123/platform-url
Hyperkid123 Dec 4, 2023
5a8287e
Increase interval for hiding pendo badge on landing page.
Hyperkid123 Dec 4, 2023
29ca371
Merge pull request #2720 from Hyperkid123/hide-pendo-lnaidng-page
Hyperkid123 Dec 4, 2023
2a0a9b6
Update dependencies.
Hyperkid123 Nov 14, 2023
ed0c237
Use jotai for activeModule state managment.
Hyperkid123 Nov 14, 2023
7b15489
Merge pull request #2699 from Hyperkid123/jotai
Hyperkid123 Dec 6, 2023
403f42a
Use active module for global filder disabled flag.
Hyperkid123 Dec 6, 2023
d8e21e7
Merge pull request #2721 from Hyperkid123/enable-global-filter
Hyperkid123 Dec 7, 2023
cc9133a
Remove appId from chrome state.
Hyperkid123 Dec 7, 2023
83c05b9
Merge pull request #2723 from Hyperkid123/remove-app-id
Hyperkid123 Dec 8, 2023
6b2118b
Enable auth header inclusion for openshift API origin.
Hyperkid123 Dec 8, 2023
339cceb
Merge pull request #2725 from Hyperkid123/include-openshift-token
Hyperkid123 Dec 8, 2023
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
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ module.exports = {
rules: {
'react/prop-types': 'off',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true, args: 'after-used' }],
'no-restricted-imports': [
'error',
{
// restrict importing auth packages methods directly
// Use of the ChromeAuthContext must be enforced
paths: [
{
name: 'react-oidc-context',
message: 'Do not import react-oidc-context directly. Use the ChromeAuthContext instead!',
},
{
name: 'oidc-client-ts',
message: 'Do not import oidc-client-ts directly. Use the ChromeAuthContext instead!',
},
],
patterns: [
{
group: ['**/cognito/*'],
message: 'Do not import cognito auth methods directly. Use the ChromeAuthContext instead!',
},
{
group: ['**/OIDCConnector/utils'],
message: 'Do not OIDC auth utils directly. Use the ChromeAuthContext instead!',
},
],
},
],
},
},
],
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Session.vim
.idea/
.vscode/
coverage/
.nyc_output
cypress-coverage

# cypress diff snapshots
cypress/**/*.diff.png
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
include:
- stage: Test
if: branch != nightly
script: npm run circular && npm run lint && npm run test && npx codecov && npm run test:ct
script: npm run circular && npm run lint && npm run test && npm run test:ct && npx codecov
- stage: Deploy prod-stable
if: branch = prod-stable AND type != pull_request
name: deploy:prod-stable
Expand Down
2 changes: 2 additions & 0 deletions config/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { TextDecoder, TextEncoder } from 'util';
import 'whatwg-fetch';

global.SVGPathElement = function () {};

global.MutationObserver = class {
Expand Down
10 changes: 10 additions & 0 deletions config/webpack.cy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ const JSConfig = {
loader: 'swc-loader',
options: {
jsc: {
experimental: {
plugins: [
[
'swc-plugin-coverage-instrument',
{
compact: false,
},
],
],
},
parser: {
syntax: 'typescript',
tsx: true,
Expand Down
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default defineConfig({
launchOptions.preferences.height = 720;
}
});
require('@cypress/code-coverage/task')(on, config);
return config;
},
video: false,
devServer: {
Expand Down
3 changes: 2 additions & 1 deletion cypress/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"cy": "readonly"
},
"rules": {
"react/prop-types": "off"
"react/prop-types": "off",
"no-restricted-imports": "off"
}
}
42 changes: 30 additions & 12 deletions cypress/component/DefaultLayout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,7 @@ import ChromeNavItem from '../../src/components/Navigation/ChromeNavItem';
import { IntlProvider } from 'react-intl';
import { FeatureFlagsProvider } from '../../src/components/FeatureFlags';
import Footer from '../../src/components/Footer/Footer';

const Wrapper = ({ children, store }) => (
<IntlProvider locale="en">
<ScalprumProvider config={{}}>
<Provider store={store}>
<FeatureFlagsProvider>
<BrowserRouter>{children}</BrowserRouter>
</FeatureFlagsProvider>
</Provider>
</ScalprumProvider>
</IntlProvider>
);
import ChromeAuthContext from '../../src/auth/ChromeAuthContext';

const testUser = {
identity: {
Expand All @@ -45,6 +34,35 @@ const testUser = {
},
};

const chromeAuthContextValue = {
doOffline: () => Promise.resolve(),
getOfflineToken: () => Promise.resolve(),
getToken: () => Promise.resolve(''),
getUser: () => Promise.resolve(testUser),
login: () => Promise.resolve(),
loginAllTabs: () => Promise.resolve(),
logout: () => Promise.resolve(),
logoutAllTabs: () => Promise.resolve(),
ready: true,
token: '',
tokenExpires: 0,
user: testUser,
};

const Wrapper = ({ children, store }) => (
<IntlProvider locale="en">
<ChromeAuthContext.Provider value={chromeAuthContextValue}>
<ScalprumProvider config={{}}>
<Provider store={store}>
<FeatureFlagsProvider>
<BrowserRouter>{children}</BrowserRouter>
</FeatureFlagsProvider>
</Provider>
</ScalprumProvider>
</ChromeAuthContext.Provider>
</IntlProvider>
);

const SidebarMock = ({ loaded, schema: { navItems: items } = {} }) => {
if (!loaded) {
return null;
Expand Down
44 changes: 25 additions & 19 deletions cypress/component/GatewayErrors.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,32 @@
import { loadModulesSchema, userLogIn } from '../../src/redux/actions';
import qe from '../../src/utils/iqeEnablement';
import { COMPLIACE_ERROR_CODES } from '../../src/utils/responseInterceptors';
import LibtJWTContext from '../../src/components/LibJWTContext';
import testUserJson from '../fixtures/testUser.json';
import { ChromeUser } from '@redhat-cloud-services/types';
import type { LibJWT } from '../../src/auth';
import { RemoteModule } from '../../src/@types/types';
import { BLOCK_CLEAR_GATEWAY_ERROR } from '../../src/utils/common';
import { initializeVisibilityFunctions } from '../../src/utils/VisibilitySingleton';
import ChromeAuthContext, { ChromeAuthContextValue } from '../../src/auth/ChromeAuthContext';

const testUser: ChromeUser = testUserJson as unknown as ChromeUser;

const chromeUser: ChromeUser = testUser as unknown as ChromeUser;

const chromeAuthContextValue: ChromeAuthContextValue = {
doOffline: () => Promise.resolve(),
getOfflineToken: () => Promise.resolve({} as any),

Check warning on line 28 in cypress/component/GatewayErrors.cy.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 28 in cypress/component/GatewayErrors.cy.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
getToken: () => Promise.resolve(''),
getUser: () => Promise.resolve(chromeUser),
login: () => Promise.resolve(),
loginAllTabs: () => Promise.resolve(),
logout: () => Promise.resolve(),
logoutAllTabs: () => Promise.resolve(),
ready: true,
token: '',
tokenExpires: 0,
user: chromeUser,
};

function createEnv(code?: string) {
if (!code) {
throw 'Enviroment must have identifier';
Expand All @@ -30,7 +46,7 @@
// initialize user object for feature flags
reduxStore.dispatch(userLogIn(testUser));
// initializes request interceptors
qe.init(reduxStore);
qe.init(reduxStore, 'foo');
reduxStore.dispatch(
loadModulesSchema({
[code]: {
Expand All @@ -47,19 +63,9 @@
);

const Component = () => (
<LibtJWTContext.Provider
value={
{
initPromise: Promise.resolve(),
jwt: {
getUserInfo: () => Promise.resolve(),
getEncodedToken: () => '',
},
} as LibJWT
}
>
<MemoryRouter initialEntries={[`/${code}`]}>
<Provider store={reduxStore}>
<MemoryRouter initialEntries={[`/${code}`]}>
<Provider store={reduxStore}>
<ChromeAuthContext.Provider value={chromeAuthContextValue}>
<IntlProvider locale="en">
<FeatureFlagsProvider>
<ScalprumRoot
Expand All @@ -85,9 +91,9 @@
/>
</FeatureFlagsProvider>
</IntlProvider>
</Provider>
</MemoryRouter>
</LibtJWTContext.Provider>
</ChromeAuthContext.Provider>
</Provider>
</MemoryRouter>
);
return Component;
}
Expand Down
Loading
Loading