Nanciee / cypress-autorecord

Simplify API mocking by auto-recording/stubbing HTTP interactions and automating the process of updating/deleting mocks.
223 stars 53 forks source link

Why not allow specific config on per test basis? #78

Open emahuni opened 1 year ago

emahuni commented 1 year ago

I am new to this plugin, just wondering why not allow tests to set their own patterns and config? I frequently find myself going back to the config to adjust config just for certain tests, of which I don't want adjusting for globally.

ie:

const autoRecord = require('cypress-autorecord'); // Require the autorecord function

describe('Test Articles Page', function() { // Do not use arrow functions
 autorecord( {
    interceptPattern: "**/api/v1/items/articles/**",
    // forceRecord: true,
    // cleanMocks: true,
  });

  // Your hooks (beforeEach, afterEach, etc) goes here

  it('...', function() { // Do not use arrow functions
    // Your test goes here
  });
});

This:

and yes, I have not looked into the source to determine the possibility of this, however, I believe this is a more clearer and more efficient manner to do this.