mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-01 11:09:14 +00:00
UI: Fix failing cypress tests part-2 (#7773)
* Fixed failing user page cypress tests * Fixed failing cypress tests for glossary * fixing failing cypress * Custom properties cypress fix * fixed failing cypress for description * miner wait added * fixed bot cy test * Fixed failing cypress tests for users page * fixed mysql test failure Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
parent
8a2c8b275a
commit
0b416564a3
@ -49,7 +49,7 @@ export const handleIngestionRetry = (
|
||||
) => {
|
||||
const rowIndex = ingestionType === 'metadata' ? 1 : 2;
|
||||
// ingestions page
|
||||
const retryTimes = 25;
|
||||
const retryTimes = 30;
|
||||
let retryCount = count;
|
||||
const testIngestionsTab = () => {
|
||||
cy.get('[data-testid="Ingestions"]').should('be.visible');
|
||||
@ -144,7 +144,7 @@ export const testServiceCreationAndIngestion = (
|
||||
// Test the connection
|
||||
cy.get('[data-testid="test-connection-btn"]').should('exist');
|
||||
cy.get('[data-testid="test-connection-btn"]').click();
|
||||
cy.wait(1000);
|
||||
cy.wait(5000);
|
||||
cy.contains('Connection test was successful').should('exist');
|
||||
cy.get('[data-testid="submit-btn"]').should('exist').click();
|
||||
|
||||
@ -473,7 +473,7 @@ export const softDeleteUser = (username) => {
|
||||
verifyResponseStatusCode('@searchUser', 200);
|
||||
|
||||
//Click on delete button
|
||||
cy.get('.ant-table-row .ant-table-cell button')
|
||||
cy.get(`[data-testid="delete-user-btn-${username}"]`)
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
@ -524,7 +524,10 @@ export const restoreUser = (username) => {
|
||||
cy.get('.ant-switch-handle').should('exist').should('be.visible').click();
|
||||
verifyResponseStatusCode('@deletedUser', 200);
|
||||
|
||||
cy.get('button [alt="Restore"]').should('exist').should('be.visible').click();
|
||||
cy.get(`[data-testid="restore-user-btn-${username}"]`)
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('.ant-modal-body > p').should(
|
||||
'contain',
|
||||
`Are you sure you want to restore ${username}?`
|
||||
@ -564,7 +567,10 @@ export const deleteSoftDeletedUser = (username) => {
|
||||
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('button [alt="Delete"]').should('exist').should('be.visible').click();
|
||||
cy.get(`[data-testid="delete-user-btn-${username}"]`)
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
|
||||
cy.get('[data-testid="confirm-button"]')
|
||||
.should('exist')
|
||||
@ -584,15 +590,6 @@ export const deleteSoftDeletedUser = (username) => {
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
cy.get('.ant-table-placeholder > .ant-table-cell').should(
|
||||
'not.contain',
|
||||
username
|
||||
);
|
||||
|
||||
cy.get('.ant-table-placeholder > .ant-table-cell')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid="searchbar"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
@ -813,9 +810,7 @@ export const login = (username, password) => {
|
||||
export const addTeam = (TEAM_DETAILS) => {
|
||||
interceptURL('GET', '/api/v1/teams*', 'addTeam');
|
||||
//Fetching the add button and clicking on it
|
||||
cy.get('[data-testid="add-team"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="add-team"]').should('be.visible').click();
|
||||
|
||||
verifyResponseStatusCode('@addTeam', 200);
|
||||
|
||||
@ -920,14 +915,14 @@ export const updateDescriptionForIngestedTables = (
|
||||
.should('be.visible')
|
||||
.should('have.class', 'active');
|
||||
interceptURL('GET', `/api/v1/permissions/*/*`, 'getEntityDetails');
|
||||
cy.get('[data-testid="table-link"]').first().click();
|
||||
cy.get('[data-testid="table-link"]').should('contain', tableName).click();
|
||||
verifyResponseStatusCode('@getEntityDetails', 200);
|
||||
|
||||
//update description
|
||||
cy.get('[data-testid="edit-description"]')
|
||||
.should('be.visible')
|
||||
.click({ force: true });
|
||||
cy.get(descriptionBox).should('be.visible').clear().type(description);
|
||||
cy.get(descriptionBox).should('be.visible').click().clear().type(description);
|
||||
interceptURL('PATCH', '/api/v1/*/*', 'updateEntity');
|
||||
cy.get('[data-testid="save"]').click();
|
||||
verifyResponseStatusCode('@updateEntity', 200);
|
||||
@ -941,7 +936,7 @@ export const updateDescriptionForIngestedTables = (
|
||||
|
||||
interceptURL(
|
||||
'GET',
|
||||
`/api/v1/services/*/name/${serviceName}*`,
|
||||
`/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=${serviceName}`,
|
||||
'getSelectedService'
|
||||
);
|
||||
|
||||
@ -961,6 +956,10 @@ export const updateDescriptionForIngestedTables = (
|
||||
);
|
||||
cy.get('[data-testid="run"]').should('be.visible').click();
|
||||
verifyResponseStatusCode('@checkRun', 200);
|
||||
|
||||
//Close the toast message
|
||||
cy.get('.Toastify__close-button').should('be.visible').click();
|
||||
|
||||
//Wait for success
|
||||
retryIngestionRun();
|
||||
|
||||
@ -973,8 +972,8 @@ export const updateDescriptionForIngestedTables = (
|
||||
.should('have.class', 'active');
|
||||
cy.get('[data-testid="table-link"]').first().click();
|
||||
verifyResponseStatusCode('@getEntityDetails', 200);
|
||||
cy.get('[data-testid="description"] > [data-testid="viewer-container"] ')
|
||||
cy.get('[data-testid="markdown-parser"]')
|
||||
.first()
|
||||
.invoke('text')
|
||||
.should('eq', description);
|
||||
.should('contain', description);
|
||||
};
|
||||
|
||||
@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
|
||||
|
||||
const serviceType = 'BigQuery';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableName = 'augcustomers';
|
||||
const tableName = 'personsx';
|
||||
const description = `This is ${serviceName} description`;
|
||||
|
||||
describe('BigQuery Ingestion', () => {
|
||||
|
||||
@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
|
||||
|
||||
const serviceType = 'Kafka';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableName = '__consumer_offsets';
|
||||
const topicName = '__transaction_state';
|
||||
const description = `This is ${serviceName} description`;
|
||||
|
||||
describe('Kafka Ingestion', () => {
|
||||
@ -45,7 +45,7 @@ describe('Kafka Ingestion', () => {
|
||||
.check();
|
||||
cy.get('[data-testid="filter-pattern-includes-topic"]')
|
||||
.should('be.visible')
|
||||
.type('__consumer_offsets');
|
||||
.type(topicName);
|
||||
};
|
||||
|
||||
testServiceCreationAndIngestion(
|
||||
@ -60,7 +60,7 @@ describe('Kafka Ingestion', () => {
|
||||
it('Update table description and verify', () => {
|
||||
updateDescriptionForIngestedTables(
|
||||
serviceName,
|
||||
tableName,
|
||||
topicName,
|
||||
description,
|
||||
SERVICE_TYPE.Messaging,
|
||||
'topics'
|
||||
|
||||
@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
|
||||
|
||||
const serviceType = 'Metabase';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableName = 'Customers Dashboard';
|
||||
const tableName = 'jaffle_shop';
|
||||
const description = `This is ${serviceName} description`;
|
||||
|
||||
describe('Metabase Ingestion', () => {
|
||||
|
||||
@ -12,11 +12,11 @@
|
||||
*/
|
||||
|
||||
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, mySqlConnectionInput, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
|
||||
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
|
||||
import { LOGIN, SERVICE_TYPE, TEAM_ENTITY } from '../../constants/constants';
|
||||
|
||||
const serviceType = 'Mysql';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableName = 'DATABASE_CHANGE_LOG';
|
||||
const tableName = TEAM_ENTITY;
|
||||
const description = `This is ${tableName} description`;
|
||||
|
||||
describe('MySQL Ingestion', () => {
|
||||
|
||||
@ -38,7 +38,7 @@ describe('Snowflake Ingestion', () => {
|
||||
cy.get('[data-testid="schema-filter-pattern-checkbox"]').check();
|
||||
cy.get('[data-testid="filter-pattern-includes-schema"]')
|
||||
.should('be.visible')
|
||||
.type('public');
|
||||
.type('PUBLIC');
|
||||
};
|
||||
|
||||
testServiceCreationAndIngestion(
|
||||
|
||||
@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
|
||||
|
||||
const serviceType = 'Superset';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableName = 'NEW DASHBOARD';
|
||||
const tableName = "World Bank's Data";
|
||||
const description = `This is ${serviceName} description`;
|
||||
|
||||
describe('Superset Ingestion', () => {
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
import { addTeam, interceptURL, login, searchEntity, uuid, verifyResponseStatusCode } from "../../common/common";
|
||||
import { LOGIN } from "../../constants/constants";
|
||||
import { LOGIN, SEARCH_ENTITY_TABLE } from "../../constants/constants";
|
||||
|
||||
|
||||
const teamName = `team-group-test-${uuid()}`;
|
||||
@ -21,7 +21,7 @@ const TEAM_DETAILS = {
|
||||
displayName: teamName,
|
||||
teamType: 'Group',
|
||||
description: `This is ${teamName} description`,
|
||||
assetName: 'fact_sale',
|
||||
assetName: SEARCH_ENTITY_TABLE.table_1.term,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -11,47 +11,60 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { interceptURL, login, searchEntity, verifyResponseStatusCode } from "../../common/common";
|
||||
import { LOGIN } from "../../constants/constants";
|
||||
import { interceptURL, login, searchEntity, verifyResponseStatusCode } from '../../common/common';
|
||||
import { LOGIN, SEARCH_ENTITY_TABLE } from '../../constants/constants';
|
||||
|
||||
const assetName = "fact_sale"
|
||||
const token = localStorage.getItem("oidcIdToken")
|
||||
const userURL = "/api/v1/search/query?q=***&from=0&size=10&index=user_search_index"
|
||||
const teamURL = "/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index"
|
||||
const assetName = SEARCH_ENTITY_TABLE.table_1.term;
|
||||
const userURL =
|
||||
'/api/v1/search/query?q=***&from=0&size=10&index=user_search_index';
|
||||
const teamURL =
|
||||
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index';
|
||||
|
||||
|
||||
describe("Test if the total count of users and teams is correctly displayed in the assign owner widget", () => {
|
||||
beforeEach(() => {
|
||||
describe('Test if the total count of users and teams is correctly displayed in the assign owner widget', () => {
|
||||
before(() => {
|
||||
cy.clearLocalStorageSnapshot();
|
||||
login(LOGIN.username, LOGIN.password);
|
||||
cy.goToHomePage();
|
||||
cy.saveLocalStorage('localstorage');
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.log('Restoring local storage snapshot');
|
||||
cy.restoreLocalStorage('localstorage');
|
||||
cy.clickOnLogo();
|
||||
});
|
||||
|
||||
it("Check total count of users and teams", () => {
|
||||
searchEntity(assetName);
|
||||
|
||||
it('Check total count of users and teams', () => {
|
||||
searchEntity(assetName);
|
||||
const token = localStorage.getItem('oidcIdToken');
|
||||
cy.get('[data-testid="table-link"]').first().should('be.visible').click();
|
||||
|
||||
interceptURL('GET', 'api/v1/tables/name/*', 'getEntityDetails');
|
||||
|
||||
verifyResponseStatusCode('@getEntityDetails', 200);
|
||||
|
||||
cy.request({method:"GET",url:userURL,headers:{Authorization:`Bearer ${token}`}}).as("UserCount")
|
||||
cy.request({method:"GET",url:teamURL,headers:{Authorization:`Bearer ${token}`}}).as("TeamCount")
|
||||
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: userURL,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).as('UserCount');
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: teamURL,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).as('TeamCount');
|
||||
|
||||
cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click();
|
||||
|
||||
// check for teams count
|
||||
cy.get('@TeamCount').then((response) => {
|
||||
const teamCount = response.body.hits.total.value
|
||||
cy.get('[data-testid="filter-count"]').eq(0).contains(`${teamCount}`)
|
||||
})
|
||||
const teamCount = response.body.hits.total.value;
|
||||
cy.get('[data-testid="filter-count"]').eq(0).contains(`${teamCount}`);
|
||||
});
|
||||
|
||||
// check for user count
|
||||
cy.get('@UserCount').then((response) => {
|
||||
const userCount = response.body.hits.total.value
|
||||
cy.get('[data-testid="filter-count"]').eq(1).contains(`${userCount}`)
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
const userCount = response.body.hits.total.value;
|
||||
cy.get('[data-testid="filter-count"]').eq(1).contains(`${userCount}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -90,11 +90,13 @@ describe('Bots Page should work properly', () => {
|
||||
.clear()
|
||||
.type(updatedBotName);
|
||||
//Save the updated display name
|
||||
interceptURL('GET', '/api/v1/users/auth-mechanism/*', 'getBot');
|
||||
|
||||
interceptURL('GET', '/api/v1/users/auth-mechanism/*', 'getBotDetails');
|
||||
cy.get('[data-testid="save-displayName"]').should('be.visible').click();
|
||||
verifyResponseStatusCode('@getBot', 200);
|
||||
verifyResponseStatusCode('@getBotDetails', 200);
|
||||
//Verify the display name is updated on bot details page
|
||||
cy.get('[data-testid="container"]').should('contain', updatedBotName);
|
||||
cy.wait(1000);
|
||||
//Click on edit description button
|
||||
cy.get('[data-testid="edit-description"]').should('be.visible').click();
|
||||
//Enter updated description and save
|
||||
|
||||
@ -18,11 +18,8 @@ describe('Custom Properties should work properly', () => {
|
||||
beforeEach(() => {
|
||||
login(LOGIN.username, LOGIN.password);
|
||||
cy.goToHomePage();
|
||||
interceptURL('GET', '/api/v1/users*', 'getTeams');
|
||||
|
||||
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
||||
|
||||
verifyResponseStatusCode('@getTeams', 200);
|
||||
});
|
||||
|
||||
it('Add Integer custom property for all Entities', () => {
|
||||
|
||||
@ -57,6 +57,7 @@ const createGlossaryTerm = (term) => {
|
||||
};
|
||||
|
||||
const deleteGlossary = ({ name }) => {
|
||||
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
||||
cy.get('#left-panelV1').contains(name).should('be.visible').click();
|
||||
cy.wait(500);
|
||||
cy.get('[data-testid="inactive-link"]').contains(name).should('be.visible');
|
||||
@ -98,6 +99,8 @@ describe('Glossary page should work properly', () => {
|
||||
beforeEach(() => {
|
||||
login(LOGIN.username, LOGIN.password);
|
||||
cy.goToHomePage();
|
||||
|
||||
interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms');
|
||||
//Clicking on Glossary
|
||||
cy.get('[data-testid="appbar-item-glossary"]')
|
||||
.should('exist')
|
||||
@ -459,6 +462,7 @@ describe('Glossary page should work properly', () => {
|
||||
});
|
||||
|
||||
it('Delete glossary should work properly', () => {
|
||||
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
||||
cy.get('[data-testid="header"]')
|
||||
.should('be.visible')
|
||||
.contains(NEW_GLOSSARY.name)
|
||||
|
||||
@ -15,12 +15,22 @@ import { addNewTagToEntity, descriptionBox, interceptURL, login, verifyResponseS
|
||||
import { LOGIN, NEW_TAG, NEW_TAG_CATEGORY, SEARCH_ENTITY_TABLE } from '../../constants/constants';
|
||||
|
||||
describe('Tags page should work', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.clearLocalStorageSnapshot();
|
||||
login(LOGIN.username, LOGIN.password);
|
||||
cy.goToHomePage();
|
||||
cy.saveLocalStorage('localstorage');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.log('Restoring local storage snapshot');
|
||||
cy.restoreLocalStorage('localstorage');
|
||||
cy.clickOnLogo();
|
||||
interceptURL('GET', '/api/v1/tags*', 'getTags');
|
||||
cy.get('[data-testid="appbar-item-tags"]')
|
||||
.should('be.visible')
|
||||
.click({ force: true });
|
||||
verifyResponseStatusCode('@getTags', 200);
|
||||
});
|
||||
|
||||
it('Required Details should be available', () => {
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
import { addUser, deleteSoftDeletedUser, login, restoreUser, softDeleteUser, uuid } from '../../common/common';
|
||||
import { LOGIN } from '../../constants/constants';
|
||||
|
||||
|
||||
const userName = `Usercttest${uuid()}`;
|
||||
const userEmail = `${userName}@gmail.com`;
|
||||
|
||||
|
||||
@ -143,6 +143,9 @@ const UserListV1: FC<UserListV1Props> = ({
|
||||
<SVGIcons
|
||||
alt="Restore"
|
||||
className="tw-w-4 tw-mb-2.5"
|
||||
data-testid={`restore-user-btn-${
|
||||
record.displayName || record.name
|
||||
}`}
|
||||
icon={Icons.RESTORE}
|
||||
/>
|
||||
}
|
||||
@ -163,6 +166,9 @@ const UserListV1: FC<UserListV1Props> = ({
|
||||
<SVGIcons
|
||||
alt="Delete"
|
||||
className="tw-w-4 tw-mb-2.5"
|
||||
data-testid={`delete-user-btn-${
|
||||
record.displayName || record.name
|
||||
}`}
|
||||
icon={Icons.DELETE}
|
||||
/>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user