Skip to content

Commit ba98a72

Browse files
committed
change onboarding e2e test
1 parent b715154 commit ba98a72

1 file changed

Lines changed: 28 additions & 46 deletions

File tree

tests/e2e/sequential/onboarding.spec.js

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,63 +12,45 @@ function onboardingTests( testContext = test ) {
1212
await page.goto( '/wp-admin/admin.php?page=progress-planner' );
1313
await page.waitForLoadState( 'networkidle' );
1414

15-
// Verify onboarding element is present
16-
const onboardingElement = page.locator( '.prpl-welcome' );
17-
await expect( onboardingElement ).toBeVisible();
18-
19-
// Fill in the onboarding form
20-
const form = page.locator( '#prpl-onboarding-form' );
21-
await expect( form ).toBeVisible();
22-
23-
// Submit button should be disabled
24-
const submitButtonWrapper = form.locator(
25-
'#prpl-onboarding-submit-wrapper'
26-
);
27-
28-
// Select "no" for email and accept privacy policy
29-
await form
30-
.locator( 'input[name="with-email"][value="no"]' )
31-
.click();
32-
33-
// Verify submit button is stilldisabled
34-
await expect( submitButtonWrapper ).toHaveClass(
35-
'prpl-disabled'
15+
// Wait for the onboarding popover to be visible
16+
const popover = page.locator( '#prpl-popover-onboarding' );
17+
await expect( popover ).toBeVisible( { timeout: 10000 } );
18+
19+
// Check the privacy policy checkbox
20+
const privacyCheckbox = page.locator( '#prpl-privacy-checkbox' );
21+
await expect( privacyCheckbox ).toBeVisible();
22+
await privacyCheckbox.check();
23+
24+
// Click "Start onboarding" button to accept privacy and proceed
25+
const startButton = popover.locator( '.prpl-tour-next' );
26+
await expect( startButton ).toBeVisible();
27+
await startButton.click();
28+
29+
// Wait for step to advance (license generation happens in background)
30+
// We should now be on step 1 or later
31+
await expect( popover ).toHaveAttribute(
32+
'data-prpl-step',
33+
/^[1-9]/,
34+
{ timeout: 15000 }
3635
);
3736

38-
await form.locator( 'input[name="privacy-policy"]' ).check();
37+
// Click the close button to exit onboarding
38+
const closeButton = page.locator( '#prpl-tour-close-btn' );
39+
await closeButton.click();
3940

40-
// Accept privacy policy and verify button becomes enabled
41-
await expect( submitButtonWrapper ).not.toHaveClass(
42-
'prpl-disabled'
43-
);
44-
45-
// Submit the form
46-
await form
47-
.locator(
48-
'input[type="submit"].prpl-button-secondary--no-email'
49-
)
50-
.click();
51-
52-
// Verify onboarding completion by checking for expected elements
41+
// Verify onboarding is closed and dashboard elements are visible
42+
await expect( popover ).not.toBeVisible( { timeout: 5000 } );
5343
await expect(
5444
page.locator( '.prpl-widget-wrapper.prpl-suggested-tasks' )
5545
).toBeVisible( { timeout: 15000 } );
56-
await expect(
57-
page.locator(
58-
'.prpl-widget-wrapper.prpl-suggested-tasks .prpl-suggested-tasks-list'
59-
)
60-
).toBeVisible( {
61-
timeout: 5000,
62-
} );
6346

64-
// Visit the WP Dashboard page and back to the Progress Planner page.
47+
// Visit the WP Dashboard page and back to the Progress Planner page
6548
await page.goto( '/wp-admin/' );
6649
await page.goto( '/wp-admin/admin.php?page=progress-planner' );
6750
await page.waitForLoadState( 'networkidle' );
6851

69-
await expect(
70-
page.locator( '#prpl-onboarding-tasks' )
71-
).toHaveCount( 0 );
52+
// Verify onboarding doesn't restart (progress was saved)
53+
await expect( popover ).not.toBeVisible( { timeout: 5000 } );
7254
}
7355
);
7456
} );

0 commit comments

Comments
 (0)