Skip to content

Conversation

@ScharfViktor
Copy link
Contributor

@ScharfViktor ScharfViktor commented Jun 20, 2025

  • I added the command pnpm check:unused-steps, which compares all steps from feature and stepDefinitions files and finds unused steps that should, of course, be deleted.

example:

pnpm check:unused-steps

> @3.0.0 check:unused-steps /Users/v.scharf/Work/opencloud/web
> TS_NODE_PROJECT=./tests/e2e/cucumber/tsconfig.json cucumber-js --profile=e2e --format usage --dry-run tests/e2e/cucumber/features/*/*.feature

(node:48694) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
│ Pattern / Text                                                                                                                                       │ Duration │ Location                                                                                 │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ {string} creates the following project space(s) using API                                                                                            │ -        │ file:/Users/v.scharf/Work/opencloud/web/tests/e2e/cucumber/steps/api.ts:125              │
│   "Admin" creates the following project spaces using API                                                                                             │ -        │ tests/e2e/cucumber/features/admin-settings/spaces.feature:10                             │
│   "Admin" creates the following project spaces using API                                                                                             │ -        │ tests/e2e/cucumber/features/admin-settings/spaces.feature:126                            │
│   "Alice" creates the following project space using API                                                                                              │ -        │ tests/e2e/cucumber/features/app-provider-onlyOffice/officeSuites.feature:84              │
│   "Alice" creates the following project space using API                                                                                              │ -        │ tests/e2e/cucumber/features/app-provider/officeSuites.feature:83                         │
│   "Alice" creates the following project space using API                                                                                              │ -        │ tests/e2e/cucumber/features/navigation/urlJourneys.feature:21                            │
│   18 more                                                                                                                                            │          │                                                                                          │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ {string} creates the following file(s) in space {string} using API                                                                                   │ -        │ file:/Users/v.scharf/Work/opencloud/web/tests/e2e/cucumber/steps/api.ts:137              │
│   "Alice" creates the following file in space "Development" using API                                                                                │ -        │ tests/e2e/cucumber/features/navigation/urlJourneys.feature:24                            │
│   "Alice" creates the following file in space "team" using API                                                                                       │ -        │ tests/e2e/cucumber/features/spaces/downloadSpace.feature:21                              │
│   "Alice" creates the following file in space "team" using API                                                                                       │ -        │ tests/e2e/cucumber/features/spaces/publicLink.feature:20                                 │
│   "Alice" creates the following file in space "team" using API                                                                                       │ -        │ tests/e2e/cucumber/features/spaces/publicLink.feature:107                                │
│   "Brian" creates the following file in space "FullTextSearch" using API                                                                             │ -        │ tests/e2e/cucumber/features/search/fullTextSearch.feature:38                             │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ {string} creates {int} file(s) in space {string} using API                                                                                           │ UNUSED   │ file:/Users/v.scharf/Work/opencloud/web/tests/e2e/cucumber/steps/api.ts:148              │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ {string} creates the following folder(s) in space {string} using API                                                                                 │ -        │ file:/Users/v.scharf/Work/opencloud/web/tests/e2e/cucumber/steps/api.ts:159              │
│   "Alice" creates the following folder in space "Marketing" using API                                                                                │ -        │ tests/e2e/cucumber/features/app-provider-onlyOffice/officeSuites.feature:87              │
│   "Alice" creates the following folder in space "Marketing" using API                                                                                │ -        │ tests/e2e/cucumber/features/app-provider/officeSuites.feature:86                         │
│   "Alice" creates the following folder in space "Marketing" using API                                                                                │ -        │ tests/e2e/cucumber/features/smoke/sse.feature:55                                         │
│   "Alice" creates the following folder in space "Marketing" using API                                                                                │ -        │ tests/e2e/cucumber/features/smoke/sse.feature:178                                        │
│   "Alice" creates the following folder in space "my_space" using API                                                                                 │ -        │ tests/e2e/cucumber/features/a11y/smoke.feature:21                                        │
│   4 more                                                                                                                                             │          │                                                                                          │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
│ {string} creates {int} folders(s) in space {string} using API                                                                                        │ UNUSED   │ file:/Users/v.scharf/Work/opencloud/web/tests/e2e/cucumber/steps/api.ts:169              │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
  • deleted unused steps

Copilot AI review requested due to automatic review settings June 20, 2025 09:50
@ScharfViktor ScharfViktor changed the title detect and delete unused steps [full-ci] detect and delete unused steps Jun 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes several unused step definitions and associated helper functions, and adds a new command to detect them.

  • Removed unused helper functions and step definitions from support objects and test files.
  • Added a new package.json script ("check:unused-steps") to identify unused steps.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/e2e/support/objects/app-files/share/utils.ts Removed unused function "resourceIsNotOpenable".
tests/e2e/support/objects/app-files/share/index.ts Removed reference to "resourceIsNotOpenable" from the Share class.
tests/e2e/support/objects/app-files/resource/index.ts Removed unused functions "checkThatFileVersionIsNotAvailable" and "expectFileToBeSelected".
tests/e2e/support/objects/app-files/resource/actions.ts Removed unused file version related function "checkThatFileVersionIsNotAvailable".
tests/e2e/support/objects/app-files/page/shares/withMe.ts Removed unused method "openShareWithMeFromInternalLink".
tests/e2e/support/objects/app-files/page/public.ts Removed unused method "uploadInternal".
tests/e2e/support/objects/app-files/link/index.ts Removed unused function "getPublicLinkUrl".
tests/e2e/support/objects/app-files/link/actions.ts Removed unused function "getPublicLinkVisibility".
Multiple tests files (cucumber steps) Removed unused step definitions related to deleted helper functions.
package.json Added the "check:unused-steps" command.
Comments suppressed due to low confidence (17)

tests/e2e/cucumber/steps/ui/session.ts:40

  • Removed step definitions for login/logout that appear to be unused; ensure that the new session handling steps cover all necessary scenarios.
  await page.locator('#web-content').waitFor()

package.json:24

  • The addition of the 'check:unused-steps' script is a useful enhancement; please ensure it is integrated into the CI process for continuous feedback.
    "check:unused-steps": "TS_NODE_PROJECT=./tests/e2e/cucumber/tsconfig.json cucumber-js --profile=e2e --format usage --dry-run tests/e2e/cucumber/features/*/*.feature"

tests/e2e/support/objects/app-files/share/utils.ts:1

  • Removal of the unused 'resourceIsNotOpenable' function is appropriate; please ensure no other parts of the code are relying on it.
import { errors, Page } from '@playwright/test'

tests/e2e/support/objects/app-files/share/index.ts:52

  • The removal of the 'resourceIsNotOpenable' method from the Share class is consistent; verify that no tests or dependent logic require its behavior.
  }

tests/e2e/support/objects/app-files/resource/index.ts:274

  • Removing the 'checkThatFileVersionIsNotAvailable' function cleans up unused code; ensure that any file version related checks are covered elsewhere if needed.
  }

tests/e2e/support/objects/app-files/resource/index.ts:308

  • The deletion of 'expectFileToBeSelected' is acceptable as long as its functionality is not required by any active tests.
  }

tests/e2e/support/objects/app-files/resource/actions.ts:1866

  • Removing the unused version check function helps reduce maintenance overhead; confirm that version-related functionality remains tested where needed.
}

tests/e2e/support/objects/app-files/page/shares/withMe.ts:10

  • The removal of 'openShareWithMeFromInternalLink' is justified if it is no longer used; double-check that tests are updated accordingly.
  }

tests/e2e/support/objects/app-files/page/public.ts:67

  • Removing the 'uploadInternal' method is acceptable if it is unused; please confirm that there are no lingering test cases expecting this functionality.
  }

tests/e2e/support/objects/app-files/link/index.ts:82

  • Ensure that the removal of 'getPublicLinkUrl' does not affect any remaining tests or functions that might require public link URL retrieval.
  }

tests/e2e/support/objects/app-files/link/actions.ts:306

  • The deletion of 'getPublicLinkVisibility' is acceptable if public link visibility is now managed by other functions; confirm that its removal doesn’t leave any gaps in functionality.
}

tests/e2e/cucumber/steps/ui/shares.ts:192

  • The removal of this step definition is consistent with the overall cleanup; please confirm that the test suite reflects these changes.
    for (const resource of stepTable.hashes()) {

tests/e2e/cucumber/steps/ui/resources.ts:723

  • The removal of version checking steps cleans up the test suite; verify that version functionality is sufficiently covered elsewhere.
  async function (this: World, stepUser: string, spaceName: string) {

tests/e2e/cucumber/steps/ui/public.ts:157

  • Removing this test step is acceptable if the associated 'uploadInternal' functionality has been deprecated; ensure alternative tests cover public link uploads if needed.
    for (const info of stepTable.hashes()) {

tests/e2e/cucumber/steps/ui/links.ts:166

  • The removal of these public link step definitions is fine as long as their functionality is either obsolete or reimplemented elsewhere.
  }

tests/e2e/cucumber/steps/ui/adminSettings.ts:145

  • The deletion of this navigation step is acceptable if it is no longer in use; please confirm that admin settings are still adequately tested.
    switch (action) {

tests/e2e/cucumber/steps/api.ts:206

  • Removing these API step definitions helps in cleaning up unused tests; please make sure that remaining API tests fully cover resource creation functionalities.
    for (const info of stepTable.hashes()) {

@ScharfViktor
Copy link
Contributor Author

CI is failed due #841
will be fixed after clarification

@ScharfViktor
Copy link
Contributor Author

fix failed tests is here #843

@ScharfViktor ScharfViktor merged commit 462f3ce into main Jun 23, 2025
20 checks passed
@ScharfViktor ScharfViktor deleted the deleteUnusedSteps branch June 23, 2025 11:11
@openclouders openclouders mentioned this pull request Jun 23, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants