Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Reuse test windows during integration suites #4618

Merged
merged 1 commit into from
Aug 1, 2013

Conversation

jasonsanjose
Copy link
Member

  • Updates CodeHint, FileIndexManager and LiveDevelopment integration suites to reuse the same test window.
  • Adds private CodeHintManager._removeHintProvider method to restore CodeHintManager state for unit tests

@jasonsanjose
Copy link
Member Author

@TomMalbran want to review?

.done(function (result) {
allFiles = result;
});
describe("multiple requests", function () {
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes in this file look bad, but I simply isolated the following 2 specs since they can't share a test window with others:

  • should handle differing simultaneous requests without doing extra work
  • should handle identical simultaneous requests without doing extra work

Copy link
Contributor

Choose a reason for hiding this comment

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

You can add ?w=1 to the github URL for the file diff to get it to ignore whitespace. (Unfortunately you can't comment in that view.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, that make it much easier to review it.

It would be great to have a diff that showed different the code that was moved around. Makes the diff huge and nothing really changed.

@TomMalbran
Copy link
Contributor

@jasonsanjose Done with an initial review. I am seeing a failure in should push in memory css changes made before the session starts timeout: timed out after 1000 msec waiting for success SpecRunnerUtils.openProjectFiles. Are you getting that too?

@ghost ghost assigned TomMalbran Aug 1, 2013
@jasonsanjose
Copy link
Member Author

I'm actually seeing a different failure in that spec should push in memory css changes made before the session starts that I could only reproduce twice

TypeError: Cannot read property 'styleSheetId' of undefined
    at Object.reloadCSSForDocument (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/LiveDevelopment/Agents/CSSAgent.js:96:46)
    at CSSDocument.onChange (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/LiveDevelopment/Documents/CSSDocument.js:172:18)
    at Document.x.event.dispatch (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/thirdparty/jquery-2.0.1.min.js:5:9843)
    at Document.x.event.add.y.handle (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/thirdparty/jquery-2.0.1.min.js:5:6626)
    at Object.x.event.trigger (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/thirdparty/jquery-2.0.1.min.js:5:8968)
    at x.fn.extend.triggerHandler (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/thirdparty/jquery-2.0.1.min.js:5:14754)
    at Document._handleEditorChange (file://localhost/Applications/Brackets%20Sprint%2028.app/Contents/dev/src/document/Document.js:372:17)

@TomMalbran
Copy link
Contributor

I haven't seen that error, but I still get the one I mentioned. Occasionally it doesn't appear. The weird part is that the file stills open and the live development is done.

One thing I noticed is that testWindow.closeAllDocuments closes the documents but doesn't discards the changes done. So when reopening them, you get the with the old changes. I feel it will be saved to use testWindow.closeAllFiles (implemented in #4598) which closes the open files and discards the changes.

@TomMalbran
Copy link
Contributor

I was somehow able to get the same failure that you mention and also saw it at should reapply in-memory css changes after saving changes in html document.

Increasing the files to open timeout to 1000 seems to have fixed the other failure I mentioned.

@jasonsanjose
Copy link
Member Author

I'm trying to fix the failure in should close inline editor when file deleted on disk (see #4598) you saw in the inline editor pull request. I'll let you know when I'm done.

@jasonsanjose
Copy link
Member Author

Hmm, I tried calling in DocumentManager.closeAll() in a normal brackets session from dev tools. When I dirtied a file then reopened it, the file came back clean with no edits. I followed the call stack and closeAll eventually does the right thing and destroys the editor...I didn't see anything obvious in the test that would cause what you saw.

I prefer closeAllFiles though since it seems cleaner to call the actual command. I'll make the change.

@jasonsanjose
Copy link
Member Author

@TomMalbran ready for review. I fixed the inline editor test failure and after increasing the timeout I haven't reproduce the live dev failures.

@TomMalbran
Copy link
Contributor

When running the live development test, without closing the window at the end, check the files. Open "simple1.css" into the working set, and you should see it dirty. Maybe the Document/Editor was never destroyed.

I actually tried using closeAllDocuments on the EditorOptionsTests and all tests started to fail since the initial text wasn't the same as what expected as it was the test after the edition from the previous test.

I'll check the new changes.

@jasonsanjose
Copy link
Member Author

Ok, I'll try that out. I had to back out one change to DocumentCommandHandlers-test because the spies on Dialog prevented closeAllFiles from working properly.

@TomMalbran
Copy link
Contributor

Sounds good. If the test don't care about the content of the file, like the DocumentCommandHandler tests, DocumentManager.closeAll is good. We could also update FILE_CLOSE_ALL to receive a dontShowUI option so that it doesn't show it. I still don't get why I can see the older changes when reopening the files.

The InlineEditors tests work fine. Wasn't able to reproduce the failure. But I did still saw the timeout in the Live Development tests since the default timeout is 1000 and the new timeout is still 1000. I haven't seen any errors with 5000 or 10000 as a timeout on files.

By the way, at which amount of commits we ask for a rebase?

…nager and live dev

fix jshint error

code review comments

optimize project rewrite for inlineeditor tests

fix failing inline editor test by forcing FileIndexManager to sync

replace closeAllDocuments with closeAllFiles

increase timeout for openProjectFiles

Use DocumentManager.closeAll() to prevent accidental usage of spies set in Dialog.showSaveDialog
@jasonsanjose
Copy link
Member Author

Just rebased! :)

I'm happy with these changes even with that one live development failure. If you're happy and want to merge I can see if this improves run time on our build machines.

@TomMalbran
Copy link
Contributor

Sure, maybe the test run a bit slower on my computer with all the stuff I have open anyway. And the test doesn't always fail.

Merging.

TomMalbran added a commit that referenced this pull request Aug 1, 2013
…dows

Reuse test windows during integration suites
@TomMalbran TomMalbran merged commit 3855dc6 into master Aug 1, 2013
@TomMalbran TomMalbran deleted the jasonsanjose/integration-test-windows branch August 1, 2013 23:14
@TomMalbran
Copy link
Contributor

Let me know if it improved or if anything failed :)

@jasonsanjose
Copy link
Member Author

Much improved so far. Finished under 6 minutes on windows and under 4 minutes on mac. I'll need a few more test runs to feel confident. For the last month or so they would hit the 15min timeout. Our current theory is that we've got a memory leak (#4185) that is magnified in the test runs due to how many new windows we open.

@TomMalbran
Copy link
Contributor

Awesome :)

I was checking Documentmanager.closeAll and it seems to work fine. Maybe what I see is a result of the failure test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants