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

Re-add frame-src CSP to allow downloading the desktop viewer file #1801

Merged

Conversation

jelly
Copy link
Member

@jelly jelly commented Sep 2, 2024

This was removed 0dcf864 under the impression it wasn't needed as all integration tests but the tests never validated if the desktop viewer file could be downloaded.

Additionally add an integration test which verifies that the file can be downloaded successfully.

Closes: #1799

@@ -44,13 +56,16 @@ class TestMachinesConsoles(machineslib.VirtualMachinesCase):
b.wait_in_text(".pf-v5-c-console__manual-connection dl > div:nth-child(2) dd", "5900")

b.click(".pf-v5-c-console__remote-viewer-launch-vv") # "Launch Remote Viewer" button
b.wait_visible("#dynamically-generated-file") # is .vv file generated for download?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, this just checked that there is an HTML element which the file-saver library creates for downloading. As we now wait on the download this is not needed anymore and an implementation detail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually not the file-saver library but our own code...

@martinpitt
Copy link
Member

As the integration test is the main part of this PR and it fails, I'll defer review.

@jelly
Copy link
Member Author

jelly commented Sep 2, 2024

As the integration test is the main part of this PR and it fails, I'll defer review.

No problem, it worked locally so I'll need to debug CI maybe headless testing get's in the way.

@jelly jelly force-pushed the frame-download-button-regression branch from a446683 to 96a448b Compare September 2, 2024 13:35
@garrett
Copy link
Member

garrett commented Sep 3, 2024

Suspicious pixel test change: https://cockpit-logs.us-east-1.linodeobjects.com/pull-1801-96a448bb-20240902-133612-fedora-40/log.html

Wild guess: That looks like it might be a scrollbar gutter? 🤨 Odd.

@jelly
Copy link
Member Author

jelly commented Sep 3, 2024

Ugh, Firefox downloads it as a randm file, while chromium as "download".

[jelle@t14s][~]%ls -lh /tmp/cockpit-test-browser-home-bd9joxkc/Downloads/
total 8.0K
-rw-r--r-- 1 jelle jelle 132 Sep  3 19:00 oSrDLn77
-rw-r--r-- 1 jelle jelle 132 Sep  3 19:00 PE4YXEz3

@jelly jelly force-pushed the frame-download-button-regression branch 2 times, most recently from e206a98 to 123205f Compare September 3, 2024 18:16
This was removed 0dcf864 under the impression it wasn't needed
as all integration tests but the tests never validated if the desktop
viewer file could be downloaded.

Additionally add an integration test which verifies that the file can be
downloaded successfully.

Hide the iframe to avoid showing a temporary scrollbar which flakes the
pixel test.

Closes: cockpit-project#1799
@jelly jelly force-pushed the frame-download-button-regression branch from 123205f to 319ab81 Compare September 4, 2024 09:10
else:
b.wait_visible("#dynamically-generated-file") # is .vv file generated for download?
self.assertEqual(b.attr("#dynamically-generated-file", "href"),
u"data:application/x-virt-viewer,%5Bvirt-viewer%5D%0Atype%3Dspice%0Ahost%3D127.0.0.1%0Aport%3D5900%0Adelete-this-file%3D1%0Afullscreen%3D0%0A")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, why doesn't this include the funny [........GraphicsConsole] part?

Copy link
Member

@mvollmer mvollmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mvollmer mvollmer merged commit 7b1ef1a into cockpit-project:main Sep 4, 2024
26 of 27 checks passed
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

Successfully merging this pull request may close these issues.

"Launch remove viewer" does not download the "download" virt-viewer file.
4 participants