39082cf787
New users joining an existing workspace through an invite link were routed through the "Install your first apps" onboarding step, which is meant for workspace creation only. #22347 set `ONBOARDING_INSTALL_APPS_PENDING` inside `activateOnboardingForUser`, which is shared by both sign-up paths. Gate it per path like the connect-account step: `true` on `signUpOnNewWorkspace`, `false` on `signInUpOnExistingWorkspace`. Verified locally: invited users now go straight from create-profile into the workspace, and workspace creators still get the install-apps step. Covered by a unit test on the invite path and integration tests asserting the onboarding status per sign-up path (invite → `PROFILE_CREATION`; workspace creation → `SYNC_EMAIL` then `APPS_INSTALLATION`).
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import gql from 'graphql-tag';
|
|
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
|
|
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
|
|
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
|
|
type SkipSyncEmailOnboardingStepUtilArgs = {
|
|
accessToken: string;
|
|
expectToFail?: boolean;
|
|
};
|
|
|
|
export const skipSyncEmailOnboardingStep = async ({
|
|
accessToken,
|
|
expectToFail,
|
|
}: SkipSyncEmailOnboardingStepUtilArgs): CommonResponseBody<{
|
|
skipSyncEmailOnboardingStep: { success: boolean };
|
|
}> => {
|
|
const mutation = gql`
|
|
mutation SkipSyncEmailOnboardingStep {
|
|
skipSyncEmailOnboardingStep {
|
|
success
|
|
}
|
|
}
|
|
`;
|
|
|
|
const response = await makeMetadataAPIRequest(
|
|
{
|
|
query: mutation,
|
|
variables: {},
|
|
},
|
|
accessToken,
|
|
);
|
|
|
|
if (expectToFail === true) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response,
|
|
errorMessage:
|
|
'Skip sync email onboarding step should have failed but did not',
|
|
});
|
|
}
|
|
|
|
if (expectToFail === false) {
|
|
warnIfErrorButNotExpectedToFail({
|
|
response,
|
|
errorMessage: 'Skip sync email onboarding step has failed but should not',
|
|
});
|
|
}
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|