Skip to content

[💡 Feature]: Allow specs to run multiple times in a group #10910

@ddNils

Description

@ddNils

Is your feature request related to a problem?

I have started to rewrite tests to be more granular. Before this we had spec files with around 1000 rows of code. Now I am trying to split them up, so that parts of the tests can be run in each test (like login for example).
After splitting up a complex spec file, it did not run correctly as I did reuse a spec file inside a group multiple times.

So our specs look something like this:

  specs: [
    [
      './test/specs/initBrowsers.ts',
      './test/specs/loginUserSetGuest.ts',
      './test/specs/loginShared.ts',
      './test/specs/testGuest.ts',
      './test/specs/logout.ts',
      './test/specs/loginUserSetAdmin.ts',
      './test/specs/loginShared.ts',
      './test/specs/testAdmin.ts',
      './test/specs/createEntity.ts',
      './test/specs/checkButtonDeleteIsVisible.ts',
      './test/specs/logout.ts',
      './test/specs/loginUserSetGuest.ts',
      './test/specs/loginShared.ts',
      './test/specs/checkButtonDeleteIsNotVisible.ts',
      './test/utils/logBrowsersOutput.ts'
    ]
  ]

Of course we have multiple test-groups and there we are re-using the logins and logouts for example. Now I get frustrated, because the above sample does not work. wdio only runs the first login, the next ones are omitted. How can I make this work?

Describe the solution you'd like.

I would like wdio to use an indexed array instead of a simple array to hold the spec files, so that the same spec file can be used multiple times in a group.

Describe alternatives you've considered.

Alternatively it might also be ok, to introduce a special character or similar to avoid the problem, which gets ignored when resolving the file names.

Additional context

I was also experimenting with suites, but was not able to get them running in the desired way, maybe because we are using an multiremote approach and we need to loose the session in specific cases.
The main issue was, that we needed to save the id of the entity that we created in the test to delete it in a later test and were not able to securely share this id between the specs.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Idea 💡A new feature ideahelp wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions