Commit graph

1267 commits

Author SHA1 Message Date
Dan Stillman
c19a597766 Create 1000x400 browser windows for tests 2015-05-07 15:09:41 -04:00
Dan Stillman
37f5669319 Fix making an item a child item if it's in any collections 2015-05-07 15:09:40 -04:00
Dan Stillman
3a995d64a4 Fix saving of tags 2015-05-06 04:23:31 -04:00
Dan Stillman
26e1372f46 Throw an error if item type isn't set when saving
And add a test for throwing from setField(), which already happens.
2015-05-06 04:20:47 -04:00
Dan Stillman
7879e5432a Fix new attachment charset saving, which I definitely didn't test before 2015-05-06 04:20:45 -04:00
Dan Stillman
33eaaffd83 Fix Date Modified handling when saving items 2015-05-06 04:19:20 -04:00
Dan Stillman
01f04802f0 Fix loadAllData() on regular items without notes
Set a flag when setting the item type that instructs loadAllData()
whether to attempt to call loadNote()
2015-05-05 15:57:37 -04:00
Dan Stillman
beb17436f8 Don't mark parentKey as changed when set to false for an unsaved item
And return undefined for search objects
2015-05-05 15:57:37 -04:00
Dan Stillman
93a6a4ffdb Don't mark an empty field set to an empty string as changed
And some tests
2015-05-05 15:57:36 -04:00
Dan Stillman
0cefa03827 Add initial Zotero.DataObject test 2015-05-05 03:17:51 -04:00
Dan Stillman
18714a4fcb Default to user library for saved searches
For consistency with collections and items
2015-05-05 03:17:51 -04:00
Dan Stillman
c18f31aeab Show Firefox UI when using loadBrowserWindow() in tests
The window created by loadWindow() is still empty, but this removes the
'chrome' flag for loadBrowserWindow(), which causes the Firefox UI to be
shown.

I think openDialog calls are always chrome, but providing just the
chrome flag disables all other options (e.g., navbar).
2015-05-05 02:53:08 -04:00
Dan Stillman
7975835b5e Disable lookup and recognizePDF tests until they work 2015-05-05 02:53:08 -04:00
Dan Stillman
2313c1930d Get selected item ids directly in collection tests 2015-05-05 02:53:08 -04:00
Dan Stillman
09f08d63ea Skip default browser check 2015-05-05 02:53:08 -04:00
Dan Stillman
02a36eab9b Fix various issues with rapid UI/data changes due to asyncification 2015-05-05 02:53:06 -04:00
Dan Stillman
2ca53677f8 Don't resave collection with no parent after .parentKey = false 2015-05-05 02:52:26 -04:00
Dan Stillman
e96f091754 Remove delays after new collections in collectionTreeView tests
Since UI updates now happen before returning from save()
2015-05-04 02:46:39 -04:00
Dan Stillman
6328d1f39b CollectionTreeView::selectLibrary() doesn't need to be async 2015-05-04 02:45:56 -04:00
Dan Stillman
16d79c5cbf Add missing sample file for attachment test 2015-05-04 02:45:55 -04:00
Dan Stillman
8fec5ace3a Fix post-save textbox focusing bugs in right-hand pane
Fix a couple cases of lost text field focus after an edit, including
focusing of the Title field after using New Item when a field is already
being edited and has a changed value.

Also, in tests, select My Library and wait for items to load when using
the loadZoteroPane() support function. We could add a parameter to skip
that or move it to a separate function, but the code to detect it is a
bit convoluted and it's a prerequisite for many tests, so it's handy to
have a function for it.
2015-05-04 02:45:55 -04:00
Dan Stillman
bdd44e9a44 DB isolation changes and item selection tweaks
- Add an 'exclusive' option to transactions that causes them to block other
  transactions and wait for other transactions to finish before starting,
  instead of nesting
- Resolve Zotero.DB.waitForTransaction() promise before returning from
  executeTransaction()
- A side effect of the above: wait for a newly created item to be selected in
  the middle pane and rendered in the right-hand pane before returning from
  executeTransaction()
- Don't save items multiple times when adding/removing a non-final creator in
  the Info pane
- Use a simpler, non-recursive method for focusing the next field in the Info
  pane; this prevents "too much recursion" errors if something causes the
  right-hand pane not to be rendered when expected
