SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
FE(UI):Channels test (#417)
pal-sig3ed4fb2b75e7
diff --git a/frontend/cypress/fixtures/defaultAllChannels.json b/frontend/cypress/fixtures/defaultAllChannels.jsonnew file mode 100644index 0000000000..c292bc1f2d--- /dev/null+++ b/frontend/cypress/fixtures/defaultAllChannels.json@@ -0,0 +1,21 @@+{+ "data": [+ {+ "created_at": 1638083159246,+ "data": "{}",+ "id": 1,+ "name": "First Channels",+ "type": "slack",+ "updated_at": 1638083159246+ },+ {+ "created_at": 1638083159246,+ "data": "{}",+ "id": 2,+ "name": "Second Channels",+ "type": "Slack",+ "updated_at": 1638083159246+ }+ ],+ "message": "Success"+}diff --git a/frontend/cypress/integration/channels/index.spec.ts b/frontend/cypress/integration/channels/index.spec.tsnew file mode 100644index 0000000000..e54ed4757f--- /dev/null+++ b/frontend/cypress/integration/channels/index.spec.ts@@ -0,0 +1,52 @@+/// <reference types="cypress" />++import ROUTES from 'constants/routes';++import defaultAllChannels from '../../fixtures/defaultAllChannels.json';++describe('Channels', () => {+ beforeEach(() => {+ window.localStorage.setItem('isLoggedIn', 'yes');++ cy.visit(Cypress.env('baseUrl') + ROUTES.ALL_CHANNELS);+ });++ it('Channels', () => {+ cy+ .intercept('**channels**', {+ statusCode: 200,+ fixture: 'defaultAllChannels',+ })+ .as('All Channels');++ cy.wait('@All Channels');++ cy+ .get('.ant-tabs-tab')+ .children()+ .then((e) => {+ const child = e.get();++ const secondChild = child[1];++ expect(secondChild.outerText).to.be.equals('Alert Channels');++ expect(secondChild.ariaSelected).to.be.equals('true');+ });++ cy+ .get('tbody')+ .should('be.visible')+ .then((e) => {+ const allChildren = e.children().get();+ expect(allChildren.length).to.be.equals(defaultAllChannels.data.length);++ allChildren.forEach((e, index) => {+ expect(e.firstChild?.textContent).not.null;+ expect(e.firstChild?.textContent).to.be.equals(+ defaultAllChannels.data[index].name,+ );+ });+ });+ });+});diff --git a/frontend/src/container/SettingsWrapper/index.tsx b/frontend/src/container/SettingsWrapper/index.tsxindex e50f05337d..afe59fe7bd 100644--- a/frontend/src/container/SettingsWrapper/index.tsx+++ b/frontend/src/container/SettingsWrapper/index.tsx@@ -15,6 +15,7 @@ const SettingsWrapper = ({AlertChannels,General,toggleSettingsTab,+ defaultRoute,}: SettingsWrapperProps): JSX.Element => {const { settingsActiveTab } = useSelector<AppState, AppReducer>((state) => state.app,@@ -38,7 +39,7 @@ const SettingsWrapper = ({<TabsdestroyInactiveTabPaneonChange={(value): void => onChangeHandler(value as SettingTab)}- activeKey={settingsActiveTab}+ activeKey={defaultRoute || settingsActiveTab}><TabPane tab="General" key="General"><General />@@ -63,6 +64,7 @@ const mapDispatchToProps = (interface SettingsWrapperProps extends DispatchProps {General: () => JSX.Element;AlertChannels: () => JSX.Element;+ defaultRoute?: SettingTab;}export default connect(null, mapDispatchToProps)(SettingsWrapper);diff --git a/frontend/src/pages/AllAlertChannels/index.tsx b/frontend/src/pages/AllAlertChannels/index.tsxindex 6f37019372..716795500c 100644--- a/frontend/src/pages/AllAlertChannels/index.tsx+++ b/frontend/src/pages/AllAlertChannels/index.tsx@@ -3,15 +3,14 @@ import GeneralSettings from 'container/GeneralSettings';import SettingsWrapper from 'container/SettingsWrapper';import React from 'react';-const AllAlertChannels = (): JSX.Element => {- return (- <SettingsWrapper- {...{- AlertChannels,- General: GeneralSettings,- }}- />- );-};+const AllAlertChannels = (): JSX.Element => (+ <SettingsWrapper+ {...{+ AlertChannels,+ General: GeneralSettings,+ defaultRoute: 'Alert Channels',+ }}+ />+);export default AllAlertChannels;