Skip to content

Commit

Permalink
UI-E2E Image for testing (#2944)
Browse files Browse the repository at this point in the history
Signed-off-by: James Talton <[email protected]>
  • Loading branch information
jamestalton authored Aug 12, 2024
1 parent 338d615 commit d2f3f2d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
/.vscode
/Dockerfile
/coverage
/cypress
/docs
/framework
/frontend
/locales
/node_modules
/playbooks
/publish
/rulebooks
/scripts
/stories
/webpack
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
COPY /build/eda /usr/share/nginx/html

# ui-e2e
FROM cypress/base AS ui-e2e
WORKDIR /app
COPY . .
RUN npm ci
10 changes: 10 additions & 0 deletions cypress.base.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import pkg from 'webpack';
import env from './webpack/environment.cjs';
const { DefinePlugin } = pkg;
Expand All @@ -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 },
Expand Down
27 changes: 27 additions & 0 deletions cypress/support/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}
}
});

Expand All @@ -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;
}
}
});

Expand Down

0 comments on commit d2f3f2d

Please sign in to comment.