altinn-studio icon indicating copy to clipboard operation
altinn-studio copied to clipboard

Changed the nginx config so that our local test projects will work

Open mjulstein opened this issue 2 years ago • 6 comments

Description

Changed the nginx config so that our local test projects will work with different versions without editing their respective index.cshtml files. This is a quicker fix than to replace all the refs to http://localhost:8080 in our test-projects... Doing so will also require us to update Cypress tests accordingly.

Related Issue(s)

  • #9032

Verification

  • [ ] Your code builds clean without any errors or warnings
  • [ ] Manual testing done (required)
  • [ ] Relevant automated test added (if you find this hard, leave it and we'll help out)
  • [ ] All tests run green

mjulstein avatar Oct 06 '22 15:10 mjulstein

@ivarne think this might solve what we discussed, for our Cypress-test apps?

mjulstein avatar Oct 06 '22 15:10 mjulstein

I don't really like the increased complexity and the added risk of side effects from replacing http://localhost:8080/ from anywhere inn all app responses. Otherwise this looks good to me. If it solves a problem, go ahead.

ivarne avatar Oct 06 '22 19:10 ivarne

Could we do the opposite instead? Cypress can also intercept requests and rewrite them - could we simply fix this in app-frontend-react so that Cypress always loads from localhost:8080 no matter what the app tells it to? That way frontend-test and the other testing apps become normal apps again, and we won't have to rely on this feature to include a niche case for 3 of our apps.

olemartinorg avatar Oct 06 '22 20:10 olemartinorg

@olemartinorg this is the url to load app-front end-react, so too late to try to change urls there.

Rewriting urls in cypress seems promising.

ivarne avatar Oct 07 '22 04:10 ivarne

Could we do the opposite instead? Cypress can also intercept requests and rewrite them - could we simply fix this in app-frontend-react so that Cypress always loads from localhost:8080 no matter what the app tells it to? That way frontend-test and the other testing apps become normal apps again, and we won't have to rely on this feature to include a niche case for 3 of our apps.

Maybe, I'm not sure if we ever run Cypress towards other environments though...

mjulstein avatar Oct 07 '22 07:10 mjulstein

@mjulstein See the linked PR - I think this could solve the issue as well, but in app-frontend-react. As far as I know we're not running Cypress against anything other than localhost:8080 (if we were, we wouldn't be hardcoding that URL in these apps). But if we want to, I also made that configurable (so that one could run the Cypress tests against the copy on altinncdn.no if we wanted to).

  • Altinn/app-frontend-react/pull/525

olemartinorg avatar Oct 07 '22 12:10 olemartinorg

Closing this as the need is now covered by the aforementioned PR in app-frontend-react. I'll update our test apps soon.

olemartinorg avatar Nov 01 '22 14:11 olemartinorg