Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 4fa120e

Browse files
author
Antonio Scandurra
authored
Merge pull request #1090 from atom/as/fix-test-flakiness
Try fixing flaky tests in results-view-spec.js
2 parents 3ec6b30 + bc8cb9e commit 4fa120e

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

spec/results-view-spec.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ describe('ResultsView', () => {
668668

669669
describe("copying path with find-and-replace:copy-path", () => {
670670
it("copies the selected file path to clipboard", async () => {
671+
jasmine.useRealClock()
672+
671673
projectFindView.findEditor.setText('items');
672674
atom.commands.dispatch(projectFindView.element, 'core:confirm');
673675
await searchPromise;
@@ -685,28 +687,30 @@ describe('ResultsView', () => {
685687
});
686688

687689
it("copies the selected file path to the clipboard when there are multiple project folders", async () => {
688-
const folder1 = temp.mkdirSync('folder-1')
689-
const file1 = path.join(folder1, 'sample.txt')
690-
fs.writeFileSync(file1, 'items')
690+
jasmine.useRealClock()
691691

692-
const folder2 = temp.mkdirSync('folder-2')
693-
const file2 = path.join(folder2, 'sample.txt')
694-
fs.writeFileSync(file2, 'items')
692+
const folder1 = temp.mkdirSync('folder-1')
693+
const file1 = path.join(folder1, 'sample.txt')
694+
fs.writeFileSync(file1, 'items')
695695

696-
atom.project.setPaths([folder1, folder2]);
697-
projectFindView.findEditor.setText('items');
698-
atom.commands.dispatch(projectFindView.element, 'core:confirm');
699-
await searchPromise;
696+
const folder2 = temp.mkdirSync('folder-2')
697+
const file2 = path.join(folder2, 'sample.txt')
698+
fs.writeFileSync(file2, 'items')
700699

701-
resultsView = getResultsView();
702-
await resultsView.heightInvalidationPromise;
703-
resultsView.selectFirstResult();
704-
resultsView.collapseResult();
705-
atom.commands.dispatch(resultsView.element, 'find-and-replace:copy-path');
706-
expect(atom.clipboard.read()).toBe(path.join(path.basename(folder1), path.basename(file1)));
707-
atom.commands.dispatch(resultsView.element, 'core:move-down');
708-
atom.commands.dispatch(resultsView.element, 'find-and-replace:copy-path');
709-
expect(atom.clipboard.read()).toBe(path.join(path.basename(folder2), path.basename(file2)));
700+
atom.project.setPaths([folder1, folder2]);
701+
projectFindView.findEditor.setText('items');
702+
atom.commands.dispatch(projectFindView.element, 'core:confirm');
703+
await searchPromise;
704+
705+
resultsView = getResultsView();
706+
await resultsView.heightInvalidationPromise;
707+
resultsView.selectFirstResult();
708+
resultsView.collapseResult();
709+
atom.commands.dispatch(resultsView.element, 'find-and-replace:copy-path');
710+
expect(atom.clipboard.read()).toBe(path.join(path.basename(folder1), path.basename(file1)));
711+
atom.commands.dispatch(resultsView.element, 'core:move-down');
712+
atom.commands.dispatch(resultsView.element, 'find-and-replace:copy-path');
713+
expect(atom.clipboard.read()).toBe(path.join(path.basename(folder2), path.basename(file2)));
710714
});
711715
});
712716

0 commit comments

Comments
 (0)