Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions e2e/page-objects/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export default class Onboarding {
}

get heading() {
return this.locator.getByRole( 'heading', {
name: /Connect to your WordPress.com account|Connect your WordPress.com account/,
} );
return this.locator.getByTestId( 'onboarding-welcome-title' ).or(

@nightnei nightnei Dec 3, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that should be done, I am just thinking for the future cases - are there some disadvantages of using data-testid vs roles 🤔 Interesting your thoughts why you decided to switch to testid?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to use testId because this flow is used in every e2e and performance metric, so changing the text becomes more tricky as we need to support both text for a bit. Using only role could work, but I want to make sure the Heading displayed is this one and not the Add site flow.
I'll remove the text selector after a few days in favor of the testId.

this.locator.getByRole( 'heading', {
name: /Connect to your WordPress\.com account|Connect your WordPress\.com account/,
} )
);
}

async completeOnboarding( options?: { customSiteName?: string; customFolderName?: string } ) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/tests/onboarding.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ describe( 'Onboarding Component', () => {
} );

it( 'renders onboarding screen correctly', () => {
const { getByText } = renderWithProvider( <Onboarding /> );
expect( getByText( 'Connect your WordPress.com account' ) ).toBeVisible();
const { getByText, getByTestId } = renderWithProvider( <Onboarding /> );
expect( getByTestId( 'onboarding-welcome-title' ) ).toBeVisible();
expect( getByText( 'Skip →' ) ).toBeVisible();
} );

Expand Down
12 changes: 6 additions & 6 deletions src/modules/onboarding/components/connect-to-wpcom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ export function OnboardingConnectToWpcom( { onSkip }: { onSkip: () => void } ) {
return (
<div className="h-full flex flex-col">
<div className="flex flex-col gap-4 my-auto text-pretty">
<Heading className="a8c-subtitle text-xl">
{ __( 'Connect your WordPress.com account' ) }
<Heading data-testid="onboarding-welcome-title" className="a8c-subtitle text-xl">
{ __( 'Welcome to WordPress Studio' ) }
</Heading>

<div className="text-a8c-gray-70 a8c-body">
{ __(
'Log in with WordPress.com to unlock the full power of WordPress Studio. By signing in, you get access to features that help you build faster, test safely, and work seamlessly across environments:'
'Start by connecting your WordPress.com account to unlock the full power of WordPress Studio.'
) }
</div>

<div>
{ [
__( 'Share preview sites with clients and team members.' ),
__( 'Seamlessly sync with WordPress.com and Pressable sites.' ),
__( 'Get help from Studio Assistant.' ),
__( 'Share preview sites with clients and colleagues' ),
__( 'Seamlessly sync with WordPress.com and Pressable' ),
__( 'Get smart suggestions from the Studio Assistant' ),
].map( ( text ) => (
<div key={ text } className="text-a8c-gray-70 a8c-body flex items-center">
<Icon className="fill-a8c-blue-50 me-2 shrink-0" icon={ check } />
Expand Down