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

[Question] ERR_ABORTED while trying to download a file inside TeamCity CI machine within Chrome #863

Closed
NikkTod opened this issue Mar 24, 2022 · 9 comments
Labels

Comments

@NikkTod
Copy link

NikkTod commented Mar 24, 2022

Hi all,

Our application has the functionality to export a certain type of report (pdf, csv, etc)

Playwright version 1.20.1

I have the following code:

page.locator(exportButton).click();
Download download = page.waitForDownload(() -> { page.locator(exportPDF).click(); });

As settings I have set the following:

launchOptions.headless = true;
launchOptions.channel = "chrome";
launchOptions.setDownloadsPath(Path.get(System.getProperty("user.dir")
contextOptions.acceptsDownloads = true;


I do not download browsers, I am using chrome that is already installed in the machine.
All these code lines above are working fine when I execute them locally. File gets downloded and checks are passing.

The problem comes when I try to run the test via TeamCity.The following error occure:

StackTrace:
com.microsoft.playwright.TimeoutError: Timeout 30000 ms exceeded
.....

I have a trace file in which I can see on the last step in the Network tab ->

200 GET
net::ERR_ABORTED GET .....

What I can see is that the button that initiate the download has been pressed and the file is actually downloaded.
I have it within the build artifacts, so I am sure that it was downloaded.

Do you know what could cause this ERR_ABORTED, maybe I need to set some additional arguments upon browser launch.

The machine is running on Linux and it has preinstalled Chrome browser

@yury-s
Copy link
Member

yury-s commented Mar 24, 2022

StackTrace:
com.microsoft.playwright.TimeoutError: Timeout 30000 ms exceeded

Can you show full stack?

My hunch is that net::ERR_ABORTED might be a side effect of the timeout and playwright closing browser. Can you share the trace file? Do you know if Chrome version on the linux box is the same as local?

It'd be also helpful if you could run failing test with DEBUG=pw:protocol environment variable and share the output.

@NikkTod
Copy link
Author

NikkTod commented Mar 24, 2022

Hi @yury-s ,

sorry about the screenshots, it just that the company has very strict policy about sharing.

Here is the full stack:
image

Here are also 3 screenshots from the traces, sorry for hind some data and that I am not able to provide it:
image

image

image

Chrome version is the same as local. I will now try to run it with DEBUG=pw:protocol

Just as info I found one other issue microsoft/playwright#5509 that has similar behaivior.

I can also see that the file is actually downloded, but also got this net::ERR_ABORTED.

The pw:protocol did not work out, so I tried pw:api

image

@yury-s
Copy link
Member

yury-s commented Mar 24, 2022

Is it a navigation that becomes a download? If that's the case it is the same issue as #541 and this is just how Chromium behaves in that case. It's unclear though why the behavior would be different on the TeamCity machines compared to the local one.

@NikkTod
Copy link
Author

NikkTod commented Mar 25, 2022

I think it is not navigation.

After clicking on the PDF link 2 GET requests are created.

image

From previous post within the pw:api logs we can see that page.waitForDownload is started and it returns 200 code (that can be seen from the traces screenshot), but after that timesout.

Is there a way to set a bigger timeout, just to check if it has someting to do with the downlod time, althought the file is very small?

@NikkTod
Copy link
Author

NikkTod commented Mar 28, 2022

Hi @yury-s,

hope you had a nice weekend.

I have one more question, is there a way to somehow to avoid using the download class.

I mean I can just click on the button and the file will be downloaded, the problem is that the file name is some generated number.

So I am not able to validate if the file has the .pdf extention for example.

Is there a way to set up downloads to be always saved with the suggestedFilename ? This way even if I am not able to use the download class I would be able to verify if a file has been downloaded in the folder location and check its name.

@yury-s
Copy link
Member

yury-s commented Mar 28, 2022

I mean I can just click on the button and the file will be downloaded, the problem is that the file name is some generated number.

You can call download.suggestedFilename().

Is there a way to set up downloads to be always saved with the suggestedFilename ?

No, there is no way to do that. To save the file with a custom name you can call saveAs.

The pw:protocol did not work out, so I tried pw:api

What do you mean by 'did not work out', no output? Looking at 'pw:api' trace there are at least 2 successful waitForDownload calls but maybe the second one is dispatched on a different page. Can you share a reproduction scenario?

@NikkTod
Copy link
Author

NikkTod commented Mar 29, 2022

Hi @yury-s,

seems that I have mislead you.

On my local machine the chrome browser is version 99 and the download is not throwing.

On the Teamcity machine the browser version is 88.

I found the following issue microsoft/playwright#3726 (comment)

Could this be the problem, that the download is not working on browsers that are old more than 6 months ?

@yury-s
Copy link
Member

yury-s commented Mar 30, 2022

Yeah, it may well be the case. 88 is too old there have been some changes to the download implementation since then which could fix the issue. I'd suggest you update chrome on the Teamcity machine to current stable version and try with that.

@yury-s
Copy link
Member

yury-s commented Apr 7, 2022

We need more information to act on this report. Please file a new one and link to this issue when you get back to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants