Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken tests #1111

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/spec/provider/bpmn/EscalationProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('provider/bpmn - EscalationProps', function() {
elementRegistry.get('EscalationIntermediateEvent_1')
];

escalationElements.forEach(async (element) => {
for (const element of escalationElements) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣


// when
await act(() => {
Expand All @@ -87,9 +87,14 @@ describe('provider/bpmn - EscalationProps', function() {

// then
const select = domQuery('select[name=escalationRef]', container);
expect(select.value).to.eql(getEscalation(element).get('id'));
});
const escalation = getEscalation(element);

expect(select).to.exist;

if (escalation) {
expect(select.value).to.eql(escalation.get('id'));
}
}
}));


Expand Down
16 changes: 8 additions & 8 deletions test/spec/provider/bpmn/SignalProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('provider/bpmn - SignalProps', function() {
elementRegistry.get('IntermediateThrowEvent_1')
];

plainElements.forEach(async (ele) => {
for (const ele of plainElements) {

// when
await act(() => {
Expand All @@ -77,7 +77,7 @@ describe('provider/bpmn - SignalProps', function() {
// then
const signalRefSelect = domQuery('select[name=signalRef]', container);
expect(signalRefSelect).to.be.null;
});
}

})
);
Expand All @@ -94,7 +94,7 @@ describe('provider/bpmn - SignalProps', function() {
elementRegistry.get('SignalCatchEvent_1')
];

signalElements.forEach(async (ele) => {
for (const ele of signalElements) {

// when
await act(() => {
Expand All @@ -104,7 +104,7 @@ describe('provider/bpmn - SignalProps', function() {
// then
const signalRefSelect = domQuery('select[name=signalRef]', container);
expect(signalRefSelect.value).to.eql(getSignal(ele).get('id'));
});
}
}));


Expand Down Expand Up @@ -290,7 +290,7 @@ describe('provider/bpmn - SignalProps', function() {
elementRegistry.get('IntermediateThrowEvent_1')
];

plainElements.forEach(async (ele) => {
for (const ele of plainElements) {

// when
await act(() => {
Expand All @@ -301,7 +301,7 @@ describe('provider/bpmn - SignalProps', function() {
const signalNameInput = domQuery('input[name=signalName]', container);

expect(signalNameInput).to.be.null;
});
}
})
);

Expand All @@ -317,7 +317,7 @@ describe('provider/bpmn - SignalProps', function() {
elementRegistry.get('SignalCatchEvent_1')
];

signalElements.forEach(async (ele) => {
for (const ele of signalElements) {
await act(() => {
selection.select(ele);
});
Expand All @@ -327,7 +327,7 @@ describe('provider/bpmn - SignalProps', function() {

// then
expect(signalNameInput.value).to.eql(getSignal(ele).get('name'));
});
}
}));


Expand Down
30 changes: 15 additions & 15 deletions test/spec/provider/zeebe/BusinessRuleImplementationProps.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import TestContainer from 'mocha-test-container-support';

import {
act
act,
waitFor
} from '@testing-library/preact';

import {
Expand Down Expand Up @@ -119,6 +120,8 @@ describe('provider/zeebe - BusinessRuleImplementationProps', function() {
}));


// TODO(@barmac): this test is fails as false-positive when run locally on MacOS as part of the full test suite,
// cf. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1111#pullrequestreview-2635770727
it('should display dmn', inject(async function(elementRegistry, selection) {

// given
Expand All @@ -138,6 +141,8 @@ describe('provider/zeebe - BusinessRuleImplementationProps', function() {
}));


// TODO(@barmac): this test is fails as false-positive when run locally on MacOS as part of the full test suite,
// cf. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1111#pullrequestreview-2635770727
it('should display jobWorker', inject(async function(elementRegistry, selection) {

// given
Expand Down Expand Up @@ -367,19 +372,14 @@ function getTaskHeaders(element) {
return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[ 0 ];
}

async function expectEdited(container, exists) {
function expectEdited(container, exists) {
return waitFor(() => {
const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

await wait(50);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the waitFor utility from testing-library not work here, and keeping the test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know but it failed even after rewrite. I can try again today.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is how it looks with waitFor, but it fails on MacOS in chromeheadless: 9abdfdb
It works in .only though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked how the test suite behaves with different test suites, and it is green when I run only provider tests, but starts to fail when everything is included. Perhaps it's a slow clean up that jams on a local machine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My advice would be: Let's keep this test. If absolutely needed, ignore parts of it on MacOS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK in that case I am adding a warning for the future ourselves: aeb3e65


const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
});
}

function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
12 changes: 8 additions & 4 deletions test/spec/provider/zeebe/ConditionProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,25 @@ describe('provider/zeebe - ConditionProps', function() {
it('should display', inject(async function(elementRegistry, selection) {

// given
const elements = [ 'Flow2', 'Flow3', 'Flow4' ];
const elements = [
'Flow2',
'Flow3',
'Flow4'
];

elements.forEach(async ele => {
for (const ele of elements) {
const sequenceFlow = elementRegistry.get(ele);

// when
await act(() => {
selection.select(sequenceFlow);
});

const conditionExpressionInput = domQuery('input[name=conditionExpression]', container);
const conditionExpressionInput = domQuery('[id=bio-properties-panel-conditionExpression]', container);

// then
expect(conditionExpressionInput).to.exist;
});
}
}));


Expand Down
30 changes: 15 additions & 15 deletions test/spec/provider/zeebe/ScriptImplementationProps.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import TestContainer from 'mocha-test-container-support';

import {
act
act,
waitFor
} from '@testing-library/preact';

import {
Expand Down Expand Up @@ -120,6 +121,8 @@ describe('provider/zeebe - ScriptImplementationProps', function() {
}));


// TODO(@barmac): this test is fails as false-positive when run locally on MacOS as part of the full test suite,
// cf. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1111#pullrequestreview-2635770727
it('should display script', inject(async function(elementRegistry, selection) {

// given
Expand All @@ -139,6 +142,8 @@ describe('provider/zeebe - ScriptImplementationProps', function() {
}));


// TODO(@barmac): this test is fails as false-positive when run locally on MacOS as part of the full test suite,
// cf. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1111#pullrequestreview-2635770727
it('should display jobWorker', inject(async function(elementRegistry, selection) {

// given
Expand Down Expand Up @@ -346,19 +351,14 @@ function getTaskHeaders(element) {
return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[ 0 ];
}

async function expectEdited(container, exists) {
function expectEdited(container, exists) {
return waitFor(() => {
const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

await wait(50);

const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
});
}

function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
28 changes: 13 additions & 15 deletions test/spec/provider/zeebe/UserTaskImplementationProps.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import TestContainer from 'mocha-test-container-support';

import {
act
act,
waitFor
} from '@testing-library/preact';

import {
Expand Down Expand Up @@ -100,6 +101,8 @@ describe('provider/zeebe - UserTaskImplementationProps', function() {
}));


// TODO(@barmac): this test is fails as false-positive when run locally on MacOS as part of the full test suite,
// cf. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1111#pullrequestreview-2635770727
it('should display zeebe user task', inject(async function(elementRegistry, selection) {

// given
Expand Down Expand Up @@ -242,19 +245,14 @@ function getZeebeUserTask(element) {
}


async function expectEdited(container, exists) {
function expectEdited(container, exists) {
return waitFor(() => {
const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

await wait(50);

const indicator = domQuery(`${GROUP_SELECTOR} .bio-properties-panel-dot`, container);

if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
if (exists) {
expect(indicator).to.exist;
} else {
expect(indicator).not.to.exist;
}
});
}

function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Loading