cypress: fixed flaky cypress of main branch (#10996)

* fixed failing cypress on main

* updating cypress config to test

* updating ingestion check

* revert changes related cypress.config

* added api wait for service details page API
This commit is contained in:
Shailesh Parmar 2023-04-12 17:57:52 +05:30 committed by GitHub
parent 673573a512
commit d30e2d89d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 28 deletions

View File

@ -74,18 +74,12 @@ export const handleIngestionRetry = (
// ingestions page
let retryCount = count;
const testIngestionsTab = () => {
cy.get('[data-testid="Ingestions"]').should('exist').and('be.visible');
cy.get('[data-testid="Ingestions"] >> [data-testid="filter-count"]').should(
'have.text',
rowIndex
);
// click on the tab only for the first time
if (retryCount === 0) {
// Wait for pipeline status to be loaded
if (ingestionType === 'metadata') {
verifyResponseStatusCode('@ingestionPipelines', 200);
}
cy.get('[data-testid="Ingestions"]').should('exist').and('be.visible');
cy.get(
'[data-testid="Ingestions"] >> [data-testid="filter-count"]'
).should('have.text', rowIndex);
cy.get('[data-testid="Ingestions"]').click();
if (ingestionType === 'metadata') {
@ -112,15 +106,9 @@ export const handleIngestionRetry = (
retryCount++;
if (ingestionType === 'metadata') {
cy.get(`[data-row-key*="${ingestionType}"]`)
.find('[data-testid="pipeline-status"]')
.as('checkRun');
} else {
cy.get(`[data-row-key*="${ingestionType}"]`)
.find('[data-testid="pipeline-status"]')
.as('checkRun');
}
cy.get(`[data-row-key*="${ingestionType}"]`)
.find('[data-testid="pipeline-status"]')
.as('checkRun');
// the latest run should be success
cy.get('@checkRun').then(($ingestionStatus) => {
if (
@ -290,9 +278,17 @@ export const testServiceCreationAndIngestion = (
cy.clock();
cy.wait(10000);
cy.get('[data-testid="view-service-button"]').should('be.visible');
cy.get('[data-testid="view-service-button"]').click();
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines?*',
'ingestionPipelines'
);
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
cy.get('[data-testid="view-service-button"]').should('be.visible').click();
verifyResponseStatusCode('@getIngestionPipelineStatus', 200);
verifyResponseStatusCode('@ingestionPipelines', 200);
verifyResponseStatusCode('@serviceDetails', 200);
handleIngestionRetry(type, testIngestionButton);
};

View File

@ -115,22 +115,36 @@ describe('Postgres Ingestion', () => {
.click();
verifyResponseStatusCode('@getServices', 200);
cy.intercept('/api/v1/services/ingestionPipelines?*').as('ingestionData');
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines?*',
'ingestionData'
);
interceptURL(
'GET',
'/api/v1/system/config/pipeline-service-client',
'airflow'
);
interceptURL(
'GET',
'/api/v1/permissions/ingestionPipeline/name/*',
'ingestionPermissions'
);
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
cy.get(`[data-testid="service-name-${serviceName}"]`)
.should('exist')
.click();
cy.get('[data-testid="tabs"]').should('exist');
cy.wait('@ingestionData');
verifyResponseStatusCode('@ingestionData', 200, {
responseTimeout: 50000,
});
verifyResponseStatusCode('@serviceDetails', 200);
verifyResponseStatusCode('@airflow', 200);
cy.get('[data-testid="tabs"]').should('exist');
cy.get('[data-testid="Ingestions"]')
.scrollIntoView()
.should('be.visible')
.click();
verifyResponseStatusCode('@ingestionPermissions', 200);
cy.get('[data-testid="ingestion-details-container"]').should('exist');
cy.get('[data-testid="add-new-ingestion-button"]')
.should('be.visible')

View File

@ -109,22 +109,37 @@ describe('RedShift Ingestion', () => {
.click();
verifyResponseStatusCode('@getServices', 200);
cy.intercept('/api/v1/services/ingestionPipelines?*').as('ingestionData');
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines?*',
'ingestionData'
);
interceptURL(
'GET',
'/api/v1/system/config/pipeline-service-client',
'airflow'
);
interceptURL(
'GET',
'/api/v1/permissions/ingestionPipeline/name/*',
'ingestionPermissions'
);
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
cy.get(`[data-testid="service-name-${REDSHIFT.serviceName}"]`)
.should('exist')
.click();
cy.get('[data-testid="tabs"]').should('exist');
cy.wait('@ingestionData');
verifyResponseStatusCode('@ingestionData', 200, {
responseTimeout: 50000,
});
verifyResponseStatusCode('@serviceDetails', 200);
verifyResponseStatusCode('@airflow', 200);
cy.get('[data-testid="tabs"]').should('exist');
cy.get('[data-testid="Ingestions"]')
.scrollIntoView()
.should('be.visible')
.click();
verifyResponseStatusCode('@ingestionPermissions', 200);
cy.get('[data-testid="ingestion-details-container"]').should('exist');
cy.get('[data-testid="add-new-ingestion-button"]')
.should('be.visible')

View File

@ -38,7 +38,7 @@ describe('Add nested teams and test TeamsSelectable', () => {
cy.login();
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
interceptURL('GET', '/api/v1/teams/name/Organization?*', 'getOrganization');
interceptURL('GET', '/api/v1/teams/name/*', 'getOrganization');
interceptURL('GET', '/api/v1/users*', 'getTeams');
interceptURL('GET', '/api/v1/permissions/team/*', 'getPermissions');
// Clicking on teams
@ -64,6 +64,8 @@ describe('Add nested teams and test TeamsSelectable', () => {
verifyResponseStatusCode('@getCreatedTeam', 200);
// asserting the added values
cy.get('table').find('.ant-table-row').contains(teamName).click();
verifyResponseStatusCode('@getOrganization', 200);
verifyResponseStatusCode('@getPermissions', 200);
});
});