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

Cypress: add view-only tests #1082

Merged
merged 7 commits into from
Nov 1, 2021
Merged

Conversation

himdel
Copy link
Collaborator

@himdel himdel commented Oct 12, 2021

Fixes AAH-997

A cy.settings Cypress command was added in #1116.
(It also added cypress.env.json.template but didn't document it, fixing here.)

Adding a test for view-only mode, using cy.settings to change the server settings for the duration.

With GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESS & GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOAD, test that Collections, Namespaces and Documentation are in the menu, we can see the list & detail screens, and no Add/Upload/Create buttons, as well as Unauthorized elsewhere.

With just GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESS: check that collection detail screen has the alert instead of a download button.

And changing the settings for github actions to GALAXY_REQUIRE_CONTENT_APPROVAL=False, so that galaxykit collection upload doesn't require approvals everywhere (AAH-628 will deal with enabling it back for approval tests). This should unblock #1117 & #1137.


❕ Note: when testing locally, most likely you first need to:

  • update galaxykit to 0.5.2+: python -m pip install --user galaxykit --upgrade
  • add settings and restart to your test/cypress.env.json (see test/cypress.env.json.template and test/README.md)

@himdel
Copy link
Collaborator Author

himdel commented Oct 14, 2021

galaxykit collection upload...

local dev setup:

sendto(3, "POST /api/automation-hub//content/inbound-admin/v3/artifacts/collections/"..., 402, 0, NULL, 0) = 402
sendto(3, "----------------------------8a77377278a14d509f9514624920abae\r\nContent-Disposition: form-data; name=\"sha256\"\r\nf3a9d43b270911bff8830d2f0b8d53c68fd041cedf81ff3709e1cadd3ce81ef1\r\n-------------------------"..., 2023, 0, NULL, 0) = 2023
recvfrom(3, "HTTP/1.1 202 Accepted\r\nX-Powered-By: Express\r\nserver: gunicorn\r\ndate: Thu, 14 Oct 2021 01:45:57 GMT\r\nconnection: close\r\ncontent-type: application/json\r\nvary: Accept, Accept-Language, Cookie\r\nallow: PO"..., 8192, 0, NULL, NULL) = 460

with pulp-oci-images:

sendto(3, "POST /api/galaxy//content/inbound-admin/v3/artifacts/collections/"..., 394, 0, NULL, 0) = 394
sendto(3, "----------------------------10529abe4e3740668301c8f531c3beeb\r\nContent-Disposition: form-data; name=\"sha256\"\r\n6fe2db72c654b8150d5d031650dea161fd4b607c5cddb04b4ce5b769f4cbfa7d\r\n-------------------------"..., 2021, 0, NULL, 0) = 2021
recvfrom(3, "HTTP/1.1 404 Not Found\r\nServer: nginx/1.14.1\r\nDate: Thu, 14 Oct 2021 01:44:46 GMT\r\nContent-Type: text/html\r\nContent-Length: 179\r\nConnection: keep-alive\r\nVary: Accept-Language\r\nContent-Language: en-us\r"..., 8192, 0, NULL, NULL) = 468

I think this may be a gunicorn vs nginx difference in handling the double //, the URL the UI uses is the same, except with just one slash.

=> ansible/galaxykit#14 .. released in galaxykit 0.5.2
(.. and 29db1a4 here to disable approvals)

hendersonreed pushed a commit to ansible/galaxykit that referenced this pull request Oct 25, 2021
Related to ansible/ansible-hub-ui#1082 (comment)

{galaxy_root}/content yields a string with a double slash when used with a --server value with a trailing slash (the default)
double slashes don't seem to work with pulp-oci-images (or nginx?), using urljoin as elsewhere
@himdel himdel marked this pull request as ready for review October 29, 2021 23:08
@himdel himdel added the backport-4.4 This PR should be backported to stable-4.4 (2.1) label Oct 29, 2021
@himdel himdel changed the title Cypress: modify settings.py when needed; add view-only test Cypress: add view-only tests Oct 29, 2021
and wait for namespace detail title
…UIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)
Copy link
Member

@ZitaNemeckova ZitaNemeckova left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@himdel himdel merged commit fb0a8d0 into ansible:master Nov 1, 2021
@himdel himdel deleted the cypress-settings branch November 1, 2021 14:44
@patchback
Copy link

patchback bot commented Nov 1, 2021

Backport to stable-4.4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4.4/fb0a8d09bf9793ab95b9f32762f2e24493c53a3c/pr-1082

Backported as #1186

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Nov 1, 2021
* view-only: simple test for view-only mode

* view-only: add tests

* view-only: galaxykit collection upload, to ensure there's a collection

both describes need it

* test/README: mention cypress.env.json.template, document `settings` and `restart`

* view-only: actually go to namespace detail

and wait for namespace detail title

* github cypress settings.py: turn off collections approval (GALAXY_REQUIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)

* test/README: also document `containers` in `cypress.env.json`, from #1142

(cherry picked from commit fb0a8d0)
himdel added a commit that referenced this pull request Nov 1, 2021
* view-only: simple test for view-only mode

* view-only: add tests

* view-only: galaxykit collection upload, to ensure there's a collection

both describes need it

* test/README: mention cypress.env.json.template, document `settings` and `restart`

* view-only: actually go to namespace detail

and wait for namespace detail title

* github cypress settings.py: turn off collections approval (GALAXY_REQUIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)

* test/README: also document `containers` in `cypress.env.json`, from #1142

(cherry picked from commit fb0a8d0)

Co-authored-by: Martin Hradil <mhradil@redhat.com>
@github-actions github-actions bot added the backported-4.4 This PR has been backported to stable-4.4 (2.1) label Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.4 This PR should be backported to stable-4.4 (2.1) backported-4.4 This PR has been backported to stable-4.4 (2.1)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants