2025-04-01 23:54:26 -07:00
|
|
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
2024-08-07 19:27:32 +10:00
|
|
|
|
|
|
|
test.describe('Onboarding tests', () => {
|
2025-05-02 15:54:49 -04:00
|
|
|
test('Desktop onboarding flow works', async ({
|
2025-04-30 21:58:11 -04:00
|
|
|
page,
|
|
|
|
homePage,
|
2025-05-02 15:54:49 -04:00
|
|
|
toolbar,
|
|
|
|
editor,
|
2025-04-30 21:58:11 -04:00
|
|
|
tronApp,
|
|
|
|
}) => {
|
|
|
|
if (!tronApp) {
|
|
|
|
fail()
|
|
|
|
}
|
2025-05-02 15:54:49 -04:00
|
|
|
|
|
|
|
// Because our default test settings have the onboardingStatus set to 'dismissed',
|
|
|
|
// we must set it to empty for the tests where we want to see the onboarding UI.
|
2025-04-30 21:58:11 -04:00
|
|
|
await tronApp.cleanProjectDir({
|
|
|
|
app: {
|
|
|
|
onboarding_status: '',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2025-05-07 12:48:23 -05:00
|
|
|
const tutorialWelcomeHeading = page.getByText(
|
2025-05-08 20:37:21 -04:00
|
|
|
'Welcome to Zoo Design Studio'
|
2025-05-02 15:54:49 -04:00
|
|
|
)
|
2025-03-13 10:54:00 -04:00
|
|
|
const nextButton = page.getByTestId('onboarding-next')
|
|
|
|
const prevButton = page.getByTestId('onboarding-prev')
|
2025-05-02 15:54:49 -04:00
|
|
|
const userMenuButton = toolbar.userSidebarButton
|
|
|
|
const userMenuSettingsButton = page.getByRole('button', {
|
|
|
|
name: 'User settings',
|
2025-03-20 16:28:08 -04:00
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
const settingsHeading = page.getByRole('heading', {
|
|
|
|
name: 'Settings',
|
|
|
|
exact: true,
|
2025-03-20 16:28:08 -04:00
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
const restartOnboardingSettingsButton = page.getByRole('button', {
|
|
|
|
name: 'Replay onboarding',
|
2025-03-20 16:28:08 -04:00
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
const helpMenuButton = page.getByRole('button', {
|
|
|
|
name: 'Help and resources',
|
2025-03-13 10:54:00 -04:00
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
const helpMenuRestartOnboardingButton = page.getByRole('button', {
|
|
|
|
name: 'Replay onboarding tutorial',
|
2025-04-30 14:43:51 -04:00
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
const postDismissToast = page.getByText(
|
|
|
|
'Click the question mark in the lower-right corner if you ever want to redo the tutorial!'
|
2025-04-30 21:58:11 -04:00
|
|
|
)
|
2025-03-20 16:28:08 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Test initial home page view, showing a tutorial button', async () => {
|
|
|
|
await expect(homePage.tutorialBtn).toBeVisible()
|
|
|
|
await homePage.expectState({
|
|
|
|
projectCards: [],
|
|
|
|
sortBy: 'last-modified-desc',
|
2025-04-30 14:43:51 -04:00
|
|
|
})
|
|
|
|
})
|
2024-08-16 14:49:51 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Create a blank project and verify no onboarding chrome is shown', async () => {
|
|
|
|
await homePage.goToModelingScene()
|
|
|
|
await expect(toolbar.projectName).toContainText('testDefault')
|
2025-05-07 12:48:23 -05:00
|
|
|
await expect(tutorialWelcomeHeading).not.toBeVisible()
|
2025-05-02 15:54:49 -04:00
|
|
|
await editor.expectEditor.toContain('@settings(defaultLengthUnit = in)', {
|
|
|
|
shouldNormalise: true,
|
2025-04-30 14:43:51 -04:00
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
})
|
2024-08-16 14:49:51 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Go home and verify we still see the tutorial button, then begin it.', async () => {
|
|
|
|
await toolbar.logoLink.click()
|
|
|
|
await expect(homePage.tutorialBtn).toBeVisible()
|
|
|
|
await homePage.expectState({
|
|
|
|
projectCards: [
|
|
|
|
{
|
|
|
|
title: 'testDefault',
|
|
|
|
fileCount: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
sortBy: 'last-modified-desc',
|
|
|
|
})
|
|
|
|
await homePage.tutorialBtn.click()
|
2025-04-30 14:43:51 -04:00
|
|
|
})
|
2025-03-20 16:28:08 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
// This is web-only.
|
|
|
|
// TODO: write a new test just for the onboarding in browser
|
|
|
|
// await test.step('Ensure the onboarding request toast appears', async () => {
|
|
|
|
// await expect(page.getByTestId('onboarding-toast')).toBeVisible()
|
|
|
|
// await page.getByTestId('onboarding-next').click()
|
|
|
|
// })
|
|
|
|
|
|
|
|
await test.step('Ensure we see the welcome screen in a new project', async () => {
|
2025-05-08 20:37:21 -04:00
|
|
|
await expect(toolbar.projectName).toContainText('tutorial-project')
|
2025-05-07 12:48:23 -05:00
|
|
|
await expect(tutorialWelcomeHeading).toBeVisible()
|
2025-05-02 15:54:49 -04:00
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Test the clicking through the onboarding flow', async () => {
|
|
|
|
await test.step('Going forward', async () => {
|
|
|
|
while ((await nextButton.innerText()) !== 'Finish') {
|
|
|
|
await nextButton.hover()
|
|
|
|
await nextButton.click()
|
|
|
|
}
|
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Going backward', async () => {
|
|
|
|
while ((await prevButton.innerText()) !== 'Dismiss') {
|
|
|
|
await prevButton.hover()
|
|
|
|
await prevButton.click()
|
|
|
|
}
|
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
// Dismiss the onboarding
|
|
|
|
await test.step('Dismiss the onboarding', async () => {
|
|
|
|
await prevButton.hover()
|
|
|
|
await prevButton.click()
|
|
|
|
await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
|
|
|
|
await expect(postDismissToast).toBeVisible()
|
|
|
|
await expect.poll(() => page.url()).not.toContain('/onboarding')
|
|
|
|
})
|
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-08 20:37:21 -04:00
|
|
|
await test.step('Resetting onboarding from inside project should always overwrite `tutorial-project`', async () => {
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Reset onboarding from settings', async () => {
|
|
|
|
await userMenuButton.click()
|
|
|
|
await userMenuSettingsButton.click()
|
|
|
|
await expect(settingsHeading).toBeVisible()
|
|
|
|
await expect(restartOnboardingSettingsButton).toBeVisible()
|
|
|
|
await restartOnboardingSettingsButton.click()
|
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-08 20:37:21 -04:00
|
|
|
await test.step('Gets to the onboarding start', async () => {
|
|
|
|
await expect(toolbar.projectName).toContainText('tutorial-project')
|
2025-05-07 12:48:23 -05:00
|
|
|
await expect(tutorialWelcomeHeading).toBeVisible()
|
2025-05-02 15:54:49 -04:00
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
await test.step('Dismiss the onboarding', async () => {
|
|
|
|
await page.keyboard.press('Escape')
|
|
|
|
await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
|
|
|
|
await expect.poll(() => page.url()).not.toContain('/onboarding')
|
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-08 20:37:21 -04:00
|
|
|
await test.step('Verify no new projects were created', async () => {
|
2025-05-02 15:54:49 -04:00
|
|
|
await toolbar.logoLink.click()
|
|
|
|
await expect(homePage.tutorialBtn).not.toBeVisible()
|
2025-05-08 20:37:21 -04:00
|
|
|
await homePage.expectState({
|
|
|
|
projectCards: [
|
|
|
|
{ title: 'tutorial-project', fileCount: 7 },
|
|
|
|
{
|
|
|
|
title: 'testDefault',
|
|
|
|
fileCount: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
sortBy: 'last-modified-desc',
|
|
|
|
})
|
2025-05-02 15:54:49 -04:00
|
|
|
})
|
2025-05-08 20:37:21 -04:00
|
|
|
})
|
2025-04-30 21:58:11 -04:00
|
|
|
|
2025-05-08 20:37:21 -04:00
|
|
|
await test.step('Resetting onboarding from home help menu overwrites the `tutorial-project`', async () => {
|
|
|
|
await helpMenuButton.click()
|
|
|
|
await helpMenuRestartOnboardingButton.click()
|
|
|
|
|
|
|
|
await test.step('Gets to the onboarding start', async () => {
|
|
|
|
await expect(toolbar.projectName).toContainText('tutorial-project')
|
2025-05-07 12:48:23 -05:00
|
|
|
await expect(tutorialWelcomeHeading).toBeVisible()
|
2025-05-02 15:54:49 -04:00
|
|
|
})
|
2025-05-08 20:37:21 -04:00
|
|
|
|
|
|
|
await test.step('Dismiss the onboarding', async () => {
|
|
|
|
await page.keyboard.press('Escape')
|
|
|
|
await expect(page.getByTestId('onboarding-content')).not.toBeVisible()
|
|
|
|
await expect.poll(() => page.url()).not.toContain('/onboarding')
|
|
|
|
})
|
|
|
|
|
|
|
|
await test.step('Verify no new projects were created', async () => {
|
|
|
|
await toolbar.logoLink.click()
|
|
|
|
await expect(homePage.tutorialBtn).not.toBeVisible()
|
|
|
|
await homePage.expectState({
|
|
|
|
projectCards: [
|
|
|
|
{ title: 'tutorial-project', fileCount: 7 },
|
|
|
|
{
|
|
|
|
title: 'testDefault',
|
|
|
|
fileCount: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
sortBy: 'last-modified-desc',
|
|
|
|
})
|
|
|
|
})
|
2024-08-16 14:49:51 -04:00
|
|
|
})
|
2025-03-20 16:28:08 -04:00
|
|
|
})
|
|
|
|
})
|