Files
openobserve/tests/ui-testing/playwright-tests/changeOrg.spec.js
T
+2 0d9f47966b feat: Organization revamp (#5579)
Fixes #5131 
Addresses #5408 

### Revamp
- Created a new table to store organizations in the `organizations`
table. Earlier, we never stored organizations in any table, rather we
used to store the organizations in the meta table as part of the `user`
json.
- The users and organization membership relations are now moved to its
own separate tables - `users` and `org_users`.

### New changes

**API changes** -
- `/organizations` - `POST` api to create an org and save it in the meta
table. In non-enterprise version, currently only the root user can
create the org. For enterprise version with rbac enabled, anyone with
`CREATE` access for organizations can create the organization and
becomes an admin. Root user can always create an organization.
- `/{org_id}/rename` - `PUT` api to rename the existing org. Only root
user and the admins of the org can access this API.

The payload for following APIs are changed -
- `POST api/{org_id}/roles` - `{"name":"new_role"}` is changed to
`{"role":"new_role"}
- `POST api/{org_id}/users/{user}` -
`{"role":"viewer","custom_role":["role_name"]}` is the new payload where
`custom_role` is optional and is array of custom roles (only works in
enterprise with rbac enabled) which will be assigned to the user. The
value of `role` can be standard role or as well as any custom role (when
it is custom role, the standard role assigned to the user is decided
based on the enterprise env variable - `O2_DEX_DEFAULT_ROLE`).
- `POST api/{org_id}/users`- the payload -
```
{"email":"user@user.com","role":"viewer","custom_role":["create_org_permission"],"password":"12345678", "first_name": "", "last_name":""}
```

- `PUT api//{org_id}/users/{email_id}` the payload -
```
{"first_name":"Hello","last_name":"j","role":"viewer","isExternal":false,"change_password":false,"password":"","custom_role":["create_org_permission"]}
```


A new ENV variable is introduced - `ZO_CREATE_ORG_THROUGH_INGESTION`
(default `false`) which if true, an org will automatically created when
ingesting data to a new org. If false, user can not create org by
ingesting data to new org, they need to first call the `POST
/organizations` API.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

**New Features**
- Added a `cloud` feature for enhanced organizational management
capabilities.
- Introduced new methods for managing organizational users and
asynchronous message processing.
- Enhanced user invitation and membership features, including improved
role handling.
- Implemented configurable ingestion URL support across various
components.
- Added new functionality for user management and organization handling
in the super cluster architecture.

**Improvements**
- Refined user authentication and authorization processes, including
error handling.
- Updated database schema to support multi-organization architecture.
- Enhanced pagination settings and UI components for better user
experience.
- Improved handling of organization names and user roles in
notifications and alerts.
- Streamlined service account token management with visibility
enhancements.
- Enhanced the `AddUpdateOrganization` component with improved user
input handling and validation.
- Updated the `AppOrganizations` component to dynamically load the
appropriate organization management interface.
- Improved the `ServiceAccountsList` component with updated pagination
options and token handling logic.

**Bug Fixes**
- Resolved issues with user role assignments and organization management
inconsistencies.
- Corrected routing and navigation logic for login and logout processes.
- Addressed various error handling scenarios in user and organization
processes.
- Fixed issues with the visibility of service account options in the
`EditGroup` and `EditRole` components based on the cloud configuration.

**Breaking Changes**
- Significant restructuring of user and organization data models.
- Changes to authentication workflows and configuration handling.
- Removal of certain components related to user and organization
management.
- Updated the logic for determining the ingestion URL across various
components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
Co-authored-by: harshiv-7 <harshiv@openobserve.ai>
Co-authored-by: Huaijin <haohuaijin@gmail.com>
Co-authored-by: Zhao.wei <weizhao029@gmail.com>
Co-authored-by: ShyamOOAI <shyam@openobserve.ai>
Co-authored-by: oasisk <ashish.j.kolhe@gmail.com>
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yashodhan@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
2025-05-25 21:53:55 -07:00

333 lines
11 KiB
JavaScript

import { test, expect } from "./baseFixtures.js";
import { LoginPage } from '../pages/loginPage.js';
import { LogsPage } from '../pages/logsPage.js';
import { IngestionPage } from '../pages/ingestionPage.js';
import { HomePage } from "../pages/homePage.js";
import { MetricsPage } from "../pages/metricsPage.js";
import { TracesPage } from "../pages/tracesPage.js";
import { RumPage } from "../pages/rumPage.js";
import { PipelinesPage } from "../pages/pipelinesPage.js";
import { DashboardPage } from "../pages/dashboardPage.js";
import { StreamsPage } from "../pages/streamsPage.js";
import { ReportsPage } from "../pages/reportsPage.js";
import { AlertsPage } from "../pages/alertsPage.js";
import { DataPage } from "../pages/dataPage.js";
import { IamPage } from "../pages/iamPage.js";
import { ManagementPage } from "../pages/managementPage.js";
import { AboutPage } from "../pages/aboutPage.js";
import { CreateOrgPage } from "../pages/createOrgPage.js";
test.describe("Change Organisation", () => {
let loginPage, logsPage, ingestionPage, homePage, metricsPage,
tracesPage, rumPage, pipelinesPage, dashboardPage, streamsPage,
reportsPage, alertsPage, dataPage, iamPage, managementPage, aboutPage, createOrgPage,
multiOrgIdentifier;
test.beforeEach(async ({ page }) => {
loginPage = new LoginPage(page);
ingestionPage = new IngestionPage(page);
logsPage = new LogsPage(page);
homePage = new HomePage(page);
metricsPage = new MetricsPage(page);
tracesPage = new TracesPage(page);
rumPage = new RumPage(page);
pipelinesPage = new PipelinesPage(page);
dashboardPage = new DashboardPage(page);
streamsPage = new StreamsPage(page);
reportsPage = new ReportsPage(page);
alertsPage = new AlertsPage(page);
dataPage = new DataPage(page);
iamPage = new IamPage(page);
managementPage = new ManagementPage(page);
aboutPage = new AboutPage(page);
createOrgPage = new CreateOrgPage(page);
await loginPage.gotoLoginPage();
await loginPage.loginAsInternalUser();
await loginPage.login();
await ingestionPage.ingestion();
multiOrgIdentifier = await createOrgPage.createOrg();
await ingestionPage.ingestionMultiOrg(multiOrgIdentifier);
});
test("Home Page default validation", async ({ page }) => {
await page.waitForTimeout(1000);
await page.reload();
await page.waitForTimeout(5000);
await homePage.homePageValidation();
await homePage.gotoHomePage();
await homePage.homePageValidation();
});
test("Home Page change organisation validation", async ({ page }) => {
await homePage.homePageDefaultMultiOrg();
await homePage.homePageValidation();
await homePage.homePageURLValidation();
await homePage.gotoHomePage();
await homePage.homePageValidation();
await homePage.homePageURLValidation();
});
test("Logs Page default validation", async ({ page }) => {
await logsPage.navigateToLogs();
await logsPage.validateLogsPage();
});
test("Logs Page change organisation validation", async ({ page }) => {
await logsPage.navigateToLogs();
await logsPage.logsPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await logsPage.validateLogsPage();
await logsPage.logsPageURLValidation();
await logsPage.navigateToLogs();
await logsPage.validateLogsPage();
await logsPage.logsPageURLValidation();
});
test("Metrics Page default validation", async ({ page }) => {
await metricsPage.gotoMetricsPage();
await metricsPage.metricsPageValidation();
await metricsPage.metricsURLValidation();
});
test("Metrics Page change organisation validation", async ({ page }) => {
await metricsPage.gotoMetricsPage();
await page.waitForTimeout(5000);
await metricsPage.metricsPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await metricsPage.metricsPageValidation();
await metricsPage.metricsPageURLValidation();
await metricsPage.gotoMetricsPage();
await metricsPage.metricsPageValidation();
await metricsPage.metricsPageURLValidation();
});
test("Traces Page default validation", async ({ page }) => {
await tracesPage.navigateToTraces();
await tracesPage.validateTracesPage();
await tracesPage.tracesURLValidation();
});
test("Traces Page change organisation validation", async ({ page }) => {
await tracesPage.navigateToTraces();
await page.waitForTimeout(5000);
await tracesPage.tracesPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await tracesPage.validateTracesPage();
await tracesPage.tracesPageURLValidation();
await tracesPage.navigateToTraces();
await tracesPage.validateTracesPage();
await tracesPage.tracesPageURLValidation();
});
test("RUM Page default validation", async ({ page }) => {
await rumPage.gotoRumPage();
await rumPage.rumURLValidation();
});
test("RUM Page change organisation validation", async ({ page }) => {
await rumPage.gotoRumPage();
await page.waitForTimeout(5000);
await rumPage.rumPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await rumPage.rumPageURLValidation();
await rumPage.gotoRumPage();
await rumPage.rumPageURLValidation();
});
test("Pipelines Page default validation", async ({ page }) => {
await pipelinesPage.gotoPipelinesPage();
await pipelinesPage.pipelinesURLValidation();
});
test("Pipelines Page change organisation validation", async ({ page }) => {
await pipelinesPage.gotoPipelinesPage();
await page.waitForTimeout(5000);
await pipelinesPage.pipelinesPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await pipelinesPage.pipelinesPageURLValidation();
await pipelinesPage.gotoPipelinesPage();
await pipelinesPage.pipelinesPageURLValidation();
});
test("Dashboard Page default validation", async ({ page }) => {
await dashboardPage.navigateToDashboards();
await dashboardPage.dashboardURLValidation();
});
test("Dashboard Page change organisation validation", async ({ page }) => {
await dashboardPage.navigateToDashboards();
await page.waitForTimeout(5000);
await dashboardPage.dashboardPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await dashboardPage.dashboardPageURLValidation();
await dashboardPage.navigateToDashboards();
await dashboardPage.dashboardPageURLValidation();
});
test("Streams Page default validation", async ({ page }) => {
await streamsPage.gotoStreamsPage();
await streamsPage.streamsURLValidation();
});
test("Streams Page change organisation validation", async ({ page }) => {
await streamsPage.gotoStreamsPage();
await page.waitForTimeout(5000);
await streamsPage.streamsPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await streamsPage.streamsPageURLValidation();
await streamsPage.gotoStreamsPage();
await streamsPage.streamsPageURLValidation();
});
test("Reports Page default validation", async ({ page }) => {
await reportsPage.goToReports();
await reportsPage.reportsURLValidation();
});
test("Reports Page change organisation validation", async ({ page }) => {
await reportsPage.goToReports();
await page.waitForTimeout(5000);
await reportsPage.reportsPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await reportsPage.reportsPageURLValidation();
await reportsPage.goToReports();
await reportsPage.reportsPageURLValidation();
});
test("Alerts Page default validation", async ({ page }) => {
await alertsPage.navigateToAlerts();
await alertsPage.alertsURLValidation();
});
test("Alerts Page change organisation validation", async ({ page }) => {
await alertsPage.navigateToAlerts();
await page.waitForTimeout(5000);
await alertsPage.alertsPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await alertsPage.alertsPageURLValidation();
await alertsPage.navigateToAlerts();
await alertsPage.alertsPageURLValidation();
});
test("Data sources Page default validation", async ({ page }) => {
await dataPage.gotoDataPage();
await dataPage.dataURLValidation();
});
test("Data sources Page change organisation validation", async ({ page }) => {
await dataPage.gotoDataPage();
await page.waitForTimeout(5000);
await dataPage.dataPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await dataPage.dataPageURLValidation();
await dataPage.gotoDataPage();
await dataPage.dataPageURLValidation();
});
test("IAM Page default validation", async ({ page }) => {
await iamPage.gotoIamPage();
await iamPage.iamURLValidation();
});
test("IAM Page change organisation validation", async ({ page }) => {
await iamPage.gotoIamPage();
await page.waitForTimeout(5000);
await iamPage.iamPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await iamPage.iamPageURLValidation();
await iamPage.gotoIamPage();
await iamPage.iamPageURLValidation();
});
test("Management Page default validation", async ({ page }) => {
await managementPage.goToManagement();
await managementPage.managementURLValidation();
});
// test("Management Page change organisation validation", async ({ page }) => {
// let newOrgIdentifier = await createOrgPage.createOrg();
// await ingestionPage.ingestionMultiOrg(newOrgIdentifier);
// await managementPage.goToManagement();
// await page.waitForTimeout(5000);
// await managementPage.managementPageDefaultMultiOrg();
// await page.waitForTimeout(5000);
// await managementPage.managementPageURLValidation(newOrgIdentifier);
// await managementPage.goToManagement();
// await managementPage.managementPageURLValidation(newOrgIdentifier);
// });
test("About Page default validation", async ({ page }) => {
await aboutPage.clickHelpMenu();
await aboutPage.gotoAboutPage();
await aboutPage.aboutURLValidation();
});
test("About Page change organisation validation", async ({ page }) => {
await aboutPage.clickHelpMenu();
await aboutPage.gotoAboutPage();
await page.waitForTimeout(5000);
await aboutPage.aboutPageDefaultMultiOrg();
await page.waitForTimeout(5000);
await aboutPage.aboutPageURLValidation();
await aboutPage.clickHelpMenu();
await aboutPage.gotoAboutPage();
await aboutPage.aboutURLValidation();
});
});