Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

you can reload the onboarding from any screen and the onboarding works #1110

Closed
Tracked by #833
Irev-Dev opened this issue Nov 22, 2023 · 2 comments · Fixed by #1125
Closed
Tracked by #833

you can reload the onboarding from any screen and the onboarding works #1110

Irev-Dev opened this issue Nov 22, 2023 · 2 comments · Fixed by #1125
Assignees
Labels

Comments

@Irev-Dev
Copy link
Collaborator

Irev-Dev commented Nov 22, 2023

I thought this was a good one for you Frank since it's testing your work.

Read through the playwright section of the readme to cover the basics.

The start of the test should probably look like:
(the beforeEach script already dismisses the onboarding, so that's good for "reloading" the onboarding.

test('Basic sketch', async ({ page }) => {
  const u = getUtils(page)
  page.setViewportSize({ width: 1200, height: 500 })
  await page.goto('localhost:3000')
  await u.waitForAuthSkipAppStart()
  await u.waitForDefaultPlanesVisibilityChange()
  // ...
})

Just to wait for the app to load, having said that maybe you don't need to wait for the stream to start for this test?
This test probably won't follow the example of many of the other tests, namely because you should be able normal playwright conventions and query mostly HTML for this

since that's the case maybe giving yarn playwright codegen -b wk --load-storage ./store localhost:3000 is worth a shot?

Where ./store should look like this

{
  "cookies": [],
  "origins": [
    {
      "origin": "http://localhost:3000",
      "localStorage": [
        {
          "name": "store",
          "value": "{\"state\":{\"openPanes\":[\"code\"]},\"version\":0}"
        },
        {
          "name": "persistCode",
          "value": ""
        },
        {
          "name": "TOKEN_PERSIST_KEY",
          "value": "your-token"
        }
      ]
    }
  ]
}

lmk if that works.

btw if as part of this you want to test the onboarding when it loads for the first time, override the beforeEach script with the following.

test('Basic sketch', async ({ page, context }) => {
  context.addInitScript(async (token) => {
    localStorage.setItem(
      'SETTINGS_PERSIST_KEY',
      JSON.stringify({
        baseUnit: 'in',
        cameraControls: 'KittyCAD',
        defaultDirectory: '',
        defaultProjectName: 'project-$nnn',
        onboardingStatus: '', // triggers first time onboarding etc
        showDebugPanel: true,
        textWrapping: 'On',
        theme: 'system',
        unitSystem: 'imperial',
      })
    )
  })
  const u = getUtils(page)
  page.setViewportSize({ width: 1200, height: 500 })
  await page.goto('localhost:3000')
  await u.waitForAuthSkipAppStart()
  await u.waitForDefaultPlanesVisibilityChange()
@Irev-Dev
Copy link
Collaborator Author

There's another task in #833
if you restart the onboarding it re-executes with the new code for the onboarding
That maybe should be covered as part of this?

@franknoirot
Copy link
Collaborator

There's another task in #833
if you restart the onboarding it re-executes with the new code for the onboarding
That maybe should be covered as part of this?

I'm not sure how I should be testing "re-executes". Should I be checking if the stream video frame:

  1. exists
  2. is different than before
  3. is correct
    or should I be using something to do with the debug panel to proxy testing the actual stream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants