Skip to content

Commit

Permalink
cypress: fixed aut failure part 7 (open-metadata#16371)
Browse files Browse the repository at this point in the history
* cypress: fixed aut failure part 7

* updated cypress

* fixed failing cypress
  • Loading branch information
ShaileshParmar11 authored May 26, 2024
1 parent 89b1b09 commit 505690e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
* limitations under the License.
*/
import { SidebarItem } from '../constants/Entity.interface';
import { interceptURL, RETRY_TIMES, verifyResponseStatusCode } from './common';
import { interceptURL, verifyResponseStatusCode } from './common';

const BASE_WAIT_TIME = 4000;
const RETRY_TIMES = 3;
let isSuccessStatus = false;

export const checkDataInsightSuccessStatus = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export const validateOwnerAndTeamCounts = () => {
};

export const addOwner = (ownerName: string, dataTestId?: string) => {
interceptURL('GET', '/api/v1/users?*isBot=false*', 'getUsers');
cy.get('[data-testid="edit-owner"]').click();

cy.get("[data-testid='select-owner-tabs']").should('be.visible');
cy.log('/api/v1/users?limit=*&isBot=false*');
cy.get('.ant-tabs [id*=tab-users]').click();

verifyResponseStatusCode('@getUsers', 200);
interceptURL(
'GET',
`api/v1/search/query?q=*&index=user_search_index*`,
Expand All @@ -94,7 +94,6 @@ export const addOwner = (ownerName: string, dataTestId?: string) => {

export const updateOwner = (ownerName: string, dataTestId?: string) => {
cy.get('[data-testid="edit-owner"]').click();

cy.get("[data-testid='select-owner-tabs']").should('be.visible');
cy.log('/api/v1/users?limit=*&isBot=false*');
cy.get('.ant-tabs [id*=tab-users]').click();
Expand Down Expand Up @@ -129,11 +128,9 @@ export const removeOwner = (ownerName: string, dataTestId?: string) => {

interceptURL('PATCH', `/api/v1/**`, 'patchOwner');

cy.get('[data-testid="select-owner-tabs"]').should('be.visible');

cy.get(
'[data-testid="select-owner-tabs"] [data-testid="remove-owner"]'
).scrollIntoView({ offset: { top: -100, left: 0 } });
).should('be.visible');

cy.get(
'[data-testid="select-owner-tabs"] [data-testid="remove-owner"]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
customFormatDateTime,
getEpochMillisForFutureDays,
} from '../../../src/utils/date-time/DateTimeUtils';
import { GlobalSettingOptions } from '../../constants/settings.constant';
import {
descriptionBox,
interceptURL,
Expand Down Expand Up @@ -166,10 +165,6 @@ export const permanentDeleteUser = (username: string, displayName: string) => {

cy.get('[data-testid="search-error-placeholder"]').should('be.exist');
};
export const visitUserListPage = () => {
interceptURL('GET', '/api/v1/users?*', 'getUsers');
cy.settingClick(GlobalSettingOptions.USERS);
};

export const generateToken = () => {
cy.get('[data-testid="no-token"]').should('be.visible');
Expand Down Expand Up @@ -202,7 +197,7 @@ export const updateExpiration = (expiry: number | string) => {
cy.get('[data-testid="token-expiry"]').click();
cy.contains(`${expiry} days`).click();
const expiryDate = customFormatDateTime(
getEpochMillisForFutureDays(expiry),
getEpochMillisForFutureDays(expiry as number),
`ccc d'th' MMMM, yyyy`
);
cy.get('[data-testid="save-edit"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ describe('Data Insight feature', { tags: 'Observability' }, () => {
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
verifyResponseStatusCode('@dataInsightsChart', 200);
cy.get('[data-menu-id*="kpi"]').click();
verifyResponseStatusCode('@dataInsightsChart', 200);
verifyResponseStatusCode('@getKpi', 200);
cy.get('[data-testid="kpi-card"]').should('be.visible');
cy.get(
'[data-row-key="cypress-description-with-percentage-completed-description-fraction"]'
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('Data Insight feature', { tags: 'Observability' }, () => {
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
verifyResponseStatusCode('@dataInsightsChart', 200);
cy.get('[data-menu-id*="kpi"]').click();
verifyResponseStatusCode('@dataInsightsChart', 200);
verifyResponseStatusCode('@getKpi', 200);
KPI_DATA.map((data) => {
cy.get(`[data-testid="delete-action-${data.displayName}"]`).click();
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ describe(
.scrollIntoView()
.should('be.visible');

cy.get('[data-testid="version-button"]').click();
cy.get('[data-testid="version-button"]').scrollIntoView().click();

verifyResponseStatusCode('@getGlossaryTermParents', 200);
verifyResponseStatusCode('@getChildGlossaryTerms', 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ describe('Search Index Application', { tags: 'Settings' }, () => {
visitSearchApplicationPage();
cy.get('[data-testid="edit-button"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.rc-virtual-list [title="Day"]').click();
cy.get('[data-testid="hour-options"]').click();
cy.get('[title="01"]').click();
cy.get('.rc-virtual-list [title="None"]').click();
cy.get('.ant-modal-body [data-testid="deploy-button"]').click();
verifyResponseStatusCode('@updateApplication', 200);
cy.get('[data-testid="cron-string"]').should('contain', 'At 01:00 AM');
cy.get('[data-testid="schedule-type"]').should('contain', 'None');

cy.get('[data-testid="configuration"]').click();

Expand Down Expand Up @@ -114,8 +112,8 @@ describe('Search Index Application', { tags: 'Settings' }, () => {
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.rc-virtual-list [title="Day"]').click();
cy.get('[data-testid="cron-type"]').should('contain', 'Day');
cy.get('.rc-virtual-list [title="None"]').click();
cy.get('[data-testid="cron-type"]').should('contain', 'None');
cy.get('[data-testid="deploy-button"]').click();
verifyResponseStatusCode('@installApplication', 201);
verifyResponseStatusCode('@getApplications', 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
revokeToken,
updateDetails,
updateExpiration,
visitUserListPage,
} from '../../common/Utils/Users';
import {
BASE_URL,
Expand All @@ -46,8 +45,8 @@ import {
import { EntityType, SidebarItem } from '../../constants/Entity.interface';
import {
GlobalSettingOptions,
SETTINGS_OPTIONS_PATH,
SETTING_CUSTOM_PROPERTIES_PATH,
SETTINGS_OPTIONS_PATH,
} from '../../constants/settings.constant';

const entity = new UsersTestClass();
Expand Down Expand Up @@ -118,7 +117,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => {

it('Create Data Consumer User', () => {
cy.login();
visitUserListPage();
entity.visitUserListPage();
addUser({ ...user, role: DATA_CONSUMER_ROLE.name });
cy.logout();
});
Expand All @@ -145,7 +144,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => {

it(`Update token expiration`, () => {
cy.login(user.email, user.newPassword);
visitUserListPage();
entity.visitUserListPage();
Object.values(expirationTime).forEach((expiry) => {
updateExpiration(expiry);
});
Expand Down Expand Up @@ -225,7 +224,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => {
it('Update Data Steward details', () => {
// change role from consumer to steward
cy.login();
visitUserListPage();
entity.visitUserListPage();
editRole(user.name, DATA_STEWARD_ROLE.name);
cy.logout();
// login to steward user
Expand All @@ -243,7 +242,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => {

it('Token generation & revocation for Data Steward', () => {
cy.login(user.email, user.newStewardPassword);
visitUserListPage();
entity.visitUserListPage();
cy.get('[data-testid="dropdown-profile"]').click({ force: true });
cy.get('[data-testid="user-name"] > .ant-typography').click({
force: true,
Expand All @@ -255,7 +254,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => {

it(`Update token expiration for Data Steward`, () => {
cy.login(user.email, user.newStewardPassword);
visitUserListPage();
entity.visitUserListPage();
Object.values(expirationTime).forEach((expiry) => {
updateExpiration(expiry);
});
Expand Down Expand Up @@ -307,19 +306,19 @@ describe('User with different Roles', { tags: 'Settings' }, () => {

it('Admin Soft delete user', () => {
cy.login();
visitUserListPage();
entity.visitUserListPage();
entity.softDeleteUser(user.name, user.updatedDisplayName);
});

it('Admin Restore soft deleted user', () => {
cy.login();
visitUserListPage();
entity.visitUserListPage();
entity.restoreSoftDeletedUser(user.name, user.updatedDisplayName);
});

it('Admin Permanent Delete User', () => {
cy.login();
visitUserListPage();
entity.visitUserListPage();
entity.permanentDeleteUser(user.name, user.updatedDisplayName);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
AppType,
} from '../../../../generated/entity/applications/app';
import { getIngestionPipelineByFqn } from '../../../../rest/ingestionPipelineAPI';
import Loader from '../../../common/Loader/Loader';
import { TestSuiteIngestionDataType } from '../../../DataQuality/AddDataQualityTest/AddDataQualityTest.interface';
import TestSuiteScheduler from '../../../DataQuality/AddDataQualityTest/components/TestSuiteScheduler';
import Loader from '../../../common/Loader/Loader';
import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component';
import { AppRunsHistoryRef } from '../AppRunsHistory/AppRunsHistory.interface';
import { AppScheduleProps } from './AppScheduleProps.interface';
Expand Down Expand Up @@ -155,7 +155,9 @@ const AppSchedule = ({
<Typography.Text className="right-panel-label">
{t('label.schedule-type')}
</Typography.Text>
<Typography.Text className="font-medium">
<Typography.Text
className="font-medium"
data-testid="schedule-type">
{(appData.appSchedule as AppScheduleClass).scheduleTimeline ??
''}
</Typography.Text>
Expand Down

0 comments on commit 505690e

Please sign in to comment.