Skip to content

test(behat): reset per-scenario state in BasicStructure and Sharing#60763

Merged
miaulalala merged 1 commit into
masterfrom
fix/noid/behat-scenario-state-isolation
May 28, 2026
Merged

test(behat): reset per-scenario state in BasicStructure and Sharing#60763
miaulalala merged 1 commit into
masterfrom
fix/noid/behat-scenario-state-isolation

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

Summary

  • $currentUser, $currentServer, $apiVersion, $requestToken, and $cookieJar in BasicStructure.php were never reset between scenarios — a scenario could silently inherit auth context from the previous one
  • $lastShareData, $storedShareData, and $savedShareId in Sharing.php were never reset — 12 methods read $lastShareData which could carry stale data from a previous scenario

Adds @BeforeScenario hooks to both traits to reset these to clean defaults at the start of each scenario.

Safety

Verified that every scenario in the integration test suite which reads $lastShareData (via steps like "Getting info of last share", "Deleting last share", "accepting last share") also creates a share earlier in that same scenario. The save/restore pattern (storedShareData) is always used within a single scenario boundary. No cross-scenario data dependencies exist.

Test plan

  • All integration-sqlite suites pass (CI)
  • Pay particular attention to sharing_features, filesdrop_features, files_features which make heaviest use of the sharing steps

🤖 Generated with Claude Code

@miaulalala miaulalala requested a review from a team as a code owner May 27, 2026 09:44
@miaulalala miaulalala requested review from Altahrim, artonge, icewind1991 and salmart-dev and removed request for a team May 27, 2026 09:44
@miaulalala
Copy link
Copy Markdown
Contributor Author

/backport to stable34

@miaulalala miaulalala self-assigned this May 27, 2026
@miaulalala miaulalala added tests Related to tests CI AI assisted 3. to review Waiting for reviews labels May 27, 2026
@miaulalala miaulalala added this to the Nextcloud 35 milestone May 27, 2026
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards left a comment

Choose a reason for hiding this comment

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

First, thanks for digging into and fixing these! These various test flakiness issues are frustrating and highly worthwhile to sort out. Just a tiny completeness matter regarding $this->baseUrl. The other longer bit of feedback is based on some thinking about a possible overall "tighter" structure... to help prevent these sort of issues from cropping up going forward while preventing source of truth / code sprawl.

Comment thread build/integration/features/bootstrap/BasicStructure.php
Comment thread build/integration/features/bootstrap/BasicStructure.php
@miaulalala miaulalala force-pushed the fix/noid/behat-scenario-state-isolation branch from 3c4141c to 201dc9a Compare May 27, 2026 14:06
@miaulalala miaulalala requested review from a team and nickvergessen as code owners May 27, 2026 14:06
@miaulalala miaulalala requested review from nfebe, sorbaugh and susnux and removed request for a team May 27, 2026 14:06
Add @BeforeScenario hooks to reset auth/server state and sharing state
between scenarios, preventing state bleed across test runs.

- BasicStructure: reset currentUser, currentServer, baseUrl, apiVersion,
  requestToken and cookieJar (baseUrl and currentServer go together via
  usingServer(), so both must be reset)
- Sharing: reset lastShareData, storedShareData and savedShareId

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miaulalala miaulalala force-pushed the fix/noid/behat-scenario-state-isolation branch from 201dc9a to d58e55a Compare May 27, 2026 14:06
@miaulalala miaulalala merged commit 29e93a9 into master May 28, 2026
202 of 211 checks passed
@miaulalala miaulalala deleted the fix/noid/behat-scenario-state-isolation branch May 28, 2026 07:41
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 this pull request may close these issues.

4 participants