@dxos/react-ui 0.1.35 → 0.1.36
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/dist/lib/browser/chunk-5VRACIDE.mjs +10 -0
- package/dist/lib/browser/chunk-5VRACIDE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +231 -181
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +45 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +5 -5
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts +8 -17
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/shell-manager.d.ts +16 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
- package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/InvitationList/InvitationList.tsx +2 -2
- package/src/components/InvitationList/InvitationListContainer.tsx +3 -2
- package/src/components/InvitationList/InvitationListItem.tsx +4 -8
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +3 -12
- package/src/composites/Shell/Shell.tsx +4 -4
- package/src/composites/Shell/ShellContext.tsx +11 -8
- package/src/panels/DevicesPanel/DevicesPanel.tsx +3 -1
- package/src/panels/JoinPanel/JoinPanel.tsx +8 -8
- package/src/panels/JoinPanel/joinMachine.ts +108 -98
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +7 -7
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +14 -14
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +9 -9
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +10 -10
- package/src/panels/SpacePanel/SpacePanel.tsx +19 -4
- package/src/playwright/invitations-manager.ts +23 -78
- package/src/playwright/invitations.spec.ts +147 -139
- package/src/testing/index.ts +5 -0
- package/src/testing/shell-manager.ts +61 -0
- package/src/util/invitationStatusValue.ts +3 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { Locator, Page, FrameLocator } from 'playwright';
|
|
6
|
+
|
|
7
|
+
type Scope = Locator | FrameLocator | Page;
|
|
8
|
+
|
|
9
|
+
export class ShellManager {
|
|
10
|
+
page!: Page;
|
|
11
|
+
|
|
12
|
+
authenticatorIsVisible(type: 'device' | 'space', scope?: Scope) {
|
|
13
|
+
return (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).isVisible();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
invitationFailed(scope?: Scope) {
|
|
17
|
+
return (scope || this.page).getByTestId('invitation-rescuer-reset').isVisible();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async inputInvitation(type: 'device' | 'space', invitation: string, scope?: Scope) {
|
|
21
|
+
await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input`).type(invitation);
|
|
22
|
+
await this.page.keyboard.press('Enter');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async invitationInputContinue(type: 'device' | 'space', scope?: Scope) {
|
|
26
|
+
await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input-continue`).click();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async cancelInvitation(type: 'device' | 'space', kind: 'host' | 'guest', scope?: Scope) {
|
|
30
|
+
if (kind === 'guest') {
|
|
31
|
+
await (scope || this.page)
|
|
32
|
+
.getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-cancel`)
|
|
33
|
+
.click();
|
|
34
|
+
} else {
|
|
35
|
+
await (scope || this.page).getByTestId('cancel-invitation').nth(0).click();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async authenticateInvitation(type: 'device' | 'space', authCode: string, scope?: Scope) {
|
|
40
|
+
const peer = scope || this.page;
|
|
41
|
+
// TODO(wittjosiah): Update ids.
|
|
42
|
+
await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).type(authCode);
|
|
43
|
+
await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-next`).click();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async clearAuthCode(type: 'device' | 'space', scope?: Scope) {
|
|
47
|
+
const peer = scope || this.page;
|
|
48
|
+
await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill('');
|
|
49
|
+
await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).focus();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async resetInvitation(scope?: Scope) {
|
|
53
|
+
await (scope || this.page).getByTestId('invitation-rescuer-reset').click();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async doneInvitation(type: 'device' | 'space', scope?: Scope) {
|
|
57
|
+
await (scope || this.page)
|
|
58
|
+
.getByTestId(type === 'device' ? 'halo-invitation-accepted-done' : 'space-invitation-accepted-done')
|
|
59
|
+
.click();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -16,6 +16,7 @@ export const invitationStatusValue = new Map<Invitation.State, number>([
|
|
|
16
16
|
[Invitation.State.INIT, 0],
|
|
17
17
|
[Invitation.State.CONNECTING, 1],
|
|
18
18
|
[Invitation.State.CONNECTED, 2],
|
|
19
|
-
[Invitation.State.
|
|
20
|
-
[Invitation.State.
|
|
19
|
+
[Invitation.State.READY_FOR_AUTHENTICATION, 3],
|
|
20
|
+
[Invitation.State.AUTHENTICATING, 4],
|
|
21
|
+
[Invitation.State.SUCCESS, 5]
|
|
21
22
|
]);
|