Skip to content

Commit fd80029

Browse files
Shrabanti PaulShrabanti Paul
authored andcommitted
fix missed cherry-pick issues
1 parent 7a3f23d commit fd80029

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/utils/dataContracts.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { SidebarItem } from '../constant/sidebar';
2020
import { TableClass } from '../support/entity/TableClass';
2121
import { getApiContext } from './common';
22+
import { waitForAllLoadersToDisappear } from './entity';
2223
import { sidebarClick } from './sidebar';
2324

2425
export const saveAndTriggerDataContractValidation = async (
@@ -95,23 +96,29 @@ export const validateDataContractInsideBundleTestSuites = async (
9596
export const waitForDataContractExecution = async (
9697
page: Page,
9798
contractId: string,
98-
resultId: string,
9999
maxConsecutiveErrors = 3
100100
) => {
101101
const { apiContext } = await getApiContext(page);
102102
let consecutiveErrors = 0;
103+
const terminalStatusPattern =
104+
/(Aborted|Success|Failed|PartialSuccess|Queued)/;
103105

104106
await expect
105107
.poll(
106108
async () => {
107109
try {
108-
const response = await apiContext
109-
.get(`/api/v1/dataContracts/${contractId}/results/${resultId}`)
110-
.then((res) => res.json());
110+
// Poll the contract entity — latestResult.status is what the backend updates
111+
// and what the UI reads. Avoids coupling to a resultId that may be stale.
112+
const contractResponse = await apiContext
113+
.get(`/api/v1/dataContracts/${contractId}`)
114+
.then((res) => (res.ok() ? res.json() : null))
115+
.catch(() => null);
111116

112-
consecutiveErrors = 0; // Reset error counter on success
117+
consecutiveErrors = 0;
113118

114-
return response.contractExecutionStatus;
119+
const status = contractResponse?.latestResult?.status;
120+
121+
return status ?? 'Running';
115122
} catch (error) {
116123
consecutiveErrors++;
117124
if (consecutiveErrors >= maxConsecutiveErrors) {
@@ -125,13 +132,11 @@ export const waitForDataContractExecution = async (
125132
},
126133
{
127134
message: 'Wait for data contract execution to complete',
128-
timeout: 300_000,
135+
timeout: 600_000,
129136
intervals: [30_000, 20_000, 10_000],
130137
}
131138
)
132-
.toEqual(
133-
expect.stringMatching(/(Aborted|Success|Failed|PartialSuccess|Queued)/)
134-
);
139+
.toEqual(expect.stringMatching(terminalStatusPattern));
135140
};
136141

137142
/**

0 commit comments

Comments
 (0)