Skip to content

Commit d461729

Browse files
Extend test execution time (#34)
* test: use waitUntil in some tests * chore: remove import
1 parent 353a27e commit d461729

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

test/api-method-documentation.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fixture, assert, html, aTimeout, nextFrame } from '@open-wc/testing';
1+
import { fixture, assert, html, aTimeout, nextFrame, waitUntil } from '@open-wc/testing';
22
import sinon from 'sinon';
33
import { AmfLoader } from './amf-loader.js';
44
import '../api-method-documentation.js';
@@ -816,8 +816,12 @@ describe('<api-method-documentation>', () => {
816816
assert.lengthOf(element.security, 2);
817817
});
818818

819-
it('should render Headers section for AsyncAPI headers', () => {
820-
assert.exists(element.shadowRoot.querySelector('api-headers-document'));
819+
it('should render Headers section for AsyncAPI headers', async () => {
820+
await waitUntil(
821+
() => element.shadowRoot.querySelector('api-headers-document'),
822+
'api-headers-document renders',
823+
{ timeout: 1000 },
824+
);
821825
});
822826
});
823827

test/api-url.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fixture, assert, nextFrame, html } from '@open-wc/testing';
1+
import { fixture, assert, nextFrame, html, waitUntil } from '@open-wc/testing';
22
import { AmfLoader } from './amf-loader.js';
33
import '../api-url.js';
44

@@ -143,13 +143,15 @@ describe('<api-url>', function () {
143143
await nextFrame();
144144
});
145145

146-
it('should render channel', () => {
146+
it('should render channel', async () => {
147147
const channel = 'Channelsmartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured'
148+
await waitUntil(() => element.shadowRoot.querySelector('.url-channel-value'));
148149
assert.equal(element.shadowRoot.querySelector('.url-channel-value').textContent, channel);
149150
});
150151

151-
it('should render server', () => {
152+
it('should render server', async () => {
152153
const server = 'Servermqtt://api.streetlights.smartylighting.com:{port}'
154+
await waitUntil(() => element.shadowRoot.querySelector('.url-server-value'));
153155
assert.equal(element.shadowRoot.querySelector('.url-server-value').textContent, server);
154156
});
155157

0 commit comments

Comments
 (0)