flood-io / element

💦Load test your app using real web browsers
https://element.flood.io
Apache License 2.0
354 stars 43 forks source link

circular(false) with loopCount: Infinity does not match documented behavior #578

Open Wilhansen opened 2 years ago

Wilhansen commented 2 years ago

Describe the bug

According to the documentation of circular: https://element.flood.io/docs/api/test-data#testdatasource

Passing false will to disable circular data loading, causing test to complete after 1 loop of test data.

but when running the code, it will just loop while printing "Test data exhausted, consider making it circular?" indefinitely when the data is exhausted.

The behavior can be traced here: https://github.com/flood-io/element/blob/1c95ba6a5dfdd3c5e3d4ef6b7cf6fc41d991e1ac/packages/core/src/runtime/Test.ts#L195

To Reproduce

run the code in this section: https://element.flood.io/docs/api/test-data#testdatasource with sample data.

Expected behavior

The test will iterate through all the data in the test data and halt (i.e. complete).

Additional context

The documented behavior is needed in cases where tests simply requires going through all the data in the list once.