From a8a34dbd70b67b7fde58ffb1c1b727245d7494e6 Mon Sep 17 00:00:00 2001 From: Mangiang Date: Mon, 15 Nov 2021 22:32:26 -0500 Subject: [PATCH] tests: fix nginx setup --- .drone-kubernetes.yml | 1 + items/frontend/src/cypress/fixtures/default.conf | 15 +++++++++++++++ .../src/cypress/integration/url-check.spec.tsx | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 items/frontend/src/cypress/fixtures/default.conf diff --git a/.drone-kubernetes.yml b/.drone-kubernetes.yml index 6858373..758bc55 100644 --- a/.drone-kubernetes.yml +++ b/.drone-kubernetes.yml @@ -49,6 +49,7 @@ steps: image: nginx:1.21.4-alpine commands: - cp -r ./items/frontend/build/* /usr/share/nginx/html + - cp ./items/frontend/src/cypress/fixtures/default.conf /etc/nginx/conf.d/default.conf - nginx -g "daemon off;" detach: true depends_on: diff --git a/items/frontend/src/cypress/fixtures/default.conf b/items/frontend/src/cypress/fixtures/default.conf new file mode 100644 index 0000000..40b9650 --- /dev/null +++ b/items/frontend/src/cypress/fixtures/default.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/items/frontend/src/cypress/integration/url-check.spec.tsx b/items/frontend/src/cypress/integration/url-check.spec.tsx index 22910fc..802a7dd 100644 --- a/items/frontend/src/cypress/integration/url-check.spec.tsx +++ b/items/frontend/src/cypress/integration/url-check.spec.tsx @@ -39,7 +39,7 @@ describe('Url check', () => { describe('Check page not found', () => { it('Invalid url should redirect to page not found', () => { - cy.visit('/ABC', {failOnStatusCode: false}).its('status').should('equal', 404) + cy.visit('/ABC') cy.get('#not-found-message').contains("This page does not exist !"); }) })