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

Should not raise an error if during a long running request the "RequestLogger.clear" method will be called #2688

Closed
ricovitch opened this issue Aug 2, 2018 · 2 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: request hooks TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@ricovitch
Copy link

Are you requesting a feature or reporting a bug?

Bug report

What is the current behavior?

When calling multiple times a RequestLogger instance "clear" method in one test, testcafe crash with the following error and the browser (chrome on windows) stays opened.

D:\Developpement\ep\ep-front\ep-front-apps\node_modules\testcafe-hammerhead\lib\request-pipeline\connection-reset-guard.js:20
        throw new Error(err);
        ^
Error: TypeError: Cannot find a recorded request with id=undefined. This is an internal TestCafe problem. Please contact the TestCafe team and provide an example to reproduce the problem.
    at Domain.<anonymous> (D:\Developpement\ep\ep-front\ep-front-apps\node_modules\testcafe-hammerhead\lib\request-pipeline\connection-reset-guard.js:20:15)
    at emitOne (events.js:116:13)
    at Domain.emit (events.js:211:7)
    at Domain._errorHandler (domain.js:118:23)
    at process._fatalException (bootstrap_node.js:371:33)

What is the expected behavior?

Test execution should not crash.

How would you reproduce the current behavior (if this is a bug)?

call RequestLogger instance 'clear' method multiple times in a test.

Provide the test code and the tested page URL (if applicable)

Test code

test.only('Transactions Base Filters', async (t) => {
  // amount filter
  await t.typeText(filters.grossAmountMin, '10')
    .expect(filters.activeFilter.count).eql(1)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && r.request.url.indexOf('grossAmount=10__value') > 0
    ))).ok()
    .typeText(filters.grossAmountMax, '5')
    .expect(filters.grossAmountMin.getReact(({ props: { error } }) => error)).ok()
    .expect(filters.grossAmountMax.getReact(({ props: { error } }) => error)).ok()
    // check invalid input does not fire a request
    .expect(logger.count(r => r.request.url.indexOf('grossAmount=10__value__5') > 0)).eql(0)
    .typeText(filters.grossAmountMax, '00')
    .expect(filters.grossAmountMin.getReact(({ props: { error } }) => error)).notOk()
    .expect(filters.grossAmountMax.getReact(({ props: { error } }) => error)).notOk()
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).grossAmount === '10__value__500'
    ))).ok();

  // orderId filter
  logger.clear();
  await t.typeText(filters.orderId, '8E')
    .expect(filters.activeFilter.count).eql(2)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).orderId === '*8E*'
    ))).ok()
    .click(filters.orderId)
    .pressKey('ctrl+a delete')
    .expect(filters.activeFilter.count).eql(1);

  // email filter
  logger.clear();
  await t.typeText(filters.customerEmail, 'fvrecord')
    .expect(filters.activeFilter.count).eql(2)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).customerEmail === '*fvrecord*'
    ))).ok()
    .click(filters.customerEmail)
    .pressKey('ctrl+a delete')
    .expect(filters.activeFilter.count).eql(1);

  // status filter
  logger.clear();
  await t.click(filters.status)
    .click(filters.statusMenuItem('VALIDATED'))
    .expect(filters.activeFilter.count).eql(2)
    .expect(filters.status.getReact(({ props: { value } }) => value.length)).eql(1)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).status === 'VALIDATED'
    ))).ok();

  logger.clear();
  await t.click(filters.status)
    .click(filters.statusMenuItem('REFUSED'))
    .expect(filters.status.getReact(({ props: { value } }) => value.length)).eql(2)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).status === 'VALIDATED|REFUSED'
    ))).ok();

  logger.clear();
  await t.click(filters.status)
    .click(filters.statusMenuItem('VALIDATED'))
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).status === 'REFUSED'
    ))).ok()
    .click(filters.status)
    .click(filters.statusMenuItem('REFUSED'))
    .expect(filters.status.getReact(({ props: { value } }) => value.length)).eql(0)
    .expect(filters.activeFilter.count).eql(1);

  // transactionType filter
  logger.clear();
  await t.click(filters.type)
    .click(filters.statusMenuItem('DEBIT'))
    .expect(filters.activeFilter.count).eql(2)
    .expect(filters.type.getReact(({ props: { value } }) => value.length)).eql(1)
    .expect(logger.contains(r => (
      r.response.statusCode === 200
      && requestParser.getParams(r.request.url).type === 'DEBIT'
    ))).ok();

  // reset all
  logger.clear();
  await t.click(filters.resetButton)
    .expect(filters.activeFilter.count).eql(0)
    .expect(logger.contains((r) => {
      const params = requestParser.getParams(r.request.url);
      return params.grossAmount === undefined
        && params.orderId === undefined
        && params.customerEmail === undefined
        && params.status === undefined
        && params.type === undefined;
    })).ok();
});

Specify your

@miherlosev miherlosev self-assigned this Aug 2, 2018
@miherlosev miherlosev added STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug). SYSTEM: request hooks and removed STATE: Need clarification An issue lacks information for further research. labels Aug 2, 2018
@miherlosev miherlosev added this to the Sprint #15 milestone Aug 2, 2018
@miherlosev
Copy link
Collaborator

Hi @ricovitch

Thank you for the detailed description. I've reproduced the problem.

@miherlosev miherlosev changed the title RequestLogger 'clear' fatal error when calling multiple times in one test Should not raise an error if during a long running request the "RequestLogger.clear" method will be called Aug 2, 2018
miherlosev pushed a commit to miherlosev/testcafe that referenced this issue Aug 2, 2018
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this issue Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: request hooks TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants