test: Migrate acceptance tests to @umbraco-cms/acceptance-test-helpers#304
Merged
Merged
Conversation
The acceptance suite failed in every test's beforeEach with "TypeError: Cannot read properties of undefined (reading 'value')" from ApiHelpers.getLocalStorageAuthToken via the umbracoApi fixture. Root cause: the project used the deprecated @umbraco/playwright-testhelpers (17.0.34), whose isLoginStateValid() reads the auth token from the localStorage key `umb:userAuthTokenResponse`. Umbraco 17.5's backoffice moved to cookie-based auth, so that key no longer exists (the saved storage state holds only `umb:appLanguage` plus auth cookies) and the helper threw. The package is deprecated upstream in favour of @umbraco-cms/acceptance-test-helpers, whose versions track the CMS and whose isLoginStateValid() was rewritten to rely on cookies. Migrate to it at 17.5.x (matching the test site / Umbraco version), as the Forms acceptance tests do. - Swap the dependency and update the five import sites (same exported names). - Add non-null assertions for the env credentials, which the new helper's stricter login signatures require. Verified: the full DefaultConfig suite (setup + 3 smoke tests) now passes against the Umbraco 17.5 test site. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Playwright acceptance suite fails in every test's
beforeEach(theumbracoApifixture →isLoginStateValid()→getLocalStorageAuthToken()):Root cause: the project depends on the deprecated
@umbraco/playwright-testhelpers@^17.0.34. ItsgetLocalStorageAuthToken()reads the auth token from the localStorage keyumb:userAuthTokenResponse. Umbraco 17.5's backoffice switched to cookie-based auth, so that key no longer exists — the saved storage state holds onlyumb:appLanguageplus auth cookies — and the helper throws.The package is deprecated upstream:
The replacement's
isLoginStateValid()was rewritten to rely on cookies (no localStorage token read), matching Umbraco 17.5. This is the same package the Umbraco Forms acceptance tests use.Change
@umbraco/playwright-testhelpers@^17.0.34→@umbraco-cms/acceptance-test-helpers@^17.5.0(matching the 17.5.0 test site).ApiHelpers,UiHelpers,ConstantHelper,test).auth.setup.ts(the new helper's stricter login signatures requirestring).Verification
With the running Umbraco 17.5 test site, the full
DefaultConfigsuite now authenticates and passes:Note for merge ordering
This PR and #302 (the #300 RTE fix) both touch
block-preview.spec.ts— this PR changes the import line; #302 adds the RTE regression test (with the old import, to stay internally consistent on its own branch). Expect a trivial one-line conflict on the import when both land: keep@umbraco-cms/acceptance-test-helpers. I verified the combined result (this migration + #302's fix + the RTE test) passes locally.🤖 Generated with Claude Code