Commit graph

213 commits

Author SHA1 Message Date
Abe Jellinek
804b2d1216
Tests: Fix importFileAttachment() logic, update outdated test (#4475)
After dd16017
2024-07-31 16:24:19 -04:00
Abe Jellinek
dd1601793c
Don't set default attachment title if not renaming file (#4459)
Except from Rename File from Parent Metadata.
2024-07-31 01:39:25 -04:00
Abe Jellinek
833ecca364
Set automatic titles in more or less all cases (#4369)
By moving the setAutoAttachmentTitle() calls to importFromFile() /
_addToDB().

Also:

- Chop off file extension when setting the parent's title based on the
  filename in Create Parent Item -> Manual Entry.
- Fix Manual Entry not renaming the attachment correctly by awaiting
  createEmptyParent().
2024-07-14 23:37:24 -04:00
Dan Stillman
cd43e95b85 Fix build failure from 42d4064bac 2024-06-24 02:53:48 -04:00
Dan Stillman
173f4c491e Tests: Don't auto-select collections and searches after creation
This changes `createDataObject()` to pass `skipSelect: true` for objects
other than items. If a test is creating a bunch of collections, there's
no reason for each one to be selected and for an items list to start to
load. If a test does need a new collection or search to be selected, it
can call the new convenience function `await select(win, obj)`, which
will select the passed object in the collection tree and wait for its
items list to load. I'm hoping this reduces random test failures due to
items list churn.
2024-06-24 02:45:20 -04:00
Dan Stillman
aaac18ced6 Tests: Add convenience function to pause execution without timing out
`await pause(this)` can be used to disable the test timeout and pause
execution so the UI state can be manually inspected
2024-06-24 02:45:20 -04:00
Dan Stillman
42d4064bac Tests: Add additional convenience functions for object selection
Objects can now be selected in the UI with just `await select(win, obj)`
2024-06-24 02:45:19 -04:00
windingwind
91c0c28b5d Fix attachments & annotation box refresh bugs and add tests (#4031)
Fixes #3993
Fixes #3995
Closes #4082
2024-05-15 06:45:01 -04:00
Dan Stillman
9ffb430207 Return baseURL from startHTTPServer() test support function
Since it should almost always just be `http://localhost:${port}/`
2024-04-20 06:41:57 -04:00
Dan Stillman
4fe0ebc63b Fix skipBundledFiles not being passed to Zotero.reinit() in tests
Making tests much slower

Regression from 2051f08b4c
2024-04-16 06:09:59 -04:00
Dan Stillman
b3d07a5ddf Remove initPDFToolsPath() call 2024-04-06 16:16:04 -04:00
Dan Stillman
20d6cde85f Remove obsolete initPDFToolsPath() in tests 2024-04-06 04:38:33 -04:00
Dan Stillman
920461cd9d fx115: Update lots of OS.File/OS.Path uses 2024-03-30 00:58:54 -04:00
Dan Stillman
33db3c28fc fx115: Restore test runner 2024-03-30 00:58:53 -04:00
windingwind
6f466b25bd Fix Item pane "should refresh on file rename" test 2024-01-24 23:32:20 -05:00
Dan Stillman
ce1bdba37a Sort tests case-insensitively and without "Test.js"
So HiddenBrowserTest.js doesn't run before advancedSearchTest.js and
zoteroPaneTest.js doesn't run before zoteroTest.js
2024-01-24 04:03:35 -05:00
Abe Jellinek
8d825f641a
Fix segfault when hyphenating text in main process (#3388) 2023-09-14 02:48:50 -04:00
Abe Jellinek
85cade3fb2
Make preferences less janky, preload panes on hover, allow panes to delay visibility until promise resolves (#3363)
Prevents flashes of unlocalized labels and controls without values set.
Makes switching panes feel speedier overall because of preloading.

I thought there was an issue for the flashes of uninitialized content but can't
find it now.
2023-08-26 05:57:38 -04:00
Dan Stillman
fb96cd595d Add startHTTPServer() support function
Centralize httpd creation and add automatic retry to try to deal with
NS_ERROR_SOCKET_ADDRESS_IN_USE errors in CI.
2023-08-16 01:16:49 -04:00
Dan Stillman
9dd182e9ca Collection tree selection fixes
Fixes various logic around what gets selected when collections and
searches are moved to or restored from the trash (which has never been
exposed) or when they're erased
2023-08-11 04:16:42 -04:00
Dan Stillman
722287b81a Switch back to @mozilla.org/browser/clh;1 and fix tests
In Firefox 102, `-file` was being swallowed by `nsBrowserContentHandler`
in BrowserContentHandler.jsm, so ab7d916e0 overrode that by using the
same contract id for our main nsICommandLineHandler in
zotero-service.js. But `nsBrowserContentHandler` also handles `-chrome`,
which we were using in tests to pass runtests.html. There's no need to
pass in dynamically though -- we can just hard-code that and open the
window ourselves.
2023-05-24 08:21:16 -04:00
Dan Stillman
8fc94a5560 Z7: Fix loadPrefPane() test support function 2023-04-29 04:21:09 -04:00
Dan Stillman
5f631ff0af Add delay() test support function
`Zotero.Promise.delay()` wrapper
2023-04-28 01:54:00 -04:00
Dan Stillman
68a6441b16 Continue generating citeProcJSExport test data
Since it's needed by zotero/utilities
2023-04-02 19:05:53 -04:00
Dan Stillman
430118f071 Write out path when generating item type/field data for tests
It writes to the build folder, so it's easy to think it's not working.
2023-04-01 16:34:43 -04:00
Abe Jellinek
8d75f37548
fx-compat: Add preferences with full-text/keyword search (#2659) 2022-08-10 18:26:23 -04:00
Dan Stillman
54529ab461 fx-compat: Pass dialog as second argument to waitForDialog() in tests
Makes it easier to run dialog.getButton(), etc.
2022-06-20 19:30:28 -04:00
Dan Stillman
4a3ff46bd7 fx-compat: Fix waitForWindow()/waitForDialog() in tests 2022-06-19 04:16:53 -04:00
Dan Stillman
0dd088e98d Add loadZoteroWindow() support function for tests
`loadBrowserWindow()` will need to be updated for loading remote URLs,
but anything needing a Zotero window (including `loadZoteroPane()`) can
use this.
2022-06-17 20:24:43 -04:00
Dan Stillman
730e86d661 fx-compat: Restore tests and test using actual Zotero executable
The test runner now uses the Zotero executable from
`zotero-standalone-build/staging` rather than the Firefox from
`zotero-standalone-build/xulrunner`. Along with testing the actual
program, this restores visible UI updates during tests, which should
make debugging various things easier. We can also now remove anything
related to Zotero being an extension.

Many tests are still broken, but this at least lets us start running
them.
2022-06-17 20:24:43 -04:00
Abe Jellinek
29b270e761 fx-compat: Fix progress queue / Find Available PDFs 2022-05-24 13:52:52 -06:00
Dan Stillman
03242e8984 fx-compat: DB.executeTransaction() no longer takes generator functions 2022-05-12 02:38:59 -04:00
Dan Stillman
c7ece79f79 Fix missing creators not being removed in item.fromJSON()
Apparently there's been a bug for years where removing a creator
remotely hasn't caused it to be removed locally via sync...

https://forums.zotero.org/discussion/94910/desktop-app-not-correctly-syncing
2022-03-09 02:43:22 -05:00
Dan Stillman
96347d4333 Fix error generate sample type/field data for tests 2022-03-05 06:03:44 -05:00
Dan Stillman
0e0bd0586b Update assignProps call in createUnsavedDataObject() 2022-02-21 21:22:46 -05:00
Dan Stillman
72ac453a8c Set createdByUserID to current user for locally created group item
Addresses #2322
2022-02-19 13:47:28 -05:00
Dan Stillman
5a0cd78f06 Enable PDF reader by default and enable for groups
"Zotero" is now the first and default option in the "Open PDFs using"
drop-down in the General pane of the preferences.
2022-01-31 06:48:05 -05:00
Adomas Venčkauskas
cbbff600a6 XUL -> JS tree megacommit
- Just a single huge commit. This has been developed over too long a
time, required many tiny changes across too many files and has seen too
many iterations to be separated into separate commits.
The original branch with all the messy commits will be kept around for
posterity
bb220ad0f2...adomasven:feature/react-item-tree
- Replaces XUL <tree> element across the whole zotero client codebase
with a custom supermegafast virtualized-table inspired by
react-virtualized yet mimicking old XUL treeview API. The
virtualized-table sits on top on a raw-to-the-metal,
interpreted-at-runtime JS based windowing solution inspired by
react-window. React-based solutions could not be used because they were
slow and Zotero UI needs to be responsive and be able to
display thousands of rows in a treeview without any slowdowns.
- Attempts were made at making this screen-reader friendly, but yet to
be tested with something like JAWS
- RTL-friendly
- Styling and behaviour across all platforms was copied as closely as
possible to the original XUL tree
- Instead of row-based scroll snapping this has smooth-scrolling. If
you're using arrow keys to browse through the tree then it effectively
snap-scrolls. Current CSS snap scroll attributes do not seem to work in
the way we would require even on up-to-date browsers, yet alone the ESR
version of FX that Zotero is on. JS solutions are either terrible for
performance or produce inexcusable jitter.
- When dragging-and-dropping items the initial drag freezes the UI for
a fairly jarring amount of time. Does not seem to be fixable due to
the synchronous code that needs to be run in the dragstart handler.
Used to be possible to run that code async with the XUL tree.
- Item tree column picker no longer has a dedicated button. Just
right-click the columns. The column preferences (width, order, etc) are
no longer handled by XUL, which required a custom serialization and
storage solution that throws warnings in the developer console due to
the amount of data being stored. Might cause temporary freezing on HDDs
upon column resize/reorder/visibility toggling.
- Context menu handling code basically unchanged, but any UI changes
that plugins may have wanted to do (including adding new columns) will
have to be redone by them. No serious thought has gone into how plugin
developers would achieve that yet.
- Opens up the possibility for awesome alternative ways to render the
tree items, including things like multiple-row view for the item tree,
which has been requested for a long while especially by users switching
from other referencing software
2021-08-21 06:58:12 -04:00
Dan Stillman
eac98d1c2e Add test for 4.0 → 5.0 DB upgrade
With a mechanism for specifying a zipped DB copy to use as the initial
DB when resetting the DB in tests
2021-08-17 00:41:59 -04:00
Dan Stillman
f80ba89971 Massively speed up tests
- Make a copy of the database after first initialization that can be
  swapped in when reinitializing in resetDB()
- Avoid unnecessary one-second delay on every reset

Probably more that can be done, but this should take minutes off the
test runs
2021-06-24 06:10:40 -04:00
J. Ryan Stinnett
bb9b796efe Tweak test runner to support more directories
This expands the test filtering in the test runner so that you can supply e.g.
`test/tests/feed*` from your shell in the `zotero` directory and correctly
filter to all feed-related tests.
2021-05-11 10:05:59 +01:00
Dan Stillman
76d8818bed Don't count missing annotation values as changed if empty string passed
Similar to 0d377a1c4a, this fixes an unnecessary annotation reload and
loss of unsaved typing on auto-sync immediately after an annotation is
created.
2021-04-26 03:49:59 -04:00
Dan Stillman
b566c06f93 Add getImageBlob() support function for tests 2021-03-21 14:36:43 -04:00
Dan Stillman
06b28194da Show annotation widget in conflict resolution window
This adds a very basic reimplementation of the annotation widget for use
in the CR window. It's not pixel-perfect, but it's close enough that
most people probably won't notice. We'll want to replace this with a
real version that's shared between the PDF reader and the rest of the
codebase.

Image annotations currently show an "[image not shown]" placeholder.
Showing images is tricky: we don't have the remote cache image, so if
the remote position has changed, we could only show an image by
rendering it from the file, and only if the file itself hasn't changed.
Just for a better user experience, we could use the local image as long
as the position and file are both the same, but that would take some
rejiggering of the CR window.

Tags aren't shown because they're not shown for CR at all, though that
could be changed in the future.
2021-03-21 14:36:43 -04:00
Dan Stillman
ebc0ca2462 Add annotationIsExternal property to annotations 2021-03-02 17:58:28 -05:00
Dan Stillman
199619f40e Remove .noteSchemaVersion
This leaves item.note in place, rather than reverting all the
`getNote()` → `.note` changes. We can consider which we want to keep.
2021-03-02 17:36:05 -05:00
Dan Stillman
2536edb6ab Fix annotation 'position' handling and update additional sortIndex tests
Item.position has to be a string. It still gets passed to/from the PDF
reader as an object.
2021-03-02 17:36:05 -05:00
Dan Stillman
a94323fc15 Sort multiple levels of items when generating API JSON
Added Zotero.DataObjects.sortByParent() to sort child items immediately
after their parent items. Zotero.DataObjects.sortByLevel(), which is
used for collections, sorts each level together, but that's less
appropriate for items where, e.g., an embedded-image attachment should
immediately follow the note that depends on it.
2021-03-02 17:36:05 -05:00
Dan Stillman
f662b58331 Update tests after sortIndex length change 2021-03-02 17:36:05 -05:00
Dan Stillman
ebc53a2bbc Add noteSchemaVersion, and replace item.getNote() with .note
```
var noteContents = item.note; // was item.getNote()
var schemaVersion = item.noteSchemaVersion;

item.setNote(contents) // default to Zotero.Notes.schemaVersion
item.setNote(contents, schemaVersion) - explicit version
```
2021-03-02 17:36:05 -05:00