1
1
import { expect , Page } from '@playwright/test'
2
2
import util from 'util'
3
3
import { federatedInvitationCode } from '../../store'
4
+ import { config } from '../../../config'
4
5
5
6
const generateInvitationButton =
6
7
'//button[contains(@aria-label,"Generate invitation link that can be shared with one or more invitees")]'
@@ -9,8 +10,6 @@ const invitationToken = 'span:has-text("%s")'
9
10
const invitationInput = '//input[starts-with(@id, "oc-textinput-")]'
10
11
const invitationConnectionRow =
11
12
'//div[@id="sciencemesh-connections"]//td[text()="%s"]/parent::tr/td[text()="%s"]'
12
- const institutionOptionDropdown = '.vs__open-indicator'
13
- const inviterInstitutionOption = 'ul.vs__dropdown-menu > li'
14
13
const acceptInvitationButton = 'button:has(span:has-text("Accept invitation"))'
15
14
16
15
export const generateInvitation = async ( args : { page : Page ; user : string } ) : Promise < void > => {
@@ -32,6 +31,11 @@ export const generateInvitation = async (args: { page: Page; user: string }): Pr
32
31
} ) ,
33
32
page . locator ( generateInvitationActionConfirmButton ) . click ( )
34
33
] )
34
+
35
+ const serverHostname = new URL ( config . baseUrl ) . host
36
+
37
+ // Generate the invitation code by Base64 encoding "token@oCISUrl"
38
+ inviteCode = btoa ( inviteCode + '@' + serverHostname )
35
39
await expect ( page . locator ( util . format ( invitationToken , inviteCode ) ) ) . toBeVisible ( )
36
40
federatedInvitationCode . set ( user , { code : inviteCode } )
37
41
}
@@ -40,8 +44,6 @@ export const acceptInvitation = async (args: { page: Page; sharer: string }): Pr
40
44
const { page, sharer } = args
41
45
const invitation = federatedInvitationCode . get ( sharer . toLowerCase ( ) )
42
46
await page . locator ( invitationInput ) . fill ( invitation . code )
43
- await page . locator ( institutionOptionDropdown ) . click ( )
44
- await page . locator ( inviterInstitutionOption ) . click ( )
45
47
await Promise . all ( [
46
48
page . waitForResponse (
47
49
( resp ) =>
0 commit comments