fix playwright and cypress (#17138)

This commit is contained in:
Karan Hotchandani 2024-07-23 16:55:35 +05:30 committed by GitHub
parent ff8d101d9b
commit 26fcf863e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 191 additions and 278 deletions

View File

@ -146,7 +146,16 @@ class UsersTestClass {
cy.get('[data-testid="add-service-button"] > span').should('not.exist');
});
cy.sidebarClick(SidebarItem.EXPLORE);
cy.get('[data-testid="tables-tab"]').click();
interceptURL('GET', `/api/v1/search/query?q=*`, 'getSearchResult');
cy.get('[data-testid="search-dropdown-Data Assets"]').click();
cy.get('[data-testid="table-checkbox"]').scrollIntoView();
cy.get('[data-testid="table-checkbox"]').click();
cy.get('[data-testid="update-btn"]').click();
verifyResponseStatusCode('@getSearchResult', 200);
cy.get(
'.ant-drawer-title > [data-testid="entity-link"] > .ant-typography'
).click();

View File

@ -1,250 +0,0 @@
/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { interceptURL, verifyResponseStatusCode } from '../../common/common';
import { SidebarItem } from '../../constants/Entity.interface';
describe('Entity Summary Panel', () => {
beforeEach(() => {
cy.login();
interceptURL(
'GET',
'/api/v1/search/query?*&index=table_search_index*',
'getTableEntity'
);
cy.sidebarClick(SidebarItem.EXPLORE);
verifyResponseStatusCode('@getTableEntity', 200);
});
it('Table Entity', () => {
cy.get('[data-testid="Type-label"]').should('be.visible');
cy.get('[data-testid="Queries-label"]').should('be.visible');
cy.get('[data-testid="Columns-label"]').should('be.visible');
cy.get('[data-testid="profiler-header"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="schema-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Database', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=database_search_index*',
'getDatabaseEntity'
);
cy.get('[data-testid="databases-tab"]').click();
verifyResponseStatusCode('@getDatabaseEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Owner-value"]').should('be.visible');
cy.get('[data-testid="Tier-label"]').should('be.visible');
cy.get('[data-testid="Service-label"]').should('be.visible');
cy.get('[data-testid="Usage-label"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="schema-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Database schema', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=database_schema_search_index*',
'getDatabaseSchemaEntity'
);
cy.get('[data-testid="database schemas-tab"]').click();
verifyResponseStatusCode('@getDatabaseSchemaEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Owner-value"]').should('be.visible');
cy.get('[data-testid="Tier-label"]').should('be.visible');
cy.get('[data-testid="Service-label"]').should('be.visible');
cy.get('[data-testid="Database-label"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="Usage-label"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Dashboard entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=dashboard_search_index*',
'getDashboardEntity'
);
cy.get('[data-testid="dashboards-tab"]').click();
verifyResponseStatusCode('@getDashboardEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Dashboard URL-label"]').should('be.visible');
cy.get('[data-testid="Project-label"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="charts-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Dashboard data model entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=dashboard_data_model_search_index*',
'getDashboardDataModelEntity'
);
cy.get('[data-testid="dashboard data models-tab"]').click();
verifyResponseStatusCode('@getDashboardDataModelEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Data Model URL-label"]').should('be.visible');
cy.get('[data-testid="Service-label"]').should('be.visible');
cy.get('[data-testid="Tier-label"]').should('be.visible');
cy.get('[data-testid="Data Model Type-label"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="column-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Pipeline entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=pipeline_search_index*',
'getPipelineEntity'
);
cy.get('[data-testid="pipelines-tab"]').click();
verifyResponseStatusCode('@getPipelineEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Pipeline URL-label"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="tasks-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Topic entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=topic_search_index*',
'getTopicEntity'
);
cy.get('[data-testid="topics-tab"]').click();
verifyResponseStatusCode('@getTopicEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Partitions-label"]').should('be.visible');
cy.get('[data-testid="Replication Factor-label"]').should('be.visible');
cy.get('[data-testid="Retention Size-label"]').should('be.visible');
cy.get('[data-testid="CleanUp Policies-label"]').should('be.visible');
cy.get('[data-testid="Max Message Size-label"]').should('be.visible');
cy.get('[data-testid="Schema Type-label"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="schema-header"]')
.scrollIntoView()
.should('be.visible');
});
it('ML Model entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=mlmodel_search_index*',
'getMLModelEntity'
);
cy.get('[data-testid="ml models-tab"]').click();
verifyResponseStatusCode('@getMLModelEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Algorithm-label"]').should('be.visible');
cy.get('[data-testid="Target-label"]').should('be.visible');
cy.get('[data-testid="Server-label"]').should('be.visible');
cy.get('[data-testid="Dashboard-label"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="features-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Container entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=container_search_index*',
'getContainerEntity'
);
cy.get('[data-testid="containers-tab"]').click();
verifyResponseStatusCode('@getContainerEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="Objects-label"]').should('be.visible');
cy.get('[data-testid="Service Type-label"]').should('be.visible');
cy.get('[data-testid="Columns-label"]').should('be.visible');
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="schema-header"]')
.scrollIntoView()
.should('be.visible');
});
it('Search Index entity', () => {
interceptURL(
'GET',
'/api/v1/search/query?*index=search_entity_search_index*',
'getSearchIndexEntity'
);
cy.get('[data-testid="search indexes-tab"]').click();
verifyResponseStatusCode('@getSearchIndexEntity', 200);
cy.get('.ant-drawer-title > [data-testid="entity-link"]').should(
'be.visible'
);
cy.get('[data-testid="tags-header"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="description-header"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-testid="fields-header"]')
.scrollIntoView()
.should('be.visible');
});
});

View File

@ -37,7 +37,6 @@ import {
removeOwner,
} from '../../common/Utils/Owner';
import { assignTags, removeTags } from '../../common/Utils/Tags';
import { GLOSSARY_DROPDOWN_ITEMS } from '../../constants/advancedSearchQuickFilters.constants';
import {
COLUMN_NAME_FOR_APPLY_GLOSSARY_TERM,
DELETE_TERM,
@ -481,29 +480,6 @@ const deleteUser = () => {
});
};
const verifyStatusFilterInExplore = (statusField: string) => {
const fieldName = Cypress._.toLower(statusField);
const glossaryTermStatusFilter = GLOSSARY_DROPDOWN_ITEMS.find(
(item) => item.key === 'status'
);
cy.sidebarClick(SidebarItem.EXPLORE);
cy.get(`[data-testid="glossary terms-tab"]`).scrollIntoView().click();
cy.get(`[data-testid="search-dropdown-${glossaryTermStatusFilter.label}"]`)
.scrollIntoView()
.click();
cy.get(`[data-testid=${fieldName}]`)
.should('exist')
.and('be.visible')
.click();
const querySearchURL = `/api/v1/search/query?*index=glossary_term_search_index*query_filter=*should*${glossaryTermStatusFilter.key}*${fieldName}*`;
interceptURL('GET', querySearchURL, 'querySearchAPI');
cy.get('[data-testid="update-btn"]').click();
verifyResponseStatusCode('@querySearchAPI', 200);
};
describe('Glossary page should work properly', { tags: 'Governance' }, () => {
before(() => {
// Prerequisites - Create a user with data consumer role
@ -604,9 +580,6 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => {
createGlossaryTerms(GLOSSARY_1);
createGlossaryTerms(GLOSSARY_2);
createGlossaryTerms(GLOSSARY_3);
verifyStatusFilterInExplore('Approved');
verifyStatusFilterInExplore('Draft');
});
it('Updating data of glossary should work properly', () => {

View File

@ -0,0 +1,172 @@
/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { expect, test } from '@playwright/test';
import { SidebarItem } from '../../constant/sidebar';
import { redirectToHomePage } from '../../utils/common';
import { selectDataAssetFilter } from '../../utils/explore';
import { sidebarClick } from '../../utils/sidebar';
// use the admin user to login
test.use({ storageState: 'playwright/.auth/admin.json' });
test.describe('Entity Summary Panel', () => {
test.beforeEach(async ({ page }) => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.EXPLORE);
});
test('Table Entity', async ({ page }) => {
await selectDataAssetFilter(page, 'table');
await expect(page.getByTestId('Type-label')).toBeVisible();
await expect(page.getByTestId('Queries-label')).toBeVisible();
await expect(page.getByTestId('Columns-label')).toBeVisible();
await expect(page.getByTestId('profiler-header')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('schema-header')).toBeVisible();
});
test('Database', async ({ page }) => {
await selectDataAssetFilter(page, 'database');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Owner-value')).toBeVisible();
await expect(page.getByTestId('Tier-label')).toBeVisible();
await expect(page.getByTestId('Service-label')).toBeVisible();
await expect(page.getByTestId('Usage-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('schema-header')).toBeVisible();
});
test('Database schema', async ({ page }) => {
await selectDataAssetFilter(page, 'databaseSchema');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Owner-value')).toBeVisible();
await expect(page.getByTestId('Tier-label')).toBeVisible();
await expect(page.getByTestId('Service-label')).toBeVisible();
await expect(page.getByTestId('Database-label')).toBeVisible();
await expect(page.getByTestId('Usage-label')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
});
test('Dashboard entity', async ({ page }) => {
await selectDataAssetFilter(page, 'dashboard');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Dashboard URL-label')).toBeVisible();
await expect(page.getByTestId('Project-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('charts-header')).toBeVisible();
});
test('Dashboard data model entity', async ({ page }) => {
await selectDataAssetFilter(page, 'dashboardDataModel');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Data Model URL-label')).toBeVisible();
await expect(page.getByTestId('Service-label')).toBeVisible();
await expect(page.getByTestId('Tier-label')).toBeVisible();
await expect(page.getByTestId('Data Model Type-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('column-header')).toBeVisible();
});
test('Pipeline entity', async ({ page }) => {
await selectDataAssetFilter(page, 'pipeline');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Pipeline URL-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('tasks-header')).toBeVisible();
});
test('Topic entity', async ({ page }) => {
await selectDataAssetFilter(page, 'topic');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Partitions-label')).toBeVisible();
await expect(page.getByTestId('Replication Factor-label')).toBeVisible();
await expect(page.getByTestId('Retention Size-label')).toBeVisible();
await expect(page.getByTestId('CleanUp Policies-label')).toBeVisible();
await expect(page.getByTestId('Max Message Size-label')).toBeVisible();
await expect(page.getByTestId('Schema Type-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('schema-header')).toBeVisible();
});
test('ML Model entity', async ({ page }) => {
await selectDataAssetFilter(page, 'mlmodel');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Algorithm-label')).toBeVisible();
await expect(page.getByTestId('Target-label')).toBeVisible();
await expect(page.getByTestId('Server-label')).toBeVisible();
await expect(page.getByTestId('Dashboard-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('features-header')).toBeVisible();
});
test('Container entity', async ({ page }) => {
await selectDataAssetFilter(page, 'container');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('Objects-label')).toBeVisible();
await expect(page.getByTestId('Service Type-label')).toBeVisible();
await expect(page.getByTestId('Columns-label')).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('schema-header')).toBeVisible();
});
test('Search Index entity', async ({ page }) => {
await selectDataAssetFilter(page, 'searchIndex');
await expect(
page.locator('.ant-drawer-title > [data-testid="entity-link"]')
).toBeVisible();
await expect(page.getByTestId('tags-header')).toBeVisible();
await expect(page.getByTestId('description-header')).toBeVisible();
await expect(page.getByTestId('fields-header')).toBeVisible();
});
});

View File

@ -107,3 +107,12 @@ export const checkCheckboxStatus = async (
await expect(isCheckedOnPage).toEqual(isChecked);
};
export const selectDataAssetFilter = async (
page: Page,
filterValue: string
) => {
await page.getByRole('button', { name: 'Data Assets' }).click();
await page.getByTestId(`${filterValue}-checkbox`).check();
await page.getByTestId('update-btn').click();
};