diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5af107f3b..14acbe074 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,12 +43,47 @@ jobs: node-version: 20 check-latest: true cache: 'npm' + + - name: Generate unique subdomain + id: subdomain + run: | + # Generate a unique subdomain based on the date and a random identifier + SUBDOMAIN="modeler-$(date +%s)-$RANDOM" + echo "Subdomain: $SUBDOMAIN" + echo "::set-output name=subdomain::$SUBDOMAIN" + + - name: Download and configure FRPC + run: | + # Download FRPC from the official repository + wget https://github.com/fatedier/frp/releases/download/v0.61.0/frp_0.61.0_linux_amd64.tar.gz + tar -xvzf frp_0.61.0_linux_amd64.tar.gz + cd frp_0.61.0_linux_amd64 + + # Create the FRPC.Ini file using secrets + echo "[common]" > frpc.ini + echo "server_addr = ${{ secrets.NGROK_SERVER_ADDR }}" >> frpc.ini + echo "server_port = 9000" >> frpc.ini + echo "token = ${{ secrets.NGROK_AUTH_TOKEN }}" >> frpc.ini + + echo "[${{ steps.subdomain.outputs.subdomain }}]" >> frpc.ini + echo "type = http" >> frpc.ini + echo "local_port = 8080" >> frpc.ini + echo "remote_port = 7000" >> frpc.ini + echo "subdomain = ${{ steps.subdomain.outputs.subdomain }}" >> frpc.ini + + # Execute FRPC to expose the service + ./frpc -c ./frpc.ini & + + - name: Print the unique subdomain URL + run: | + echo "Your service is available at: http://${{ steps.subdomain.outputs.subdomain }}.processmaker4.dev" + - name: Cypress run uses: cypress-io/github-action@v6 with: install: true - start: npm run serve - wait-on: http://localhost:8080/ + start: npm run serve -- --public http://${{ steps.subdomain.outputs.subdomain }}.processmaker4.dev + wait-on: http://localhost:8080/js/app.js config-file: cypress.config.js spec: "tests/e2e/specs/**/*" record: true diff --git a/cypress.config.js b/cypress.config.js index b89b52fd9..80ea4b2c0 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -24,6 +24,7 @@ module.exports = defineConfig({ devServer: { framework: 'vue-cli', bundler: 'webpack', + disableHostCheck: true, }, }, }); diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js index c1bf51dc2..1a45b0dc1 100644 --- a/tests/e2e/support/commands.js +++ b/tests/e2e/support/commands.js @@ -32,7 +32,16 @@ Cypress.Commands.add('loadModeler', () => { : '/'; cy.viewport(defaultViewportDimensions.width, defaultViewportDimensions.height); + cy.intercept('/js/chunk-vendors.js').as('chunkVendorsJs'); + cy.intercept('/js/app.js').as('appJs'); cy.visit(url); + cy.wait('@chunkVendorsJs', { timeout: 30000 }); + cy.wait('@appJs', { timeout: 30000 }).then((interception) => { + if (!interception.response) { + // if there is no response, wait 5 additional seconds + return cy.wait(5000); + } + }); waitToRenderAllShapes(); }); diff --git a/webpack.config.js b/webpack.config.js index a57d43962..4c1938490 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -34,4 +34,8 @@ module.exports = { }, }, devtool: 'source-map', + devServer: { + disableHostCheck: true, + allowedHosts: 'all', + }, };