@@ -11,7 +11,6 @@ import type { createEmailsFixture } from "../fixtures/emails";
11
11
import { test } from "../lib/fixtures" ;
12
12
import { fillStripeTestCheckout } from "../lib/testUtils" ;
13
13
import { getEmailsReceivedByUser } from "../lib/testUtils" ;
14
- import { gotoPathAndExpectRedirectToOrgDomain } from "./lib/gotoPathAndExpectRedirectToOrgDomain" ;
15
14
16
15
async function expectEmailWithSubject (
17
16
page : Page ,
@@ -103,7 +102,7 @@ function capitalize(text: string) {
103
102
}
104
103
105
104
test . describe ( "Organization" , ( ) => {
106
- test ( "Admin should be able to create an org where an existing user is made an owner" , async ( {
105
+ test ( "Admin should be able to do onboarding handover an org where an existing user is made an owner" , async ( {
107
106
page,
108
107
users,
109
108
emails,
@@ -141,113 +140,13 @@ test.describe("Organization", () => {
141
140
await fillAndSubmitFirstStepAsAdmin ( page , orgOwnerEmail , orgName , orgSlug ) ;
142
141
} ) ;
143
142
144
- await expectOrganizationCreationEmailToBeSentWithLinks ( {
145
- page,
146
- emails,
147
- userEmail : orgOwnerEmail ,
148
- oldUsername : orgOwnerUsernameOutsideOrg || "" ,
149
- newUsername : orgOwnerUsernameInOrg ,
150
- orgSlug,
151
- } ) ;
152
-
153
- await test . step ( "About the organization" , async ( ) => {
154
- // Choosing an avatar
155
- await page . getByTestId ( "open-upload-avatar-dialog" ) . click ( ) ;
156
- const fileChooserPromise = page . waitForEvent ( "filechooser" ) ;
157
- await page . getByText ( "Choose a file..." ) . click ( ) ;
158
- const fileChooser = await fileChooserPromise ;
159
- await fileChooser . setFiles ( path . join ( __dirname , "../../public/apple-touch-icon.png" ) ) ;
160
- await page . getByTestId ( "upload-avatar" ) . click ( ) ;
161
-
162
- // About text
163
- await page . locator ( 'textarea[name="about"]' ) . fill ( "This is a testing org" ) ;
164
- await page . locator ( "button[type=submit]" ) . click ( ) ;
165
-
166
- // Waiting to be in next step URL
167
- await page . waitForURL ( "/settings/organizations/*/onboard-members" ) ;
168
- } ) ;
169
-
170
- await test . step ( "On-board administrators" , async ( ) => {
171
- await page . waitForSelector ( '[data-testid="pending-member-list"]' ) ;
172
- await expect ( page . getByTestId ( "pending-member-item" ) ) . toHaveCount ( 1 ) ;
173
-
174
- const adminEmail = users . trackEmail ( { username : "rick" , domain : `example.com` } ) ;
175
-
176
- //can add members
177
- await page . getByTestId ( "new-member-button" ) . click ( ) ;
178
- await page . locator ( '[placeholder="email\\@example\\.com"]' ) . fill ( adminEmail ) ;
179
- await page . getByTestId ( "invite-new-member-button" ) . click ( ) ;
180
- await expect ( page . locator ( `li:has-text("${ adminEmail } ")` ) ) . toBeVisible ( ) ;
181
- // TODO: Check if invited admin received the invitation email
182
- // await expectInvitationEmailToBeReceived(
183
- // page,
184
- // emails,
185
- // adminEmail,
186
- // `${orgName}'s admin invited you to join the organization ${orgName} on Cal.com`
187
- // );
188
- await expect ( page . getByTestId ( "pending-member-item" ) ) . toHaveCount ( 2 ) ;
189
-
190
- // can remove members
191
- await expect ( page . getByTestId ( "pending-member-item" ) ) . toHaveCount ( 2 ) ;
192
- const lastRemoveMemberButton = page . getByTestId ( "remove-member-button" ) . last ( ) ;
193
- await lastRemoveMemberButton . click ( ) ;
194
- await expect ( page . getByTestId ( "pending-member-item" ) ) . toHaveCount ( 1 ) ;
195
- await page . getByTestId ( "publish-button" ) . click ( ) ;
196
- // Waiting to be in next step URL
197
- await page . waitForURL ( "/settings/organizations/*/add-teams" ) ;
198
- } ) ;
199
-
200
- await test . step ( "Create teams" , async ( ) => {
201
- // Filling one team
202
- await page . locator ( 'input[name="teams.0.name"]' ) . fill ( "Marketing" ) ;
203
-
204
- // Adding another team
205
- await page . getByTestId ( "add_a_team" ) . click ( ) ;
206
- await page . locator ( 'input[name="teams.1.name"]' ) . fill ( "Sales" ) ;
207
-
208
- // Finishing the creation wizard
209
- await page . getByTestId ( "continue_or_checkout" ) . click ( ) ;
210
- await page . waitForURL ( "/event-types" ) ;
211
- } ) ;
212
-
213
- await test . step ( "Login as org owner and pay" , async ( ) => {
214
- // eslint-disable-next-line playwright/no-skipped-test
215
- test . skip ( ! IS_TEAM_BILLING_ENABLED , "Skipping paying for org as stripe is disabled" ) ;
216
-
217
- await orgOwnerUser . apiLogin ( ) ;
218
- await page . goto ( "/event-types" ) ;
219
- const upgradeButton = await page . getByTestId ( "upgrade_org_banner_button" ) ;
220
-
221
- await expect ( upgradeButton ) . toBeVisible ( ) ;
222
- await upgradeButton . click ( ) ;
223
- // Check that stripe checkout is present
224
- const expectedUrl = "https://checkout.stripe.com" ;
225
-
226
- await page . waitForURL ( ( url ) => url . href . startsWith ( expectedUrl ) ) ;
227
- const url = page . url ( ) ;
228
-
229
- // Check that the URL matches the expected URL
230
- expect ( url ) . toContain ( expectedUrl ) ;
231
-
232
- await fillStripeTestCheckout ( page ) ;
233
-
234
- const upgradeButtonHidden = await page . getByTestId ( "upgrade_org_banner_button" ) ;
235
-
236
- await expect ( upgradeButtonHidden ) . toBeHidden ( ) ;
237
- } ) ;
238
-
239
- // Verify that the owner's old username redirect is properly set
240
- await gotoPathAndExpectRedirectToOrgDomain ( {
241
- page,
242
- org : {
243
- slug : orgSlug ,
244
- } ,
245
- path : `/${ orgOwnerUsernameOutsideOrg } ` ,
246
- expectedPath : `/${ orgOwnerUsernameInOrg } ` ,
143
+ await test . step ( "Handover" , async ( ) => {
144
+ const onboardingUrl = await page . getByTestId ( "onboarding-url" ) . textContent ( ) ;
145
+ expect ( onboardingUrl ) . toContain ( "?onboardingId=" ) ;
247
146
} ) ;
248
147
} ) ;
249
148
250
- test ( "Admin should be able to create an org where the owner doesn't exist yet" , async ( {
149
+ test . skip ( "Admin should be able to create an org where the owner doesn't exist yet" , async ( {
251
150
page,
252
151
users,
253
152
emails,
@@ -570,7 +469,7 @@ async function fillAndSubmitFirstStepAsAdmin(
570
469
await page . locator ( "input[name=pricePerSeat]" ) . fill ( "30" ) ;
571
470
572
471
await Promise . all ( [
573
- page . waitForResponse ( "**/api/trpc/organizations/create **" ) ,
472
+ page . waitForResponse ( "**/api/trpc/organizations/intentToCreateOrg **" ) ,
574
473
page . locator ( "button[type=submit]" ) . click ( ) ,
575
474
] ) ;
576
475
}
0 commit comments