Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
Can I get the network requests in testcafe from the beforeEach?

I saw this page from testcafe documentation, but it all points toward tests.

import { RequestLogger } from 'testcafe';
const logger = RequestLogger({ logResponseBody: true, logRequestBody: true });
const methodCallInBeforeEach = async => {console.log(logger.requests)}

Every time my logger is empty, as if I had no requests. This works if I try to get the info from a test, but didn't manage to do it from the beforeEach. Is that even possible or am I missing something?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I prepared a sample that demonstrates that the logger.requests works as expected inside the beforeEach hook:

import { RequestLogger, Selector } from 'testcafe';

const headerLogger = RequestLogger(/testcafe/, {
    logRequestHeaders:  true,
    logResponseHeaders: true,
});

fixture `f`
    .page `https://testcafe.io`
    .requestHooks(headerLogger)
    .beforeEach(async t => {
        await t.click(Selector('a').withText('Docs'));

        console.log(headerLogger.requests.map(r => r.request.url));
    });

test(`t`, async t => {

});

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda