Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Not able to replay the recorded requests #484

Open
rochanram opened this issue Aug 10, 2023 · 2 comments
Open

[Question]: Not able to replay the recorded requests #484

rochanram opened this issue Aug 10, 2023 · 2 comments

Comments

@rochanram
Copy link

rochanram commented Aug 10, 2023

Description

Im recording all the requests for a test and its saved here: ./recordings/iam-login-logout_301619159/recording.har

import { Polly } from "@pollyjs/core";
import NodeHTTP from "@pollyjs/adapter-node-http";
import { MODES } from '@pollyjs/utils';
import FSPersister from '@pollyjs/persister-fs';

Polly.register(NodeHTTP);
Polly.register(FSPersister);

tags(APP, CRITICAL, WEB).describe('IAM - Login and Logout Tests', function () {
  let tempUser;
  before(async function () {
    this.polly = new Polly('iam-login-logout', {
      mode: MODES.REPLAY,
      adapters: ['node-http'],
      persister: 'fs',
      persisterOptions: {
        fs: {
          recordingsDir: './recordings'
        }
      },
      recordIfMissing: true,
      matchRequestsBy: {
        method: true,
        headers: true,
        body: true,
        order: false,
        url: {
            protocol: true,
            username: false,
            password: false,
            hostname: true,
            port: false,
            pathname: true,
            query: true,
            hash: true,
        },
    },
    });
    [tempUser] = await createUser({ type: 'free' });
  });
  it(`should login the users`, async function () {
    await login(tempUser, { goToWorkspace: 'My Workspace' });
  });

  it(`should logout the users`, async function () {
    if (this.polly) {
      this.polly.stop();
    }
    await logout();
  });
});
`

It saves the recordings at : ./recordings/iam-login-logout_301619159/recording.har

But If I run it in replay mode. Its recording again a new file.

When I change it to

recordIfMissing: false,

It shows this error:

[Polly] [adapter:node-http] Recording for the following request is not found and `recordIfMissing` is `false`.
@lox
Copy link

lox commented Sep 7, 2023

I am having exactly the same issue, even when setting everything in matchRequestsBy to false.

@Nick-Minutello
Copy link

Not sure about the stop in your tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants