Commit graph

243 commits

Author SHA1 Message Date
Dan Stillman
32640e2019 Wait for test success file to be written before quitting
The write is asynchronous, and on Windows the app quit before it
finished, making passing test runs report failure.
2026-08-20 12:34:40 -04:00
Dan Stillman
1d279fba5b Add executeTransactionWithForcedRollback() test helper
Runs a function within a transaction that's rolled back at the end,
with rollback callbacks guaranteed to have run by the time it returns.
Replaces try/catch blocks in existing tests that threw and caught a
marker string from executeTransaction() to force a rollback.
2026-08-09 14:22:20 -04:00
Dan Stillman
5ea6243384 fx153: ownerGlobal -> documentGlobal
Bug 2033243 renamed the attribute and moved it from EventTarget to Node.
2026-08-03 11:48:40 -04:00
Abe Jellinek
9dd17a212e Track data object versions locally
Add a clientVersion column for items, collections, searches, and
libraries, incremented once per library per transaction on every
object save or deletion. The local API reports these versions instead
of synced versions -- in object JSON, format=versions, since=
filtering, and Last-Modified-Version -- since synced versions don't
reflect local changes and are 0 for unsynced objects. Group metadata
responses keep reporting the synced group version, which has no local
counterpart.

---------

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2026-07-28 09:57:43 -04:00
Dan Stillman
ea2ee7391d Force a regular backup before all DB upgrades, and drop versioned backups
Versioned backups (zotero.sqlite.<version>.bak) were kept until the
next userdata upgrade, potentially bloating the data directory by
gigabytes, while minor upgrades made no backup at all. Now any userdata
upgrade, integrity check, or global schema update forces a rotation
backup. Since versioned backups ignored backup.numBackups, setting that
to 0 now fully disables backups, including before upgrades.
2026-07-15 17:43:29 -04:00
Dan Stillman
6e35bd1497 Focus the pane window before the focus traversal tests
Some checks are pending
CI / Test (shard 1) (push) Waiting to run
CI / Test (shard 2) (push) Waiting to run
CI / Test (shard 3) (push) Waiting to run
CI / Test (shard 4) (push) Waiting to run
CI / Utilities Tests (push) Waiting to run
CI / Build, Upload (push) Waiting to run
The #focus() Tab/Shift-Tab tests wait on focus/blur events, which fire
only while the window is active. It intermittently loses activation in
CI's Xvfb, so call win.focus() in beforeEach when the window isn't
active.
2026-07-13 17:28:00 -04:00
Dan Stillman
89880e3284 CI: Record which test drops the main window's activation
Temporary diagnostic for the intermittent shift-tab focus-test timeout.
A central afterEach in runtests.js tracks when
Services.focus.activeWindow stops being the main window; the shift-tab
test logs the last-active and first-inactive test in its timeout
message, to identify what leaves the pane inactive in CI.
2026-07-13 15:27:39 -04:00
Dan Stillman
4314494455 Include callback source in waitForCallback timeout errors
The stack for these errors is stripped as internal frames, so the error
didn't indicate which wait timed out.
2026-07-08 10:50:32 -04:00
Dan Stillman
dfd745c5d5 Log test failures that will be retried
The reporter only showed the final failure, so if a retry failed differently
(e.g., from a stub left wrapped by the first failure), the original error was
lost.
2026-07-08 10:50:32 -04:00
Dan Stillman
bd25413213 runtests.sh: Add -p option to run a shard of the test files (e.g., -p 2/4)
The sorted file list is split into contiguous chunks of roughly equal total
file size, using size as a stand-in for run time, so new test files are
included automatically and slow test files are spread across shards rather
than landing in the same shard by chance. Contiguous chunks preserve the
alphabetical run order of a full run, so files keep the same preceding files
as in a full run except at chunk starts, and a shard can be reproduced locally
by passing its first and last files to -s and -e.
2026-07-08 10:50:32 -04:00
Abe Jellinek
4b14ca9af4
Set Recently Read threshold relative to most recent item (#5878)
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
And persist cutoff within session
2026-04-07 14:10:18 -04:00
Tom Najdek
d3509ae259 Add support for test retries and enable three retries on CI 2026-03-11 14:35:39 -04:00
Dan Stillman
20735c425f
Add resetData() as lightweight alternative to resetDB() for sync tests (#5822)
resetData() clears user data and sync state using application APIs
instead of doing a full Zotero shutdown/reinit cycle, making it much
faster for tests that just need clean state between runs.

Also make Tags.init(), Creators.init(), Users.init(), and
SyncedSettings.loadAll() properly clear their caches before reloading,
so they are safe to call more than once.
2026-03-05 15:54:10 -05:00
Dan Stillman
f3c0e4fdc2 Fix error resetting group library with unsynced embedded images
https://forums.zotero.org/discussion/129373/zotero-7-8-warning-when-syncing-group-library
2026-01-29 13:22:14 -05:00
Tom Najdek
e896fd0137
Add continuous-renaming functionality for attachment files (#3860)
Resolves #1685
2025-09-11 04:54:03 -04:00
Abe Jellinek
8eb803292e Clear pane.persist in tests (#5495) 2025-08-20 02:00:31 -04:00
Abe Jellinek
f8a1a2c6ed
Don't merge into a missing snapshot attachment (#5459) 2025-08-02 01:53:47 -04:00
Dan Stillman
f81763b173 Remove Chai as Promised
A test using `assert.eventually` was failing after the Bluebird removal
but worked with just `await`, and since there hasn't really been much
point to Chai as Promised since the introduction of `async`/`await` ages
ago, just remove the library instead of figuring out why.
2025-07-30 22:31:08 -04:00
Abe Jellinek
67d2e1cead fx140: Asyncify/ESMify tests
They seem to be succeeding when run individually, but failing when
run as a whole. Not sure why yet.
2025-07-30 22:30:53 -04:00
Abe Jellinek
b9e560d33e fx140: Remove EventUtils
Unused, relied on hiddenDOMWindow.
2025-07-30 22:30:38 -04:00
Abe Jellinek
8d0923f119 fx140: Remove Bluebird
All module code runs in strict mode, and that breaks Bluebird.

And add a partial shim for the simplest and most useful methods. Not
sure if we actually want that, or if we should just replace it entirely
with native methods.
2025-07-30 22:18:35 -04:00
Abe Jellinek
78534ff2d2 FileHandlers: Infer PDF pageIndex from annotation key
And:

- Update createAnnotation() test support function to create valid EPUB
  and snapshot annotations
- Add more FileHandlers tests
2025-07-30 11:37:52 -04:00
Abe Jellinek
5e1541c5ee Extract activateZoteroPane(), try different activeness check
This should hopefully fix intermittent CI failures.
2025-07-23 11:23:36 -04:00
Adomas Venčkauskas
67b5a0bb19 Use the bundled mozilla httpd (#5148) 2025-04-22 09:47:58 -04:00
windingwind
0b8b4c0ff6
Draggable item pane sections (#5094) 2025-04-03 21:32:37 -04:00
Abe Jellinek
3c8d50dd47 Remove loadBrowserWindow() test support function (#5050)
A browser window was no longer actually needed for charset detection
(on macOS, at least, and hopefully elsewhere) because we switched to a
HiddenFrame-based hidden browser. Remaining uses now call
`loadZoteroWindow()`.
2025-02-26 03:00:04 -05:00
Dan Stillman
97329752a1 fx128: Remove Services.jsm imports
Now included automatically
2024-12-14 01:16:00 -05:00
windingwind
f3d274afeb
Item pane scroll pos fix after switching from note (#4897)
Follow up to #4879
fix: #4276
2024-12-09 02:26:20 -05:00
Dan Stillman
6740115cf2 Revert "Fix Item Pane unstable rendering during scrolling (#4879)"
Regressions:

https://forums.zotero.org/discussion/120216/blinking-item-pane-when-switching-item-with-pinned-section-in-the-sidenav
https://forums.zotero.org/discussion/120217/title-field-is-not-visible-anymore-after-creating-a-new-item-if-a-section-is-pinned-in-the-sidenav

This reverts commit 4067745c7a.
2024-12-04 01:35:04 -05:00
windingwind
4067745c7a
Fix Item Pane unstable rendering during scrolling (#4879)
Fix wrong vertical position in the Item Pane after switching from a note

fix: #4276
2024-12-02 22:42:32 -05:00
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