testcafe: "Error: Can only get response body on requests captured after headers received" when running test on local environment and with experimental proxyless mode

What is your Scenario?

Run a test against a local environment and with experimental proxyless mode

What is the Current behavior?

There is an error:

Error: Can only get response body on requests captured after headers received.

In the screenshot, a blank page is seen

What is the Expected behavior?

The test should pass in experimental proxyless mode as it passes without the experimental proxyless mode

What is your public website URL? (or attach your complete example)

As this is an internal site and works against a reverse-proxy and localhost, steps to reproduce would not work here.

Attaching testcafe.log instead in the test report section

What is your TestCafe test code?

fixture`flagging testcases`
  .meta({
    fixtureID: 'f-0001',
    author: 'GDG',
    app: '',
  })
  .beforeEach(async (t) => {
    email = await sharedHelpers.createCSSubUser();
    console.log('Logging in with ' + email);
    await sharedHelpers.userLogInWithCredentials(email, sharedHelpers.password);
    await t.navigateTo(
      `${config.baseUrl}` +
        '/homework-help/questions-and-answers/east-university-eu-754-students-enrolled-math-1324-math-1325-535-enrolled-math-1324-257-en-q21691469?trackid=5fd398a8c83d&strackid=07caa782f378'
    );
  });

test.meta({
  testID: 't-0001',
  testType: 'Smoke',
  testRailCaseId: '277066',
  priority: 'p1',
})('Validate the flagging icon is present on the tbs page', async (t) => {
  // sometimes tests fail due to not setting the native dialog handler, something to do with qa page
  console.log('Starting flagging component validation');
  await t
    .expect(locators.flagButton.visible)
    .ok()
    .click(locators.flagButton)
    .expect(locators.flagDialogueBox.visible)
    .ok()
    .expect(locators.flagDialogueBox.visible)
    .ok()
    .expect(locators.flagReasonInappropriate.visible)
    .ok()
    .expect(locators.flagReasonSpam.visible)
    .ok()
    .expect(locators.flagReasonOther.visible)
    .ok()
    .expect(locators.flagTextBox.visible)
    .ok();
});

Your complete configuration file

module.exports = {
  screenshots: {
    takeOnFails: true,
    fullpage: true,
    pathPattern:
      '${FIXTURE}_${USERAGENT}/${TEST}/${DATE}_${TIME}__${QUARANTINE_ATTEMPT}/${FILE_INDEX}.png',
    path: './testcafe/screenshots',
  },
  clientScripts: [{ module: 'axe-core/axe.min.js' }],
  reporter: [
    {
      name: 'spec-time',
    },
    {
      name: 'slack-errors-only',
    },
    {
      name: 'list',
      output: 'testcafe/reports/report.txt',
    },
    {
      name: 'xunit',
      output: 'testcafe/reports/xunit.xml',
    },
    {
      name: 'html',
      output: 'testcafe/reports/report.html',
    },
  ],
  quarantineMode: false,
  skipJsErrors: true,
  skipUncaughtErrors: true,
  experimentalProxyless: true,
  selectorTimeout: 15000,
  assertionTimeout: 15000,
  pageLoadTimeout: 20000,
  speed: 1,
  qrCode: true,
  color: true,
  cache: true,
  stopOnFirstFail: false,
  // eslint-disable-next-line max-params
  filter: function (_, _, _, testMeta, fixtureMeta) {
    const environment = process.env.CHEGG_ENV || 'test';

    if (fixtureMeta.env) {
      if (Array.isArray(fixtureMeta.env)) {
        return fixtureMeta.env.includes(environment);
      }

      return fixtureMeta.env === environment;
    }

    if (!testMeta.env) return true;

    if (Array.isArray(testMeta.env)) {
      return testMeta.env.includes(environment);
    }

    return testMeta.env === environment;
  },
};

Your complete test report

testcafe.log

Screenshots

Screen Shot 2023-02-09 at 5 06 01 PM

Steps to Reproduce

As this is an internal site and works against a reverse-proxy and localhost, steps to reproduce would not work here.

Attaching testcafe.log instead in the test report section

TestCafe version

2.3.1

Node.js version

16.17.1

Command-line arguments

export DEBUG=“testcafe:,hammerhead:” && yarn testcafe chrome testcafe/tests/flaggingTest.ts --experimental-proxyless 2> testcafe.log

Browser name(s) and version(s)

Chrome 109.0.5414.119

Platform(s) and version(s)

On either Mac when running locally or Linux when running on GitLab

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Hi,

Thank you for your sample. I was able to reproduce this issue. We’ll research it.