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

test-deployment-e2e is failing integration test #3141

Open
andrew-jameson opened this issue Aug 13, 2024 · 5 comments · May be fixed by #3196
Open

test-deployment-e2e is failing integration test #3141

andrew-jameson opened this issue Aug 13, 2024 · 5 comments · May be fixed by #3196
Assignees
Labels
bug dev integrationtests P2 Needed – Can wait indefinitely Refined Ticket has been refined at the backlog refinement

Comments

@andrew-jameson
Copy link
Collaborator

andrew-jameson commented Aug 13, 2024

Thank you for taking the time to let us know about the issue you found. The basic rule for bug reporting is that
something isn't working the way one would expect it to work. Please provide us with the information requested
below and we will look at it as soon as we are able.

Description

For weeks/months, develop environment fails our e2e cypress test. I can't find origin of when it failed.

Action Taken

Upon merge of successful and tested branch to develop, e2e test fails.

What I expected to see

Screenshot 2024-08-13 at 12 56 11 PM

What I did see

Test failure in develop
Screenshot 2024-08-13 at 12 54 06 PM

Other Helpful Information

@robgendron robgendron added Refined Ticket has been refined at the backlog refinement P2 Needed – Can wait indefinitely labels Aug 20, 2024
@andrew-jameson andrew-jameson self-assigned this Sep 11, 2024
@andrew-jameson
Copy link
Collaborator Author

Well, halfway there:
https://app.circleci.com/pipelines/github/raft-tech/TANF-app/28427/workflows/7444288b-5fcf-448b-a571-e4f472c4ded7/jobs/83752

User was created, seems there may need to be an approval happening.

@andrew-jameson
Copy link
Collaborator Author

First pipeline to fail on this cypress step

Originating ticket: Link
PR: Link
Commit: Link

However, looking over this, I don't see any code that would invalidate the POST being used. A local run of e2e is successful and same in the pipeline so this is only at the deployed "point-and-login" so perhaps the auth upgrade is being certified as a bad request over CRSF violation or equivalent. There were a number of nginx changes to support the new domain name for tdp-frontend-develop.acf.hhs.gov:

Kibana Deployment PR 1
Nginx DNS for Kibana/ClamAV
Originating ticket - Cloud.gov resetting Kibana route

Original ACF domain tickets
Per this comment domains reworked in this PR.

@andrew-jameson
Copy link
Collaborator Author

andrew-jameson commented Sep 13, 2024

Reworking nginx config with @raftmsohani didn't yield the results we'd hoped for. Will re-convene on it Monday.

Failed pipeline

   -----> Installing nginx 1.25.1
   Copy [/tmp/cache/final/dependencies/88daf4e79c4db8bf01ae3de3795661fd9a8b443ba4e498af6362be2d3e695a22/nginx_1.25.1_linux_x64_cflinuxfs4_c030b0cf.tgz]
   2024/09/13 21:15:03 [emerg] 445#0: invalid number of arguments in "proxy_set_header" directive in /tmp/conf310622263/locations.conf:7
   nginx: configuration file /tmp/conf310622263/nginx.conf test failed
   **ERROR** Could not validate nginx.conf: nginx.conf contains syntax errors: exit status 1
   Failed to compile droplet: Failed to run all supply scripts: exit status 14
   Exit status 223
BuildpackCompileFailed - App staging failed in the buildpack compile phase
FAILED

Exited with code exit status 1

Offending line:

        proxy_set_header Host ;

@andrew-jameson
Copy link
Collaborator Author

Working on the e2e test failing, it appears our cypress version is out of date for a bit. I found a bug report that lines up with the error I'm seeing. However, before/after upgrading the version, the referer is still not in cypress's OUTGOING post request. The original code added it directly in the header like this:

Cypress.Commands.add(
  'adminApiRequest',
  (method = 'POST', path = '', body = {}) => {
    options = {
      method,
      body,
      url: `${Cypress.env('adminUrl')}${path}`,
      form: true,
      headers: {
        Referer: `${Cypress.env('adminUrl')}`,   //'https://tdp-frontend-develop.acf.hhs.gov/admin', //
      },
    }

However, the workaround lin that bug report show a decidedly different handling, albeit theirs appears to be a simple GET or visit:

it('should visit with referrer', () => {
    const onBeforeLoad = (contentWindow) => {
      Object.defineProperty(contentWindow.document, 'referrer', {
        value: 'http://test.com/',
        enumerable: true,
        configurable: true,
      });
    };

    cy.visit('/', { onBeforeLoad });
    . . .
})

Using version 11 cypress, no referer.
Screenshot 2024-09-16 at 11 02 20 AM

Using versions 12/13, now have referer but it's insecure:

Screenshot 2024-09-16 at 11 27 07 AM Screenshot 2024-09-16 at 11 27 28 AM

@andrew-jameson
Copy link
Collaborator Author

andrew-jameson commented Sep 20, 2024

https://stackoverflow.com/a/71314689
Setup tests like pytest vs needing to run Given The admin logs in before each

Could also remove need for auth/sessions when utilizing the admin API in cypress endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dev integrationtests P2 Needed – Can wait indefinitely Refined Ticket has been refined at the backlog refinement
Projects
None yet
2 participants