Skip to content

Commit 1342fc5

Browse files
cynfrianpub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3
andauthored
Add back action to community profile onboarding (#2136)
Signed-off-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co>
1 parent 916c67d commit 1342fc5

2 files changed

Lines changed: 33 additions & 6 deletions

File tree

‎desktop/src/features/onboarding/ui/CommunityOnboardingFlow.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ export function CommunityOnboardingFlow({
496496
)}
497497
>
498498
<Button
499-
className={ONBOARDING_PRIMARY_CTA_CLASS}
499+
className={`${ONBOARDING_PRIMARY_CTA_CLASS} w-20`}
500500
data-testid="community-profile-next"
501501
disabled={
502502
!displayName.trim() || isPending || isUploadingAvatar
@@ -506,6 +506,16 @@ export function CommunityOnboardingFlow({
506506
>
507507
Next
508508
</Button>
509+
<Button
510+
className="h-9 w-20 rounded-full bg-foreground/10 px-6 hover:bg-foreground/15"
511+
data-testid="community-profile-back"
512+
disabled={isPending || isUploadingAvatar}
513+
onClick={onCancel}
514+
type="button"
515+
variant="ghost"
516+
>
517+
Back
518+
</Button>
509519
</OnboardingFooter>
510520
<Dialog
511521
onOpenChange={(open) => setIsAvatarEditorOpen(open)}

‎desktop/tests/e2e/onboarding.spec.ts‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ test("canceling a join to an existing inactive community preserves it", async ({
12961296
.toEqual(["active-community", "existing-community"]);
12971297
});
12981298

1299-
test("connected first-community profile step cannot discard resumable onboarding", async ({
1299+
test("connected first-community profile step offers equal-width Next and Back controls", async ({
13001300
page,
13011301
}) => {
13021302
await seedActiveIdentity(page, BLANK_TYLER_IDENTITY);
@@ -1551,17 +1551,34 @@ test("connected first-community profile step cannot discard resumable onboarding
15511551
await page.keyboard.press("Escape");
15521552
await expect(avatarDialog).toHaveCount(0);
15531553
await expect(avatarButton).toBeFocused();
1554-
await expect(page.getByTestId("community-profile-next")).toHaveText("Next");
1555-
await expect(page.getByTestId("community-profile-next")).toBeDisabled();
1556-
await expect(page.getByTestId("community-profile-back")).toHaveCount(0);
1554+
const nextButton = page.getByTestId("community-profile-next");
1555+
const backButton = page.getByTestId("community-profile-back");
1556+
await expect(nextButton).toHaveText("Next");
1557+
await expect(nextButton).toBeDisabled();
1558+
await expect(backButton).toHaveText("Back");
1559+
await expect(backButton).toBeEnabled();
1560+
const [nextBox, backBox] = await Promise.all([
1561+
nextButton.boundingBox(),
1562+
backButton.boundingBox(),
1563+
]);
1564+
if (!nextBox || !backBox) {
1565+
throw new Error("Could not measure community profile navigation controls");
1566+
}
1567+
expect(Math.abs(nextBox.width - backBox.width)).toBeLessThanOrEqual(1);
1568+
expect(nextBox.width).toBeLessThanOrEqual(160);
1569+
1570+
await backButton.click();
1571+
await expect(
1572+
page.getByRole("heading", { name: "Request access to community" }),
1573+
).toBeVisible();
15571574
await expect
15581575
.poll(() =>
15591576
page.evaluate(
15601577
(key) => window.localStorage.getItem(key),
15611578
COMMUNITY_ONBOARDING_TRANSACTION_STORAGE_KEY,
15621579
),
15631580
)
1564-
.not.toBeNull();
1581+
.toBeNull();
15651582
});
15661583

15671584
test("membership denial on community profile save offers recovery", async ({

0 commit comments

Comments
 (0)