Commit d6644056 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '223288-fix-flakey-ide-jest-test' into 'master'

Fix flakey Web IDE editor test

Closes #223288

See merge request gitlab-org/gitlab!35000
parents d7296011 c2b84de2
...@@ -546,7 +546,7 @@ describe('RepoEditor', () => { ...@@ -546,7 +546,7 @@ describe('RepoEditor', () => {
store.state.viewer = viewerTypes.diff; store.state.viewer = viewerTypes.diff;
// we delay returning the file to make sure editor doesn't initialize before we fetch file content // we delay returning the file to make sure editor doesn't initialize before we fetch file content
await waitUsingRealTimer(10); await waitUsingRealTimer(30);
return 'rawFileData123\n'; return 'rawFileData123\n';
}); });
...@@ -555,8 +555,7 @@ describe('RepoEditor', () => { ...@@ -555,8 +555,7 @@ describe('RepoEditor', () => {
vm.file = f; vm.file = f;
// use the real timer to accurately simulate the race condition await waitForEditorSetup();
await waitUsingRealTimer(20);
expect(vm.model.getModel().getValue()).toBe('rawFileData123\n'); expect(vm.model.getModel().getValue()).toBe('rawFileData123\n');
}); });
...@@ -575,14 +574,13 @@ describe('RepoEditor', () => { ...@@ -575,14 +574,13 @@ describe('RepoEditor', () => {
}) })
.mockImplementationOnce(async () => { .mockImplementationOnce(async () => {
// we delay returning fileB content to make sure the editor doesn't initialize prematurely // we delay returning fileB content to make sure the editor doesn't initialize prematurely
await waitUsingRealTimer(10); await waitUsingRealTimer(30);
return 'fileB-rawContent\n'; return 'fileB-rawContent\n';
}); });
vm.file = fileA; vm.file = fileA;
// use the real timer to accurately simulate the race condition await waitForEditorSetup();
await waitUsingRealTimer(20);
expect(vm.model.getModel().getValue()).toBe('fileB-rawContent\n'); expect(vm.model.getModel().getValue()).toBe('fileB-rawContent\n');
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment