@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.
Files changed (50) hide show
  1. package/dist/lib/browser/chunk-5VRACIDE.mjs +10 -0
  2. package/dist/lib/browser/chunk-5VRACIDE.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +231 -181
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +45 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -1
  9. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
  10. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
  11. package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -1
  12. package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +1 -1
  13. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +5 -5
  14. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
  15. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +1 -1
  16. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
  17. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +2 -2
  18. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
  19. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +2 -2
  20. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
  21. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +2 -2
  22. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
  23. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
  24. package/dist/types/src/playwright/invitations-manager.d.ts +8 -17
  25. package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
  26. package/dist/types/src/testing/index.d.ts +2 -0
  27. package/dist/types/src/testing/index.d.ts.map +1 -0
  28. package/dist/types/src/testing/shell-manager.d.ts +16 -0
  29. package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
  30. package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -1
  31. package/package.json +25 -14
  32. package/src/components/InvitationList/InvitationList.tsx +2 -2
  33. package/src/components/InvitationList/InvitationListContainer.tsx +3 -2
  34. package/src/components/InvitationList/InvitationListItem.tsx +4 -8
  35. package/src/composites/JoinDialog/JoinDialog.stories.tsx +3 -12
  36. package/src/composites/Shell/Shell.tsx +4 -4
  37. package/src/composites/Shell/ShellContext.tsx +11 -8
  38. package/src/panels/DevicesPanel/DevicesPanel.tsx +3 -1
  39. package/src/panels/JoinPanel/JoinPanel.tsx +8 -8
  40. package/src/panels/JoinPanel/joinMachine.ts +108 -98
  41. package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +7 -7
  42. package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +14 -14
  43. package/src/panels/JoinPanel/view-states/InvitationInput.tsx +9 -9
  44. package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +10 -10
  45. package/src/panels/SpacePanel/SpacePanel.tsx +19 -4
  46. package/src/playwright/invitations-manager.ts +23 -78
  47. package/src/playwright/invitations.spec.ts +147 -139
  48. package/src/testing/index.ts +5 -0
  49. package/src/testing/shell-manager.ts +61 -0
  50. 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.AUTHENTICATING, 3],
20
- [Invitation.State.SUCCESS, 4]
19
+ [Invitation.State.READY_FOR_AUTHENTICATION, 3],
20
+ [Invitation.State.AUTHENTICATING, 4],
21
+ [Invitation.State.SUCCESS, 5]
21
22
  ]);