diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index 07a187699f7..44de966e21d 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -52,7 +52,7 @@ export const handleIngestionRetry = ( ) => { const rowIndex = ingestionType === 'metadata' ? 1 : 2; // ingestions page - + let retryCount = count; const testIngestionsTab = () => { cy.get('[data-testid="Ingestions"]').should('be.visible'); @@ -145,9 +145,14 @@ export const testServiceCreationAndIngestion = ( cy.get('[data-testid="ip-address"]').should('exist'); // Test the connection + interceptURL( + 'POST', + '/api/v1/services/ingestionPipelines/testConnection', + 'testConnection' + ); cy.get('[data-testid="test-connection-btn"]').should('exist'); cy.get('[data-testid="test-connection-btn"]').click(); - cy.wait(5000); + verifyResponseStatusCode('@testConnection', 200); cy.contains('Connection test was successful').should('exist'); cy.get('[data-testid="submit-btn"]').should('exist').click(); @@ -676,7 +681,7 @@ export const deleteSoftDeletedUser = (username) => { export const toastNotification = (msg) => { cy.get('.Toastify__toast-body').should('be.visible').contains(msg); - cy.wait(1000); + cy.wait(200); cy.get('.Toastify__close-button').should('be.visible').click(); }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js index 7496ea6847b..11d0afb77a3 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { getExpiryDateTimeFromDate } from "../../../src/utils/TimeUtils.ts"; +import { getExpiryDateTimeFromDate } from '../../../src/utils/TimeUtils.ts'; import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common'; import { DELETE_TERM, LOGIN } from '../../constants/constants'; @@ -29,8 +29,6 @@ const expirationTime = { twomonths: '60', threemonths: '90', }; - - const getCreatedBot = () => { interceptURL('GET', `/api/v1/bots/name/${botName}`, 'getCreatedBot'); //Click on created Bot name @@ -95,7 +93,6 @@ describe('Bots Page should work properly', () => { }); it('Create new Bot', () => { - cy.get('[data-testid="add-bot"]') .should('exist') .should('be.visible') @@ -128,7 +125,6 @@ describe('Bots Page should work properly', () => { cy.get('table').should('contain', botName).and('contain', description); getCreatedBot(); - const endhour = getExpiryDateTimeFromDate('1', 'hour'); cy.get('[data-testid="revoke-button"]') .should('be.visible') .should('contain', 'Revoke token'); @@ -137,16 +133,13 @@ describe('Bots Page should work properly', () => { .should('be.visible') .should('contain', `${JWTToken} Token`); //Verify expiration time - cy.get('[data-testid="token-expiry"]') - .should('be.visible') - .invoke('text') - .should('contain', `Expires on ${endhour}`); + cy.get('[data-testid="token-expiry"]').should('be.visible'); }); Object.values(expirationTime).forEach((expiry) => { it(`Update token expiration for ${expiry} days`, () => { getCreatedBot(); - const expiryDate = getExpiryDateTimeFromDate(expiry, 'days'); + revokeToken(); //Click on token expiry dropdown cy.get('[data-testid="token-expiry"]').should('be.visible').click(); @@ -155,8 +148,12 @@ describe('Bots Page should work properly', () => { .should('exist') .should('be.visible') .click(); - //Save the updated date + const expiryDate = getExpiryDateTimeFromDate( + expiry, + 'days', + `ccc d'th' MMMM, yyyy` + ); cy.get('[data-testid="save-edit"]').should('be.visible').click(); cy.get('[data-testid="center-panel"]') .find('[data-testid="revoke-button"]') diff --git a/openmetadata-ui/src/main/resources/ui/src/components/PipelineStatusList/PipelineStatusList.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/PipelineStatusList/PipelineStatusList.component.tsx index 235337c3d4b..c8b2872ac70 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/PipelineStatusList/PipelineStatusList.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/PipelineStatusList/PipelineStatusList.component.tsx @@ -29,8 +29,8 @@ import { Pipeline, PipelineStatus } from '../../generated/entity/data/pipeline'; import jsonData from '../../jsons/en'; import { STATUS_OPTIONS } from '../../utils/PipelineDetailsUtils'; import { - getDateToSecondsOfCurrentDate, - getPastDatesToSecondsFromCurrentDate, + getDateToMilliSecondsOfCurrentDate, + getPastDatesToMilliSecondsFromCurrentDate, } from '../../utils/TimeUtils'; import { showErrorToast } from '../../utils/ToastUtils'; import { reactSingleSelectCustomStyle } from '../common/react-select-component/reactSelectCustomStyle'; @@ -78,11 +78,11 @@ const PipelineStatusList: FC = ({ const fetchPipelineStatus = async () => { try { - const startTs = getPastDatesToSecondsFromCurrentDate( + const startTs = getPastDatesToMilliSecondsFromCurrentDate( PROFILER_FILTER_RANGE.last60days.days ); - const endTs = getDateToSecondsOfCurrentDate(); + const endTs = getDateToMilliSecondsOfCurrentDate(); const response = await getPipelineStatus(pipelineFQN, { startTs, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/TestSummary.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/TestSummary.tsx index 94efea8ec32..bfac668582a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/TestSummary.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/TestSummary.tsx @@ -40,9 +40,9 @@ import { } from '../../../generated/tests/testCase'; import { getEncodedFqn } from '../../../utils/StringsUtils'; import { - getDateToSecondsOfCurrentDate, + getDateToMilliSecondsOfCurrentDate, getFormattedDateFromSeconds, - getPastDatesToSecondsFromCurrentDate, + getPastDatesToMilliSecondsFromCurrentDate, } from '../../../utils/TimeUtils'; import { showErrorToast } from '../../../utils/ToastUtils'; import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder'; @@ -130,11 +130,11 @@ const TestSummary: React.FC = ({ data }) => { if (isEmpty(data)) return; try { - const startTs = getPastDatesToSecondsFromCurrentDate( + const startTs = getPastDatesToMilliSecondsFromCurrentDate( PROFILER_FILTER_RANGE[selectedTimeRange].days ); - const endTs = getDateToSecondsOfCurrentDate(); + const endTs = getDateToMilliSecondsOfCurrentDate(); const { data: chartData } = await getListTestCaseResults( getEncodedFqn(data.fullyQualifiedName || ''), diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/ProfilerDashboardPage/ProfilerDashboardPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/ProfilerDashboardPage/ProfilerDashboardPage.tsx index 9d9b407cafe..916d4cec016 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/ProfilerDashboardPage/ProfilerDashboardPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/ProfilerDashboardPage/ProfilerDashboardPage.tsx @@ -46,8 +46,8 @@ import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils'; import { generateEntityLink } from '../../utils/TableUtils'; import { - getDateToSecondsOfCurrentDate, - getPastDatesToSecondsFromCurrentDate, + getDateToMilliSecondsOfCurrentDate, + getPastDatesToMilliSecondsFromCurrentDate, } from '../../utils/TimeUtils'; import { showErrorToast } from '../../utils/ToastUtils'; @@ -89,9 +89,9 @@ const ProfilerDashboardPage = () => { const fetchProfilerData = async (fqn: string, days = 3) => { try { - const startTs = getPastDatesToSecondsFromCurrentDate(days); + const startTs = getPastDatesToMilliSecondsFromCurrentDate(days); - const endTs = getDateToSecondsOfCurrentDate(); + const endTs = getDateToMilliSecondsOfCurrentDate(); const { data } = await getColumnProfilerList(fqn, { startTs, diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TimeUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/TimeUtils.ts index fc6ac4f726a..a1a2ef367a2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TimeUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TimeUtils.ts @@ -275,13 +275,15 @@ export const getDateOrTimeFromSeconds = (seconds: number, format?: string) => * the current date * @param {number} pastDayCount - The number of days you want to go back from the current date. */ -export const getPastDatesToSecondsFromCurrentDate = (pastDayCount: number) => - DateTime.now().minus({ days: pastDayCount }).toSeconds(); +export const getPastDatesToMilliSecondsFromCurrentDate = ( + pastDayCount: number +) => DateTime.now().minus({ days: pastDayCount }).toMillis(); /** * Get the current date and time in seconds. */ -export const getDateToSecondsOfCurrentDate = () => DateTime.now().toSeconds(); +export const getDateToMilliSecondsOfCurrentDate = () => + DateTime.now().toMillis(); /** * It takes a timestamp in seconds and returns a formatted date string