2015-05-04 02:45:55 -04:00
Dan Stillman
4a0018ec63 Fix transaction detection
This fixes an issue where two transactions started around the same time
could run separately instead of nesting, causing the statements from one
to end up running not within a transaction
2015-05-04 02:45:55 -04:00
Dan Stillman
43a2045aec Change computerProgram 'version' to 'versionNumber'
And use 'version' instead of 'itemVersion' for object version for items

Also add deferred foreign key checking to system.sql so that DROP TABLE
commands don't fail mid-transaction
2015-05-04 02:45:53 -04:00
Dan Stillman
afe0412c58 Collection/item tree view updates
- Pass .skipSelect option to data object .save() to prevent new objects
  from being selected
- Fix miscellaneous bugs
- Selection-related tests
2015-05-04 02:43:32 -04:00
Dan Stillman
322339876e Add Zotero.Date.isISODate() and Zotero.Date.isoToSQL() 2015-05-04 02:41:14 -04:00
Dan Stillman
e8d4b3e840 Add Zotero.Item.prototype.attachmentFilename 2015-05-04 02:41:14 -04:00
Aurimas Vinckevicius
2566ca27e0 Don't report translator failures from tests 2015-05-02 15:30:25 -05:00
Dan Stillman
8c32210507 Test for nested transaction failures 2015-04-26 18:08:26 -04:00
Dan Stillman
ba9adffa68 Use variables for temp table names in DB tests 2015-04-26 18:08:26 -04:00
Dan Stillman
0471a393eb Always return promise from Zotero.Attachments._postProcessFile() 2015-04-26 18:08:26 -04:00
Dan Stillman
b241d3ec52 Add loadBrowserWindow() test support function 2015-04-26 18:08:25 -04:00
Dan Stillman
f4b6e22817 Disable browser UI tour in test profile 2015-04-26 18:08:25 -04:00
Dan Stillman
1c372f7892 Remove extra debug lines in item test 2015-04-26 18:08:25 -04:00
Dan Stillman
99dfc72a18 Fix collection saving 2015-04-26 18:08:25 -04:00
Dan Stillman
a2b572665d Make libraryID optional for DataObjects, defaulting to user library 2015-04-26 17:51:29 -04:00
Dan Stillman
db2348f100 Tests for data layer and item fixes/changes 2015-04-25 03:17:42 -04:00
Dan Stillman
9e3e680be8 Rework DB transaction handling
Rollback callbacks weren't being properly called, and some other things were in
the wrong place, particularly with nested transactions.
2015-04-25 03:17:41 -04:00
Dan Stillman
f78b18c692 Fix ES6 warning calling UInt8Array without 'new' 2015-04-25 03:17:40 -04:00
Dan Stillman
4b040c78a7 Fix various saved search bugs, and add tests
Search condition ids are now indexed from 0, and always saved
contiguously (no more 'fixGaps' option), since they're just in an array
in the API. (They're still returned as an object from
Zotero.Search.prototype.getConditions() because it's easier for the
advanced search window to not have to deal with shifting ids between
saves.)
2015-04-17 19:29:37 -04:00
Dan Stillman
d9c32a8e90 Fix search saving, and add some unit tests
Also:

- Return an object from `Zotero.Search.prototype.getConditions()`
  instead of an array.
- Add support function `getPromiseError(promise)` to return the error
  thrown from a chain of promises, or false if none. (We could make an
  `assert.throwsAsync()`, but this allows testing of various properties
  such as `.name`, which even the built-in `assert.throws()` can't
  test.)
- Clarify some search save errors
2015-04-17 00:25:09 -04:00
Dan Stillman
51c7ae6e5c Add -b option to skip translator/style installation in tests
'b' for *b*undled files

Translators and styles take a long time to install and initialize in
source installations, and they're unnecessary for many tests.

This shaves about 10 seconds off each test run for me on one system (and
that's with some help from filesystem caching).
2015-04-16 20:50:15 -04:00
Dan Stillman
973e602cfc Enable Bluebird generator support in Mocha
Promise-yielding ES6 generator functions can now be used for test
functions, and they'll automatically be wrapped with Bluebird's
coroutine().
2015-04-15 01:35:53 -04:00
Dan Stillman
384a547693 Merge branch '4.0' into api_syncing
Conflicts:
	chrome/content/zotero/lookup.js
2015-04-15 00:56:25 -04:00
Dan Stillman
96f3cc1861 Enable debug.time pref in tests 2015-04-15 00:48:03 -04:00
Dan Stillman
71d2aa9337 Update resetDB test for async DB 2015-04-15 00:45:59 -04:00
Dan Stillman
6dfdae870e Q -> Bluebird in tests 2015-04-13 03:44:59 -04:00
Dan Stillman
9511c43432 Create empty data directory in test profile
This prevents the data directory migration prompt from showing up if
there's an existing data directory inside the Standalone profile.
2015-04-12 20:28:50 -04:00
Aurimas Vinckevicius
f6510419cb Skip test for "recognizePDF without DOI" on Travis-CI
Breaks due to CAPTCHA when tests are run frequently
2015-04-06 23:17:41 -05:00
Aurimas Vinckevicius
ac363101fc Always use latest Firefox version and echo it for tests
Don't echo version on Windows, because it hangs Firefox
Also add testing with Firefox Beta (and prior ESR, but commented out for now, since we don't support it and we know it breaks)
2015-04-06 23:16:44 -05:00
Aurimas Vinckevicius
cc173ff1e5 Trim down ISSN/ISBN test for characters that should not be ignored 2015-03-30 16:28:12 -05:00
Aurimas Vinckevicius
a6e9f0aea0 Add tests for ISSN/ISBN-related Zotero.Utilities functions 2015-03-25 21:25:38 -05:00
Aurimas Vinckevicius
9624f6fac3 Fix runtests.sh to work with cygwin 2015-03-24 02:13:09 -05:00
Dan Stillman
7519287fa8 Fix JS version declaration for test support scripts 2015-03-24 02:27:33 -04:00
Simon Kornblith
a5ce4d2a66 Lengthen timeout for ISBN tests
I think the failures are actually LoC timing out.
2015-03-11 14:37:52 -04:00
Simon Kornblith
3583793571 Wait for bundled file updates to complete before running tests 2015-03-11 13:32:25 -04:00
Simon Kornblith
8253b98134 Remove index.js and just enumerate the files in the test directory 2015-03-09 17:41:49 -04:00
Simon Kornblith
4c45685331 Add header to EventUtils.jsm 2015-03-09 17:40:58 -04:00
Simon Kornblith
4a4073652f updateBundledFiles before using translators and wait for completion 2015-03-09 17:17:53 -04:00
Simon Kornblith
c2d32c2e27 Just give up on trying to automate the panel itself 2015-03-09 16:49:50 -04:00
Simon Kornblith
c7c58f8343 Add support function to reset the DB and a test that it works. 2015-03-09 14:25:49 -04:00
Simon Kornblith
b6673511f7 Close recognizePDF windows when tests finish 2015-03-08 19:28:33 -04:00
Simon Kornblith
299009dcd5 Add unit tests for add item by identifier and some support refactoring
Also adds EventUtils from MozMill to simplify UI automation.
2015-03-08 19:28:27 -04:00
Simon Kornblith
218917f367 Add unit test for PDF recognition without DOI 2015-03-08 16:20:57 -04:00
Simon Kornblith
3f0f7af71a Add unit test for PDF recognition with DOI
Also some support code that was useful here and will probably be
useful for other tests. This is a pretty complicated thing to test, but
it seems to work.
2015-03-08 16:02:10 -04:00
Simon Kornblith
50cd396918 Make debugging tests a bit easier
- Add command-line argument to enable debug logging
- Add command-line argument to open (and leave open) jsconsole
- Try to print error stack traces (although Mocha doesn't seem to like
  them?)
2015-03-07 22:17:44 -05:00
Simon Kornblith
1c32db68da Unit testing infrastructure
Implements the beginnings of unit testing infrastructure using
mocha/chai. The unit tests can be run locally using test/runtests.sh,
although this will need tweaks to run on Windows. They should also run
on commit using Travis-CI.

The unit tests themselves live in test/tests. The index.js file
specifies separate test sets, which can be run individually by calling
test/runtests.sh <testsets>. Right now there is only a single unit
test, but hopefully we'll have more soon...
2015-03-07 16:34:55 -05:00