Skip to content

Commit 9ef7874

Browse files
authored
fix: Update waiting time parameter to fix flaky editAdapter test (apache#3790)
* fix: Update waiting time parameter to fix flaky editAdapter test * fix: Refactor saveEditProperty calls to use ConnectBtns for consistency
1 parent 6b8cec9 commit 9ef7874

File tree

7 files changed

+670
-105
lines changed

7 files changed

+670
-105
lines changed

ui/cypress/support/utils/connect/ConnectBtns.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class ConnectBtns {
2323
public static deleteAdapter() {
2424
return cy.dataCy('delete-adapter', { timeout: 10000 });
2525
}
26+
2627
public static editAdapter() {
2728
return cy.dataCy('edit-adapter');
2829
}
@@ -99,6 +100,10 @@ export class ConnectBtns {
99100
}
100101

101102
public static saveEditProperty() {
103+
cy.dataCy('sp-save-edit-property', { timeout: 10000 }).should(
104+
'have.length',
105+
1,
106+
);
102107
return cy.dataCy('sp-save-edit-property', { timeout: 10000 });
103108
}
104109

ui/cypress/support/utils/connect/ConnectEventSchemaUtils.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class ConnectEventSchemaUtils {
4848
ConnectBtns.markAsTimestampBtn().click();
4949

5050
// Close
51-
cy.dataCy('sp-save-edit-property').click();
51+
ConnectBtns.saveEditProperty().click();
5252

5353
this.eventSchemaNextBtnEnabled();
5454
}
@@ -80,7 +80,6 @@ export class ConnectEventSchemaUtils {
8080
}).click({ force: true });
8181
ConnectBtns.timestampStringRegex().should('have.value', timestampRegex);
8282

83-
ConnectBtns.saveEditProperty().should('have.length', 1);
8483
ConnectBtns.saveEditProperty().click();
8584
}
8685

@@ -122,19 +121,15 @@ export class ConnectEventSchemaUtils {
122121
.contains('Multiply')
123122
.click();
124123

125-
cy.dataCy('sp-save-edit-property').click();
124+
ConnectBtns.saveEditProperty().click();
126125
cy.dataCy('edit-' + propertyName.toLowerCase(), {
127126
timeout: 10000,
128127
}).click({ force: true });
129128
cy.dataCy('connect-schema-correction-value', { timeout: 10000 }).should(
130129
'have.value',
131130
value,
132131
);
133-
cy.dataCy('sp-save-edit-property', { timeout: 10000 }).should(
134-
'have.length',
135-
1,
136-
);
137-
cy.dataCy('sp-save-edit-property').click();
132+
ConnectBtns.saveEditProperty().click();
138133
}
139134

140135
public static renameProperty(
@@ -196,7 +191,7 @@ export class ConnectEventSchemaUtils {
196191
propertyValue,
197192
);
198193

199-
cy.dataCy('sp-save-edit-property').click();
194+
ConnectBtns.saveEditProperty().click();
200195

201196
// validate that static value is persisted
202197
ConnectEventSchemaUtils.clickEditProperty(propertyName);
@@ -205,7 +200,7 @@ export class ConnectEventSchemaUtils {
205200
'have.value',
206201
propertyValue,
207202
);
208-
cy.dataCy('sp-save-edit-property').click();
203+
ConnectBtns.saveEditProperty().click();
209204
}
210205

211206
public static deleteProperty(propertyName: string) {
@@ -251,16 +246,15 @@ export class ConnectEventSchemaUtils {
251246
.get('mat-option')
252247
.contains(dataType)
253248
.click();
254-
cy.dataCy('sp-save-edit-property').click();
249+
ConnectBtns.saveEditProperty().click();
255250
// validate that static value is persisted
256251
cy.dataCy('edit-' + propertyName.toLowerCase(), {
257252
timeout: 10000,
258253
}).click({
259254
force: true,
260255
});
261256
ConnectBtns.changeRuntimeType().contains(dataType);
262-
cy.wait(1000);
263-
cy.dataCy('sp-save-edit-property').click();
257+
ConnectBtns.saveEditProperty().click();
264258
}
265259

266260
private static checkIfWarningIsShown(warningIsShown: boolean) {

ui/cypress/support/utils/connect/ConnectUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ export class ConnectUtils {
100100
public static addMachineDataSimulator(
101101
name: string,
102102
persist: boolean = false,
103+
waitingTime: string = '1000',
103104
) {
104105
const builder = AdapterBuilder.create('Machine_Data_Simulator')
105106
.setName(name)
106-
.addInput('input', 'wait-time-ms', '1000');
107+
.addInput('input', 'wait-time-ms', waitingTime);
107108

108109
if (persist) {
109110
builder.setTimestampProperty('timestamp').setStoreInDataLake();

ui/cypress/tests/connect/editAdapter.smoke.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('Test Edit Adapter', () => {
7676
});
7777

7878
it('Successfully edit adapter with persistence pipeline', () => {
79-
ConnectUtils.addMachineDataSimulator('simulator', true);
79+
ConnectUtils.addMachineDataSimulator('simulator', true, '100');
8080

8181
ConnectUtils.goToConnect();
8282

ui/cypress/tests/connect/editAdapterValuesAndFields.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('Test Edit Adapter', () => {
6161
.get('mat-option')
6262
.contains('Multiply')
6363
.click();
64-
cy.dataCy('sp-save-edit-property').click();
64+
ConnectBtns.saveEditProperty().click();
6565
cy.dataCy('sp-event-schema-next-button').click();
6666

6767
// Fill in adapter name and close view
@@ -96,7 +96,7 @@ describe('Test Edit Adapter', () => {
9696
.contains('Float')
9797
.click();
9898
cy.dataCy('connect-schema-correction-value').clear();
99-
cy.dataCy('sp-save-edit-property').click();
99+
ConnectBtns.saveEditProperty().click();
100100
cy.get('[class="general-panel"]').should(
101101
'include.text',
102102
'test-property-1',

0 commit comments

Comments
 (0)