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

test(e2e): Explore page tests #19074

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
fix: add expect to bucket and its doc_count
pranita09 committed Dec 16, 2024

Verified

This commit was signed with the committer’s verified signature.
davidmigloz David Miguel Lozano
commit 364504030f805cb0079319ee3434c65aa2b492bb
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
*/
export const EXPECTED_BUCKETS = [
'table',
pranita09 marked this conversation as resolved.
Show resolved Hide resolved
'glossaryTerm',
'databaseSchema',
'chart',
'storedProcedure',
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ import { SearchIndexClass } from '../../support/entity/SearchIndexClass';
import { StoredProcedureClass } from '../../support/entity/StoredProcedureClass';
import { TableClass } from '../../support/entity/TableClass';
import { TopicClass } from '../../support/entity/TopicClass';
import { Glossary } from '../../support/glossary/Glossary';
import { GlossaryTerm } from '../../support/glossary/GlossaryTerm';
import { getApiContext, redirectToHomePage } from '../../utils/common';
import { updateDisplayNameForEntity } from '../../utils/entity';
import { validateBucketsForIndex } from '../../utils/explore';
@@ -203,6 +205,8 @@ test.describe('Explore Tree scenarios ', () => {

test.describe('Explore page', () => {
const table = new TableClass();
const glossary = new Glossary();
const glossaryTerm = new GlossaryTerm(glossary);
const dashboard = new DashboardClass();
const storedProcedure = new StoredProcedureClass();
const pipeline = new PipelineClass();
@@ -216,6 +220,8 @@ test.describe('Explore page', () => {
test.beforeEach('Setup pre-requisits', async ({ page }) => {
const { apiContext, afterAction } = await getApiContext(page);
await table.create(apiContext);
await glossary.create(apiContext);
await glossaryTerm.create(apiContext);
await dashboard.create(apiContext);
await storedProcedure.create(apiContext);
await pipeline.create(apiContext);
@@ -231,6 +237,8 @@ test.describe('Explore page', () => {
test.afterEach('Cleanup', async ({ page }) => {
const { apiContext, afterAction } = await getApiContext(page);
await table.delete(apiContext);
await glossary.delete(apiContext);
await glossaryTerm.delete(apiContext);
await dashboard.delete(apiContext);
await storedProcedure.delete(apiContext);
await pipeline.delete(apiContext);
Original file line number Diff line number Diff line change
@@ -135,16 +135,16 @@ export const validateBucketsForIndex = async (page: Page, index: string) => {

const buckets = response.aggregations?.['sterms#entityType']?.buckets ?? [];

// Verify all expected buckets exist and have doc_count > 0
const invalidBuckets = EXPECTED_BUCKETS.filter((expectedKey) => {
EXPECTED_BUCKETS.forEach((expectedKey) => {
const bucket = buckets.find((b: Bucket) => b.key === expectedKey);

return !bucket || bucket.doc_count <= 0;
});
// Expect the bucket to exist
expect(bucket, `Bucket with key "${expectedKey}" is missing`).toBeDefined();

if (invalidBuckets.length > 0) {
throw new Error(
`Buckets missing or with doc_count <= 0: ${invalidBuckets.join(', ')}`
);
}
// Expect the bucket's doc_count to be greater than 0
expect(
bucket?.doc_count,
`Bucket "${expectedKey}" has doc_count <= 0`
).toBeGreaterThan(0);
});
};
Loading