简体   繁体   English

Testcafe - 上传文件,状态为 222,没有响应,日志中也没有错误

[英]Testcafe- Upload file getting status 222 with no response and no errors in logs

I am trying to upload a file using testcafe script but its going in infinite loop.我正在尝试使用 testcafe 脚本上传文件,但它处于无限循环中。 I am not getting what's wrong with my code, while all other functionalities except upload are working fine.我没有发现我的代码有什么问题,而除了上传之外的所有其他功能都可以正常工作。

const click_upload=Selector('input[name="logo"]')
const upload_logo=Selector('input[name="logo"],input[inputtype="file"]')

test
    ('upload file step 3',async t=>{
        await t
        .useRole(somerole)
        .navigateTo('https://xyz.in/')
        .click(click_upload)// Upload button has a css 
        .wait(5000)
        .setFilesToUpload(upload_logo,[
            './_uploads_/image.png'
            ])
        .wait(12000)

    })

Its going in infinite loop and it's never ending, I even tried to add.debug() and check but no help.它进入无限循环并且永无止境,我什至尝试 add.debug() 并检查但没有帮助。 I am getting status code 222 in api call, and empty response.我在 api 调用中收到状态代码 222 ,并且响应为空。 ie in upload there is no api call going, I have checked on console and I am not getting any errors , If I try manually its working.即在上传中没有 api 调用,我已经在控制台上检查过,我没有收到任何错误,如果我手动尝试它的工作。

In s3 config there was an issue with CORS policy, it was not enabled for localhost.在 s3 配置中,CORS 策略存在问题,它没有为 localhost 启用。 Also make sure you allowed origin for all, And also one thing you can do is, Not required in every case but configure testcafe to run on HTTPS also.还要确保您允许所有人的来源,您还可以做的一件事是,并非在每种情况下都需要,但也将 testcafe 配置为在 HTTPS 上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM