Skip to content

test: fixed party-selection.ts cypress test that fails in tt02#4235

Merged
framitdavid merged 1 commit into
mainfrom
test/fix-cypress-test
May 28, 2026
Merged

test: fixed party-selection.ts cypress test that fails in tt02#4235
framitdavid merged 1 commit into
mainfrom
test/fix-cypress-test

Conversation

@framitdavid
Copy link
Copy Markdown
Contributor

@framitdavid framitdavid commented May 28, 2026

Description

Cypress-testen party-selection.ts => "Du mangler rettigheter for å se denne tjenesten" begynte å feile på tt02:

expected [data-testid="AltinnError"] to contain text
"Du mangler rettigheter for å se denne tjenesten", but the text was ''

Siste grønne kjøring på main var 21. mai, første røde 26. mai, uten noen relevant kode-merge imellom. frontend-test-appen er heller ikke endret (publisert v208, 13.01.2026).

Endret til å ta et mer eksplisitt valg av hvilken org vi forsøker å instansiere for. Det ser ut til at testbrukeren har fått tilgang til en ekstra org som den kan representere, og som den også har rettigheter til å instansiere for. Dermed kan .first() og removeAllButOneOrg ende opp med å velge en org brukeren faktisk har tilgang til å instansiere for, og vi får derfor ikke det forventede resultatet.

Related Issue(s)

  • closes #{issue number}

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

@framitdavid framitdavid added ignore-for-release Pull requests to be ignored in release notes backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels May 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds a new party-filtering helper function removeAllButKeepOrg to stabilize e2e test behavior. The party-selection test now pins a specific organization by org number rather than relying on the unstable order of a filtered party list, eliminating flakiness when selecting the org expected to fail instantiation.

Changes

Party selection test stabilization

Layer / File(s) Summary
Add removeAllButKeepOrg party-filtering helper
test/e2e/pageobjects/party-mocks.ts
Introduces removeAllButKeepOrg(parties, orgNumber) to filter parties and return a specific organization by orgNumber plus all persons, with fallback to the existing removeAllButOneOrg when the target org is missing.
Update party-selection test to use org-pinned filtering
test/e2e/integration/frontend-test/party-selection.ts
Imports removeAllButKeepOrg, defines NonInstantiableOrgForAccountant constant, and refactors the instantiation-failure test to pin the specific org by number, avoiding reliance on unstable party list ordering during party selection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

kind/other

Suggested reviewers

  • olemartinorg
  • lassopicasso
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the specific test being fixed (party-selection.ts) and the environment where the issue occurs (tt02), accurately reflecting the main change in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description provides adequate context about the test failure (test began failing on tt02 on May 26) and explains the root cause (test user gained access to additional org, causing unstable party selection) with the fix applied (explicit org selection using removeAllButKeepOrg helper).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/fix-cypress-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@framitdavid framitdavid added the kind/other Pull requests containing chores/repo structure/other changes label May 28, 2026
@framitdavid framitdavid moved this to 🔎 In review in Team Altinn Studio May 28, 2026
Copy link
Copy Markdown
Contributor

@phlipsterit phlipsterit left a comment

Choose a reason for hiding this comment

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

Good fix to make the test more stable and good to know which org is being selected

@framitdavid framitdavid merged commit ed6dd01 into main May 28, 2026
21 of 24 checks passed
@framitdavid framitdavid deleted the test/fix-cypress-test branch May 28, 2026 12:29
@github-project-automation github-project-automation Bot moved this from 🔎 In review to ✅ Done in Team Altinn Studio May 28, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jun 4, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-ignore This PR is a new feature and should not be cherry-picked onto release branches ignore-for-release Pull requests to be ignored in release notes kind/other Pull requests containing chores/repo structure/other changes

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants