cypress: fixed AUT failure of main branch (#15820)

This commit is contained in:
Shailesh Parmar 2024-04-05 15:44:11 +05:30 committed by GitHub
parent 3613bc64fd
commit eec5a72fa6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 5 deletions

View File

@ -23,6 +23,7 @@ import {
} from '../../common/EntityUtils';
import { visitEntityDetailsPage } from '../../common/Utils/Entity';
import { getToken } from '../../common/Utils/LocalStorage';
import { generateRandomUser } from '../../common/Utils/Owner';
import { EntityType } from '../../constants/Entity.interface';
import {
DATABASE_SERVICE,
@ -39,6 +40,8 @@ const queryTable = {
};
const table1 = generateRandomTable();
const table2 = generateRandomTable();
const user = generateRandomUser();
let userId = '';
const DATA = {
...queryTable,
@ -64,6 +67,7 @@ const queryFilters = ({
cy.get(`[data-testid="search-dropdown-${key}"]`).click();
cy.get('[data-testid="search-input"]').type(filter);
verifyResponseStatusCode(apiKey, 200);
cy.get(`[data-testid="search-dropdown-${key}"]`).trigger('mouseout');
cy.get(`[data-testid="drop-down-menu"] [title="${filter}"]`).click();
cy.get('[data-testid="update-btn"]').click();
verifyResponseStatusCode('@fetchQuery', 200);
@ -82,6 +86,16 @@ describe('Query Entity', { tags: 'DataAssets' }, () => {
});
// get Table by name and create query in the table
createQueryByTableName(token, table1);
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: user,
}).then((response) => {
userId = response.body.id;
});
});
});
@ -95,6 +109,13 @@ describe('Query Entity', { tags: 'DataAssets' }, () => {
serviceFqn: DATABASE_SERVICE.service.name,
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
});
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${userId}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
@ -207,7 +228,7 @@ describe('Query Entity', { tags: 'DataAssets' }, () => {
cy.get('[data-testid="table_queries"]').click();
verifyResponseStatusCode('@fetchQuery', 200);
queryFilters({
filter: 'Aaron Singh',
filter: `${user.firstName}${user.lastName}`,
apiKey: '@searchOwner',
key: 'Owner',
});

View File

@ -76,7 +76,7 @@ const addKpi = (data) => {
cy.get(`.ant-select-dropdown [title="${data.metricType}"]`).click();
cy.get('[data-testid="metric-percentage-input"] [role="spinbutton"]')
.scrollIntoView()
.type(100);
.type('100');
cy.get('[data-testid="start-date"]').click().type(`${startDate}{enter}`);
cy.get('[data-testid="end-date"]').click().type(`${endDate}{enter}`);
cy.get(descriptionBox).scrollIntoView().type('cypress test');
@ -139,6 +139,10 @@ describe('Data Insight feature', { tags: 'Observability' }, () => {
verifyResponseStatusCode('@deploy', 200);
cy.reload();
verifyResponseStatusCode('@dataInsightsApplication', 200);
// Adding a manual wait to allow some time between deploying the pipeline and triggering it
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.get('[data-testid="run-now-button"]').click();
verifyResponseStatusCode('@triggerPipeline', 200);
cy.reload();
@ -219,7 +223,7 @@ describe('Data Insight feature', { tags: 'Observability' }, () => {
cy.get('[data-testid="metric-percentage-input"] [role="spinbutton"]')
.scrollIntoView()
.clear()
.type(50);
.type('50');
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
verifyResponseStatusCode('@updateKpi', 200);
});

View File

@ -121,6 +121,10 @@ describe(
verifyResponseStatusCode('@deploy', 200);
cy.reload();
verifyResponseStatusCode('@getDataInsightDetails', 200);
// Adding a manual wait to allow some time between deploying the pipeline and triggering it
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.get('[data-testid="run-now-button"]').click();
verifyResponseStatusCode('@triggerPipeline', 200);

View File

@ -910,7 +910,6 @@ describe(
verifyResponseStatusCode('@systemProfiler', 200);
cy.get('[data-testid="profiler-setting-btn"]').click();
cy.get('.ant-modal-body').should('be.visible');
verifyResponseStatusCode('@tableProfilerConfig', 200);
cy.get('[data-testid="slider-input"]')
.clear()
.type(profilerSetting.profileSample);
@ -975,7 +974,8 @@ describe(
cy.get('[data-testid="profiler"]').click();
// verify profiler setting details
cy.get('[data-testid="profiler-setting-btn"]').click();
verifyResponseStatusCode('@tableProfilerConfig', 200);
// need extra time to load API response
verifyResponseStatusCode('@tableProfilerConfig', 200, { timeout: 10000 });
cy.get('[data-testid="slider-input"]').should(
'have.value',