diff --git a/.dockerignore b/.dockerignore index be4e444657..36f4a823a8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,10 +6,7 @@ /.vscode /Dockerfile /coverage -/cypress /docs -/framework -/frontend /locales /node_modules /playbooks @@ -17,4 +14,3 @@ /rulebooks /scripts /stories -/webpack \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6dc882ab51..eb61eb2fe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /certs/cert.key # directories and files that are written to by processes in the image must be owned by the root group # and be read/writable by that group. Files to be executed must also have group execute permissions. # -FROM --platform=${TARGETPLATFORM:-linux/amd64} nginx:alpine AS base +FROM nginx:alpine AS base COPY --from=certificate /certs/cert.pem /certs/cert.pem COPY --from=certificate /certs/cert.pem /certs/CA.pem COPY --from=certificate /certs/cert.key /certs/cert.key @@ -42,4 +42,10 @@ ENV SSL_CLIENT_CERTIFICATE=/certs/CA.pem ENV EDA_WEBHOOK_SERVER=${EDA_WEBHOOK_SERVER:-http://example.com} ENV EDA_SERVER_UUID=${EDA_SERVER_UUID:-sample_uuid} COPY /nginx/eda.conf /etc/nginx/templates/default.conf.template -COPY /build/eda /usr/share/nginx/html \ No newline at end of file +COPY /build/eda /usr/share/nginx/html + +# ui-e2e +FROM cypress/base AS ui-e2e +WORKDIR /app +COPY . . +RUN npm ci diff --git a/cypress.base.config.ts b/cypress.base.config.ts index ebac48f159..aee7453647 100644 --- a/cypress.base.config.ts +++ b/cypress.base.config.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import pkg from 'webpack'; import env from './webpack/environment.cjs'; const { DefinePlugin } = pkg; @@ -13,6 +14,15 @@ export const baseConfig: Cypress.ConfigOptions = { e2e: { testIsolation: false, setupNodeEvents(on, config) { + on('before:browser:launch', (browser, launchOptions) => { + if (browser?.isHeadless) { + launchOptions.args.push('--no-sandbox'); + launchOptions.args.push('--disable-gl-drawing-for-tests'); + launchOptions.args.push('--disable-gpu'); + } + launchOptions.args.push('--js-flags=--max-old-space-size=3500'); + return launchOptions; + }); return config; }, retries: { runMode: 2, openMode: 0 }, diff --git a/cypress/support/auth.ts b/cypress/support/auth.ts index 04d28ff165..590ab9f89c 100644 --- a/cypress/support/auth.ts +++ b/cypress/support/auth.ts @@ -16,6 +16,7 @@ Cypress.Commands.add('requiredVariablesAreSet', (requiredVariables: string[]) => Cypress.Commands.add('login', () => { const devBaseUrlPort = Cypress.config().baseUrl?.split(':').slice(-1).toString(); + switch (devBaseUrlPort) { case '4101': cy.awxLogin(); @@ -28,6 +29,20 @@ Cypress.Commands.add('login', () => { case '4103': cy.edaLogin(); break; + default: + switch (Cypress.env('PRODUCT')) { + case 'AWX': + cy.awxLogin(); + cy.createGlobalOrganization(); + cy.createGlobalProject(); + break; + case 'HUB': + cy.hubLogin(); + break; + case 'EDA': + cy.edaLogin(); + break; + } } }); @@ -43,6 +58,18 @@ Cypress.Commands.add('logout', () => { case '4103': cy.edaLogout(); break; + default: + switch (Cypress.env('PRODUCT')) { + case 'AWX': + cy.awxLogout(); + break; + case 'HUB': + cy.hubLogout(); + break; + case 'EDA': + cy.edaLogout(); + break; + } } });