@dovetail-ts/test-support 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/dovetail-harness.d.ts +18 -0
- package/dist/fake-clock.d.ts +21 -0
- package/dist/fake-indexeddb.d.ts +6 -0
- package/dist/fake-transport.d.ts +70 -0
- package/dist/harnesses/demo/pane.d.ts +17 -0
- package/dist/harnesses/ember/dead-letters.d.ts +20 -0
- package/dist/harnesses/ember/editor.d.ts +14 -0
- package/dist/harnesses/ember/presence.d.ts +52 -0
- package/dist/harnesses/ember/status.d.ts +15 -0
- package/dist/harnesses/ember.d.ts +5 -0
- package/dist/harnesses/inspector/inspector.d.ts +27 -0
- package/dist/harnesses/inspector.d.ts +1 -0
- package/dist/harnesses/notifications/activity-feed.d.ts +14 -0
- package/dist/harnesses/notifications/inbox-button.d.ts +14 -0
- package/dist/harnesses/notifications/inbox.d.ts +58 -0
- package/dist/harnesses/notifications/toast-bridge.d.ts +13 -0
- package/dist/harnesses/notifications.d.ts +4 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +814 -0
- package/dist/index.js.map +1 -0
- package/dist/network-switch.d.ts +30 -0
- package/package.json +54 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @dovetail-ts/test-support
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 480744b: First release of Dovetail: real-time and offline sync for Ember.
|
|
8
|
+
|
|
9
|
+
- `@dovetail-ts/core`: the connection life cycle, live store subscriptions, the optimistic ledger with rebase and rollback, the offline write queue in IndexedDB with a leader tab and dead letters, `DocSession` and `PresenceRoom`.
|
|
10
|
+
- `@dovetail-ts/warp-drive`: the store feed into WarpDrive.
|
|
11
|
+
- `@dovetail-ts/crdt`, `crdt-yjs`, `crdt-loro` and `crdt-automerge`: one `DocEngine` interface with three engines.
|
|
12
|
+
- `@dovetail-ts/tiptap`: co-editing in Tiptap 3 with carets, per-user undo, versions and comment threads.
|
|
13
|
+
- `@dovetail-ts/ember`, `notifications` and `inspector`: presence and status components, the inbox, toasts and activity feeds, and a dev panel.
|
|
14
|
+
- `@dovetail-ts/server`, the transports (`transport-ws`, `transport-sse`, `transport-cable`) and `conformance`: a Node server and one wire protocol that the Rails gems also pass.
|
|
15
|
+
- Adapters for Hocuspocus, Liveblocks, PartyKit and Supabase, and integrations for Switchyard, Millwork, Benchdog and Lattice. The Neon adapter is not in 1.0: it waits for a stable Neon Realtime client (1.1).
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [480744b]
|
|
20
|
+
- @dovetail-ts/protocol@1.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joe Gaudet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dovetail-ts/test-support
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Harnesses, a fake transport, a fake clock, a fake IndexedDB and a network switch for Dovetail tests.
|
|
4
|
+
|
|
5
|
+
Part of [Dovetail](https://joegaudet.com/dovetail/). Not released yet.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentHarness } from '@harnessed-ts/core';
|
|
2
|
+
import type { EnvConfig, Selector } from '@harnessed-ts/core';
|
|
3
|
+
/**
|
|
4
|
+
* The base of the Dovetail harnesses. Each component harness extends it and sets its own host
|
|
5
|
+
* with `@Harness({ host })`. The base reads the two things that each Dovetail component shows:
|
|
6
|
+
* its state (the `data-state` attribute of the host) and its text.
|
|
7
|
+
*
|
|
8
|
+
* The base itself finds `data-test-dovetail` (or the test id attribute of the driver).
|
|
9
|
+
* `DovetailHarness.at(env, selector)` reads any element.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DovetailHarness extends ComponentHarness {
|
|
12
|
+
/** A harness of this class on the element of `host`, in place of the host of the class. */
|
|
13
|
+
static at<T extends DovetailHarness>(this: new (env: EnvConfig, parentScope?: readonly Selector[]) => T, env: EnvConfig, host: Selector, parentScope?: readonly Selector[]): T;
|
|
14
|
+
/** The `data-state` attribute of the host, or null. */
|
|
15
|
+
state(): Promise<string | null>;
|
|
16
|
+
/** The text of the host, without the white space at the ends. */
|
|
17
|
+
text(): Promise<string>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A clock that moves only when a test tells it to. It has the timer methods of the browser,
|
|
3
|
+
* so a test gives it to the code in place of the real timers: backoff, heartbeats, the
|
|
4
|
+
* delays of the fake transport.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FakeClock {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(start?: number);
|
|
9
|
+
/** The time in milliseconds, as `Date.now()`. */
|
|
10
|
+
now(): number;
|
|
11
|
+
/** The number of timers that have not run yet. */
|
|
12
|
+
get pending(): number;
|
|
13
|
+
setTimeout(run: () => void, delay?: number): number;
|
|
14
|
+
clearTimeout(id: number | undefined): void;
|
|
15
|
+
setInterval(run: () => void, every: number): number;
|
|
16
|
+
clearInterval(id: number | undefined): void;
|
|
17
|
+
/** Moves the clock `ms` forward, and runs each timer that comes due, in time order. */
|
|
18
|
+
tick(ms: number): void;
|
|
19
|
+
/** Runs each timer, also the timers that they set, and moves the clock to the last one. */
|
|
20
|
+
runAll(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Puts an empty in-memory IndexedDB on `scope` (the global scope by default), for the queue
|
|
3
|
+
* and the doc store tests on Node. Each call gives a new, empty `indexedDB`. Returns a function
|
|
4
|
+
* that puts back what was there before.
|
|
5
|
+
*/
|
|
6
|
+
export declare function installFakeIndexedDB(scope?: object): () => void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ClientMessage, ClientTransport, CloseInfo, Message, ServerMessage, ServerTransport, Transport } from '@dovetail-ts/protocol';
|
|
2
|
+
import type { FakeClock } from './fake-clock';
|
|
3
|
+
import { NetworkSwitch } from './network-switch';
|
|
4
|
+
/** The timer methods that the hub uses: a FakeClock, or the global scope. */
|
|
5
|
+
type Timers = Pick<FakeClock, 'setTimeout'>;
|
|
6
|
+
export interface FakeHubOptions {
|
|
7
|
+
/** Schedules each delivery. Without it, deliveries use the real `setTimeout`. */
|
|
8
|
+
clock?: Timers;
|
|
9
|
+
/** The network between the clients and the hub. Without it, the network is always online. */
|
|
10
|
+
network?: NetworkSwitch;
|
|
11
|
+
}
|
|
12
|
+
/** One end of a connection. The other end is `peer`. */
|
|
13
|
+
declare class End<Out extends Message, In extends Message> implements Transport<Out, In> {
|
|
14
|
+
#private;
|
|
15
|
+
readonly link: Link;
|
|
16
|
+
/** The side whose messages this end gets. */
|
|
17
|
+
readonly from: 'client' | 'server';
|
|
18
|
+
peer: End<In, Out> | undefined;
|
|
19
|
+
constructor(link: Link,
|
|
20
|
+
/** The side whose messages this end gets. */
|
|
21
|
+
from: 'client' | 'server');
|
|
22
|
+
get isOpen(): boolean;
|
|
23
|
+
open(): Promise<void>;
|
|
24
|
+
/** Sends a message. It goes on the wire as text, so the other end gets a copy. */
|
|
25
|
+
send(message: Out): void;
|
|
26
|
+
close(code?: number, reason?: string): void;
|
|
27
|
+
onMessage(listener: (message: In) => void): () => void;
|
|
28
|
+
onClose(listener: (info: CloseInfo) => void): () => void;
|
|
29
|
+
markOpen(): void;
|
|
30
|
+
/** Gets a frame from the wire. A frame that is not a valid message closes the connection. */
|
|
31
|
+
receive(text: string): void;
|
|
32
|
+
closed(info: CloseInfo): void;
|
|
33
|
+
}
|
|
34
|
+
/** A connection between one client end and one server end. */
|
|
35
|
+
declare class Link {
|
|
36
|
+
#private;
|
|
37
|
+
readonly hub: FakeHub;
|
|
38
|
+
readonly client: End<ClientMessage, ServerMessage>;
|
|
39
|
+
readonly server: End<ServerMessage, ClientMessage>;
|
|
40
|
+
constructor(hub: FakeHub);
|
|
41
|
+
open(): Promise<void>;
|
|
42
|
+
/** Delivers a frame to the end `to`, after the delay of the network. */
|
|
43
|
+
carry(to: {
|
|
44
|
+
receive(text: string): void;
|
|
45
|
+
} | undefined, text: string): void;
|
|
46
|
+
close(info: CloseInfo): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* An in-page server for tests and for the demo of the marketing page. Each `connect()` gives a
|
|
50
|
+
* client transport. When it opens, the hub gives its server end to each `onConnection`
|
|
51
|
+
* listener. Messages go as text through `parseMessage`, as on a real wire, and arrive after the
|
|
52
|
+
* delay of the network switch.
|
|
53
|
+
*/
|
|
54
|
+
export declare class FakeHub {
|
|
55
|
+
#private;
|
|
56
|
+
readonly network: NetworkSwitch;
|
|
57
|
+
readonly timers: Timers;
|
|
58
|
+
constructor(options?: FakeHubOptions);
|
|
59
|
+
/** The number of open connections. */
|
|
60
|
+
get connections(): number;
|
|
61
|
+
/** A new client transport. It connects on `open()`. */
|
|
62
|
+
connect(): ClientTransport;
|
|
63
|
+
/** Calls `listener` with the server end of each new connection. Returns a function that stops it. */
|
|
64
|
+
onConnection(listener: (peer: ServerTransport) => void): () => void;
|
|
65
|
+
/** @internal */
|
|
66
|
+
accept(link: Link): void;
|
|
67
|
+
/** @internal */
|
|
68
|
+
release(link: Link): void;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* One pane of the live demo (`test-app/app/demo/pane.gts`): the offline switch and the comment
|
|
4
|
+
* form. Each pane has its own test id, so find it with
|
|
5
|
+
* `DemoPaneHarness.at(ember(), testId('demo-pane-ana'))`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DemoPaneHarness extends DovetailHarness {
|
|
8
|
+
#private;
|
|
9
|
+
/** True when the offline switch of the pane is on. */
|
|
10
|
+
isOffline(): Promise<boolean>;
|
|
11
|
+
/** Turns on the offline switch. It does nothing when the pane is offline. */
|
|
12
|
+
goOffline(): Promise<void>;
|
|
13
|
+
/** Turns off the offline switch. It does nothing when the pane is online. */
|
|
14
|
+
goOnline(): Promise<void>;
|
|
15
|
+
/** Types `text` in the comment field and sends the form. */
|
|
16
|
+
comment(text: string): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<Dovetail::DeadLetters>`: the writes that the server refused. `state()` is `empty` or
|
|
4
|
+
* `failed`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DeadLettersHarness extends DovetailHarness {
|
|
7
|
+
#private;
|
|
8
|
+
/** The text of the hidden live region, for example `1 change failed`. Empty with no failures. */
|
|
9
|
+
summary(): Promise<string>;
|
|
10
|
+
/** The size of the hidden live region on the screen, as `width x height`. Hidden is `1x1`. */
|
|
11
|
+
summarySize(): Promise<string>;
|
|
12
|
+
/** The name of each failed write, for example `Save note 1`. */
|
|
13
|
+
titles(): Promise<string[]>;
|
|
14
|
+
/** Why the server refused each write. */
|
|
15
|
+
reasons(): Promise<string[]>;
|
|
16
|
+
/** Sends the write at `index` again. */
|
|
17
|
+
retry(index: number): Promise<void>;
|
|
18
|
+
/** Removes the write at `index`. Its change rolls back. */
|
|
19
|
+
discard(index: number): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<Dovetail::Editor>`: a Tiptap editor that co-edits a document. `state()` is `loading` until
|
|
4
|
+
* the doc session starts, then `syncing`, and `synced` when the server has each local change.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EditorHarness extends DovetailHarness {
|
|
7
|
+
#private;
|
|
8
|
+
/** Replaces the content of the editor with `text`, as a user who types it. */
|
|
9
|
+
type(text: string): Promise<void>;
|
|
10
|
+
/** The text of the editor. The name labels of the remote carets are in it too. */
|
|
11
|
+
content(): Promise<string>;
|
|
12
|
+
/** The names of the peers whose caret the editor shows. */
|
|
13
|
+
carets(): Promise<string[]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Query } from '@harnessed-ts/core';
|
|
2
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
3
|
+
/** The size of the element of `query` on the screen, as `width x height` in whole pixels. */
|
|
4
|
+
export declare function sizeOf(query: Query): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* `<Dovetail::AvatarStack>`: the people in a room. `state()` is `empty` or `present`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AvatarStackHarness extends DovetailHarness {
|
|
9
|
+
#private;
|
|
10
|
+
/** The names of the visible avatars, in order. The local user has the name it has. */
|
|
11
|
+
names(): Promise<string[]>;
|
|
12
|
+
/** The status of each visible avatar: `online` or `away`. */
|
|
13
|
+
statuses(): Promise<string[]>;
|
|
14
|
+
/** The accessible label of each visible avatar, for example `Ben, away`. */
|
|
15
|
+
labels(): Promise<string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* The size of each accessible label on the screen, as `width x height` in whole pixels. A
|
|
18
|
+
* visually hidden label is `1x1` or smaller.
|
|
19
|
+
*/
|
|
20
|
+
labelSizes(): Promise<string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* The image URL that each visible avatar gives to its image, in order. An empty string when the
|
|
23
|
+
* avatar has no image, for example when the URL policy refuses the URL of the peer.
|
|
24
|
+
*/
|
|
25
|
+
imageUrls(): Promise<string[]>;
|
|
26
|
+
/** The number of people that the overflow count holds. 0 when it does not show. */
|
|
27
|
+
overflow(): Promise<number>;
|
|
28
|
+
/** Puts the pointer on the avatar at `index`. Its tooltip opens. */
|
|
29
|
+
hoverAvatar(index: number): Promise<void>;
|
|
30
|
+
/** Moves the keyboard focus to the avatar at `index`. Its tooltip opens. */
|
|
31
|
+
focusAvatar(index: number): Promise<void>;
|
|
32
|
+
/** The text of the open tooltip. */
|
|
33
|
+
tooltip(): Promise<string>;
|
|
34
|
+
}
|
|
35
|
+
/** `<Dovetail::Typing>`: who types. `state()` is `idle` or `typing`; `text()` is the message. */
|
|
36
|
+
export declare class TypingHarness extends DovetailHarness {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `<Dovetail::LiveCursors>`: the pointers of the peers over a container. A pointer position is
|
|
40
|
+
* a fraction (0 to 1) of the size of the container.
|
|
41
|
+
*/
|
|
42
|
+
export declare class LiveCursorsHarness extends DovetailHarness {
|
|
43
|
+
#private;
|
|
44
|
+
/** Puts the local pointer in the container. */
|
|
45
|
+
pointIn(): Promise<void>;
|
|
46
|
+
/** The names on the remote pointers, in order. */
|
|
47
|
+
cursorNames(): Promise<string[]>;
|
|
48
|
+
/** The position of the pointer of `name`, as `x,y` fractions, or null with no such pointer. */
|
|
49
|
+
position(name: string): Promise<string | null>;
|
|
50
|
+
/** The color of each remote pointer (the `--dovetail-cursor` property), in order. */
|
|
51
|
+
colors(): Promise<string[]>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<Dovetail::ConnectionBadge>`. `state()` is `online`, `connecting`, `reconnecting` or
|
|
4
|
+
* `offline`. `text()` is the label, for example `Offline · 3 queued`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ConnectionBadgeHarness extends DovetailHarness {
|
|
7
|
+
/** The number of queued writes that the badge shows. */
|
|
8
|
+
queued(): Promise<number>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `<Dovetail::SyncStatus>`. `state()` is `saved`, `syncing` or `offline`. `text()` is the
|
|
12
|
+
* message, for example `Syncing 3 changes`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SyncStatusHarness extends DovetailHarness {
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AvatarStackHarness, LiveCursorsHarness, TypingHarness } from './ember/presence';
|
|
2
|
+
export { DeadLettersHarness } from './ember/dead-letters';
|
|
3
|
+
export { ConnectionBadgeHarness, SyncStatusHarness } from './ember/status';
|
|
4
|
+
export { EditorHarness } from './ember/editor';
|
|
5
|
+
export { DemoPaneHarness } from './demo/pane';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<DovetailInspector>` of `@dovetail-ts/inspector`. `state()` is the state of the connection
|
|
4
|
+
* (`idle`, `connecting`, `open`, `reconnecting`, `offline` or `closed`), or `none` without a
|
|
5
|
+
* connection.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InspectorHarness extends DovetailHarness {
|
|
8
|
+
/** Each transition of the connection, oldest first: `connect: idle → connecting`. */
|
|
9
|
+
history(): Promise<string[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Each room of the connection, with its feed cursor and its holders: `note:1 @ 3 (2 holders)`
|
|
12
|
+
* (or `note:1 (1 holder)`).
|
|
13
|
+
*/
|
|
14
|
+
rooms(): Promise<string[]>;
|
|
15
|
+
/** The number of holders of each room (`Connection.holders`), in the order of `rooms()`. */
|
|
16
|
+
holders(): Promise<number[]>;
|
|
17
|
+
/** The number of writes in the queue. */
|
|
18
|
+
queued(): Promise<number>;
|
|
19
|
+
/** Each dead letter: `upsert note 1 (422): The title is empty`. */
|
|
20
|
+
deadLetters(): Promise<string[]>;
|
|
21
|
+
/** Each ledger error: `upsert note 1 (422): The title is empty`. */
|
|
22
|
+
errors(): Promise<string[]>;
|
|
23
|
+
/** Each peer of each presence room: `board:1: Ben (online)`. */
|
|
24
|
+
peers(): Promise<string[]>;
|
|
25
|
+
/** Each document: `note:1 body: synced` or `note:1 body: syncing`. */
|
|
26
|
+
docs(): Promise<string[]>;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InspectorHarness } from './inspector/inspector';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<Dovetail::ActivityFeed>`: the live list of activity groups. Its state is `empty`,
|
|
4
|
+
* `loading` or `ready`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ActivityFeedHarness extends DovetailHarness {
|
|
7
|
+
private accessor texts;
|
|
8
|
+
private accessor loadOlderButton;
|
|
9
|
+
/** The texts of the groups, the newest first, as "ana edited 3 notes". */
|
|
10
|
+
groups(): Promise<string[]>;
|
|
11
|
+
/** True when the "Load older" button is there. */
|
|
12
|
+
hasMore(): Promise<boolean>;
|
|
13
|
+
loadOlder(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* `<Dovetail::InboxButton>`: the button with the unread count. Its state is `unread` or
|
|
4
|
+
* `empty`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InboxButtonHarness extends DovetailHarness {
|
|
7
|
+
private accessor badge;
|
|
8
|
+
/** The unread count that the badge shows, as text. `0` when the badge is not there. */
|
|
9
|
+
unread(): Promise<string>;
|
|
10
|
+
/** The accessible name of the button, as "Inbox, 3 unread". */
|
|
11
|
+
label(): Promise<string | null>;
|
|
12
|
+
/** Presses the button. */
|
|
13
|
+
click(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/** One notification of the inbox. Its state is `unread` or `read`. */
|
|
3
|
+
export declare class NotificationRowHarness extends DovetailHarness {
|
|
4
|
+
private accessor body;
|
|
5
|
+
private accessor markReadButton;
|
|
6
|
+
private accessor archiveButton;
|
|
7
|
+
/** The text of the notification. */
|
|
8
|
+
text(): Promise<string>;
|
|
9
|
+
markRead(): Promise<void>;
|
|
10
|
+
archive(): Promise<void>;
|
|
11
|
+
/** True when the item has a "Mark as read" button. */
|
|
12
|
+
canMarkRead(): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `<Dovetail::Inbox>`: the panel with the Unread and All tabs. Its state is `loading`,
|
|
16
|
+
* `error`, `empty` or `ready`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class InboxHarness extends DovetailHarness {
|
|
19
|
+
private accessor unreadTab;
|
|
20
|
+
private accessor allTab;
|
|
21
|
+
private accessor markAllButton;
|
|
22
|
+
private accessor loadMoreButton;
|
|
23
|
+
private accessor emptyState;
|
|
24
|
+
private accessor errorState;
|
|
25
|
+
private accessor retryButton;
|
|
26
|
+
private accessor texts;
|
|
27
|
+
/** The notification at `index` of the open tab. */
|
|
28
|
+
notification(index: number): NotificationRowHarness;
|
|
29
|
+
/** The texts of the notifications of the open tab, top to bottom. */
|
|
30
|
+
notifications(): Promise<string[]>;
|
|
31
|
+
/** The states (`unread` or `read`) of the notifications of the open tab. */
|
|
32
|
+
states(): Promise<(string | null)[]>;
|
|
33
|
+
/** The text of the selected tab, as "Unread 2" or "All". */
|
|
34
|
+
selectedTab(): Promise<string>;
|
|
35
|
+
/** Presses a key (as `ArrowRight`) on the selected tab. The arrow keys move between the tabs. */
|
|
36
|
+
pressOnTab(key: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* The accessible name of the element with the keyboard focus (its `aria-label`, or else its
|
|
39
|
+
* text), or null when the focus is not in the inbox. Harnessed has no query for the focus, so
|
|
40
|
+
* this reads the document of the browser driver.
|
|
41
|
+
*/
|
|
42
|
+
focused(): Promise<string | null>;
|
|
43
|
+
showUnread(): Promise<void>;
|
|
44
|
+
showAll(): Promise<void>;
|
|
45
|
+
markRead(index: number): Promise<void>;
|
|
46
|
+
archive(index: number): Promise<void>;
|
|
47
|
+
markAllRead(): Promise<void>;
|
|
48
|
+
/** True when "Mark all as read" can be pressed. */
|
|
49
|
+
canMarkAllRead(): Promise<boolean>;
|
|
50
|
+
/** True when the "Load more" button is there. */
|
|
51
|
+
hasMore(): Promise<boolean>;
|
|
52
|
+
loadMore(): Promise<void>;
|
|
53
|
+
/** The text of the empty state, or null when it is not there. */
|
|
54
|
+
emptyText(): Promise<string | null>;
|
|
55
|
+
/** The text of the error state, or null when it is not there. */
|
|
56
|
+
errorText(): Promise<string | null>;
|
|
57
|
+
retry(): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DovetailHarness } from '../../dovetail-harness';
|
|
2
|
+
/**
|
|
3
|
+
* The toasts that `<Dovetail::ToastBridge>` shows in the Joinery `<Toaster>`. The host is the
|
|
4
|
+
* region of the Toaster ("Notifications alt+T"). `@ember-joinery/test-support` is not a
|
|
5
|
+
* dependency, so this harness reads the toasts by their roles.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ToastBridgeHarness extends DovetailHarness {
|
|
8
|
+
private accessor items;
|
|
9
|
+
/** The text of each toast, the newest first. */
|
|
10
|
+
toasts(): Promise<string[]>;
|
|
11
|
+
/** The type of each toast (`default`, `success`, `warning` or `error`), the newest first. */
|
|
12
|
+
types(): Promise<(string | null)[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ActivityFeedHarness } from './notifications/activity-feed';
|
|
2
|
+
export { InboxButtonHarness } from './notifications/inbox-button';
|
|
3
|
+
export { InboxHarness, NotificationRowHarness } from './notifications/inbox';
|
|
4
|
+
export { ToastBridgeHarness } from './notifications/toast-bridge';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DovetailHarness } from './dovetail-harness';
|
|
2
|
+
export { FakeClock } from './fake-clock';
|
|
3
|
+
export { installFakeIndexedDB } from './fake-indexeddb';
|
|
4
|
+
export { FakeHub } from './fake-transport';
|
|
5
|
+
export type { FakeHubOptions } from './fake-transport';
|
|
6
|
+
export { NetworkSwitch } from './network-switch';
|
|
7
|
+
export type { NetworkMode, NetworkSwitchOptions } from './network-switch';
|
|
8
|
+
export * from './harnesses/ember';
|
|
9
|
+
export * from './harnesses/notifications';
|
|
10
|
+
export * from './harnesses/inspector';
|