cypress - verify owner propagation (#16385)

* verify owner propagation

* fix reloading

* change owner name
This commit is contained in:
Karan Hotchandani 2024-05-22 21:03:17 +05:30 committed by GitHub
parent d5bf30ccd3
commit 3a842f58e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,21 +15,38 @@ import { visitServiceDetailsPage } from '../../common/serviceUtils';
import { import {
createEntityTableViaREST, createEntityTableViaREST,
deleteEntityViaREST, deleteEntityViaREST,
visitEntityDetailsPage,
} from '../../common/Utils/Entity'; } from '../../common/Utils/Entity';
import { EntityType } from '../../constants/Entity.interface'; import { EntityType } from '../../constants/Entity.interface';
import { DATABASE_SERVICE } from '../../constants/EntityConstant'; import {
DATABASE_SERVICE,
DATABASE_SERVICE_DETAILS,
} from '../../constants/EntityConstant';
import { GlobalSettingOptions } from '../../constants/settings.constant'; import { GlobalSettingOptions } from '../../constants/settings.constant';
import { getToken } from '../Utils/LocalStorage'; import { getToken } from '../Utils/LocalStorage';
import {
addOwner,
removeOwner,
updateOwner,
validateOwnerAndTeamCounts,
} from '../Utils/Owner';
import EntityClass from './EntityClass'; import EntityClass from './EntityClass';
class DatabaseClass extends EntityClass { class DatabaseClass extends EntityClass {
databaseName: string; databaseName: string;
tableName: string;
databaseSchemaName: string;
constructor() { constructor() {
const databaseName = `cypress-database-${Date.now()}`; const databaseName = `cypress-database-${Date.now()}`;
const tableName = `cypress-table-${Date.now()}`;
const databaseSchemaName = `cypress-database-schema-${Date.now()}`;
super(databaseName, DATABASE_SERVICE.database, EntityType.Database); super(databaseName, DATABASE_SERVICE.database, EntityType.Database);
this.databaseName = databaseName; this.databaseName = databaseName;
this.tableName = tableName;
this.databaseSchemaName = databaseSchemaName;
this.name = 'Database'; this.name = 'Database';
} }
@ -67,12 +84,47 @@ class DatabaseClass extends EntityClass {
token, token,
...DATABASE_SERVICE, ...DATABASE_SERVICE,
database: { ...DATABASE_SERVICE.database, name: this.databaseName }, database: { ...DATABASE_SERVICE.database, name: this.databaseName },
tables: [], tables: [
schema: undefined, {
...DATABASE_SERVICE.entity,
name: this.tableName,
databaseSchema: `${DATABASE_SERVICE_DETAILS.name}.${this.databaseName}.${this.databaseSchemaName}`,
},
],
schema: {
name: this.databaseSchemaName,
database: `${DATABASE_SERVICE_DETAILS.name}.${this.databaseName}`,
},
}); });
}); });
} }
// Check owner is propogated to table entity and perform update and delete owner
verifyOwnerPropogation(newOwnerName: string) {
cy.goToHomePage();
// Visit table entity details page
visitEntityDetailsPage({
term: this.tableName,
serviceName: DATABASE_SERVICE.service.name,
entity: EntityType.Table,
});
updateOwner(newOwnerName);
cy.reload();
removeOwner(newOwnerName);
// Visit Database page again
this.visitEntity();
}
override userOwnerFlow(ownerName: string, newOwnerName: string) {
validateOwnerAndTeamCounts();
addOwner(ownerName);
// Verify Owner propogated to table entity
this.verifyOwnerPropogation('Alex Pollard');
updateOwner(newOwnerName);
removeOwner(newOwnerName);
}
// Cleanup // Cleanup
override cleanup() { override cleanup() {
super.cleanup(); super.cleanup();