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

[Bug]: test case via Playwrigh API POST type show me a fake 200 response - like a cache value #34271

Closed
ggaldin opened this issue Jan 9, 2025 · 3 comments

Comments

@ggaldin
Copy link

ggaldin commented Jan 9, 2025

Version

1.49.1

Steps to reproduce

async criaChaveEmail(chave) {

    const response = await this.request.post('URLxxxxx', {

        headers: {
            Authorization: this.token,              
            "Chave-Idempotencia": '{{$guid}}',
            "Cache-Control": 'no-store'
          
        },
        data: {
            tpChave: 2,
            Chave: chave,
            Ispb: 36586946,
            nrAgencia: '1234',
            tpConta: 0,
            nrConta: '20250101001',
            dtHrAberturaConta: '2023-01-30T09:02:00.001Z',
            tpPessoa: 0,
            cpfcnpj: 94139890010,
            nome: 'Validação Card',
            motivo: 0
        }
    })

Expected behavior

{
"codigo": "JDPICHV004",
"mensagem": "The entered key already exists in the database!"
}

Actual behavior

When a execute a test that call criaChaveEmail the result are:
{
"chave": "[email protected]",
"dtHrCriacaoChave": "2025-01-09T16:27:32.921Z",
"dtHrInicioPosseChave": "2025-01-09T16:09:55.790Z"
}
Image

but i know it not true, the time returned is a old one of my first execussion and i already have the registry on database:
Image

The expected result are a error: 400 Bad Request
{
"codigo": "JDPICHV004",
"mensagem": "The entered key already exists in the database!"
}
On postman i receive it.

Its like the first execution response is in cache and it return every time. i close ui and open and have same result. using $ npx playwright test
same result.

See a using "Cache-Control": 'no-store'

I have a second test for another url, its like the one but it not apresent the problem:

async consultaChave() {

    const response = await this.request.post('urlxxxxx', {

        headers: {
            Authorization: this.token,
            ContentType: 'application/json',
           
        },
        data: {
            ispb: 36586946,
            nrAgencia: "1",
            tpConta: 0,
            nrConta: "1",
            tpPessoa: 0,
            cpfCnpj: 66842768667
        }
    })

    expect(response.ok()).toBeTruthy()

   // const body = JSON.parse(await response.text())
   // this.resposta = body.chavesAssociadas
    //console.log(this.resposta)
}

this always reach the server and give me correct info, i know because os return date time of the info.
Please i need help.

Additional context

No response

Environment

$ npx envinfo --preset playwright
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\ggaldin\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\ggaldin\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\ggaldin\AppData\Local\npm-cache\_logs\2025-01-09T19_30_04_855Z-debug-0.log
@Skn0tt
Copy link
Member

Skn0tt commented Jan 10, 2025

This issue is not following the bug template. Please provide a self-contained reproduction, which we can run locally to reproduce your issue. Thanks for your understanding!

@Skn0tt
Copy link
Member

Skn0tt commented Jan 10, 2025

This looks very much like an application bug, not a Playwright bug. There's no playwright-side caching i'm aware of.

@yury-s
Copy link
Member

yury-s commented Jan 14, 2025

Closing per the response above. If it doesn't work, feel free to open a new issue and provide a self-contained reproduction, which we can run locally.

@yury-s yury-s closed this as completed Jan 14, 2025
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