From 9f15b4d48c086d3fde8a9e566a07c44c1917ed30 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 22 Oct 2024 17:49:52 -0400 Subject: [PATCH 01/15] Wait for the chunk and app js required to run the tests --- tests/e2e/support/commands.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js index c1bf51dc2..57645556f 100644 --- a/tests/e2e/support/commands.js +++ b/tests/e2e/support/commands.js @@ -32,7 +32,11 @@ 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 }); waitToRenderAllShapes(); }); From 62bbb75c33fd99001df96e081babb5e856bcaafc Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 22 Oct 2024 18:53:57 -0400 Subject: [PATCH 02/15] Debug --- tests/e2e/support/commands.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js index 57645556f..59b6ee460 100644 --- a/tests/e2e/support/commands.js +++ b/tests/e2e/support/commands.js @@ -36,7 +36,9 @@ Cypress.Commands.add('loadModeler', () => { cy.intercept('/js/app.js').as('appJs'); cy.visit(url); cy.wait('@chunkVendorsJs', { timeout: 30000 }); - cy.wait('@appJs', { timeout: 30000 }); + cy.wait('@appJs', { timeout: 30000 }).then((interception) => { + console.log('appJs', interception.response.statusCode); + }); waitToRenderAllShapes(); }); From d1d283d198b2c589c85c9e34ed5d21880564ca5f Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 09:43:43 -0400 Subject: [PATCH 03/15] Wait for app.js to be ready --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5af107f3b..3e97a371c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: with: install: true start: npm run serve - wait-on: http://localhost:8080/ + wait-on: http://localhost:8080/js/app.js config-file: cypress.config.js spec: "tests/e2e/specs/**/*" record: true From 657753727f0333cf8fb9902c392ce2483934296d Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 09:44:12 -0400 Subject: [PATCH 04/15] Additional wait if response is not ready --- tests/e2e/support/commands.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js index 59b6ee460..1a45b0dc1 100644 --- a/tests/e2e/support/commands.js +++ b/tests/e2e/support/commands.js @@ -37,7 +37,10 @@ Cypress.Commands.add('loadModeler', () => { cy.visit(url); cy.wait('@chunkVendorsJs', { timeout: 30000 }); cy.wait('@appJs', { timeout: 30000 }).then((interception) => { - console.log('appJs', interception.response.statusCode); + if (!interception.response) { + // if there is no response, wait 5 additional seconds + return cy.wait(5000); + } }); waitToRenderAllShapes(); }); From 54f2912ef4b8d6a1ba66f5989917f2696159a54d Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 13:15:57 -0400 Subject: [PATCH 05/15] Publish temporal access to modeler --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e97a371c..56ccc6540 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,20 @@ jobs: node-version: 20 check-latest: true cache: 'npm' + - name: Install ngrok 🛠 + run: | + curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \ + echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && \ + sudo apt update && sudo apt install ngrok + + - name: Start ngrok for localhost:8080 🌍 + run: | + ngrok http 8080 & + + - name: Display ngrok public URL + run: | + sleep 5 # Esperar unos segundos para que se inicie ngrok + curl -s http://localhost:4040/api/tunnels | jq '.tunnels[0].public_url' - name: Cypress run uses: cypress-io/github-action@v6 with: From 1aaeae4f4c4c1e1c370669429074208946f13f4d Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 13:24:56 -0400 Subject: [PATCH 06/15] Add authenticate ngrok --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56ccc6540..c2e046017 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,13 +49,16 @@ jobs: echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && \ sudo apt update && sudo apt install ngrok + - name: Authenticate ngrok 🔑 + run: ngrok config add-authtoken ${{ secrets.NGROK_AUTH_TOKEN }} + - name: Start ngrok for localhost:8080 🌍 run: | ngrok http 8080 & - name: Display ngrok public URL run: | - sleep 5 # Esperar unos segundos para que se inicie ngrok + sleep 5 curl -s http://localhost:4040/api/tunnels | jq '.tunnels[0].public_url' - name: Cypress run uses: cypress-io/github-action@v6 From 001b4cd60da0656ae226cb2f5d0536742fff4d7b Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 14:21:52 -0400 Subject: [PATCH 07/15] Use localtunnel --- .github/workflows/ci.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2e046017..f3fbc1708 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,23 +43,16 @@ jobs: node-version: 20 check-latest: true cache: 'npm' - - name: Install ngrok 🛠 - run: | - curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \ - echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && \ - sudo apt update && sudo apt install ngrok - - - name: Authenticate ngrok 🔑 - run: ngrok config add-authtoken ${{ secrets.NGROK_AUTH_TOKEN }} - - name: Start ngrok for localhost:8080 🌍 - run: | - ngrok http 8080 & - - - name: Display ngrok public URL + - name: Install LocalTunnel + run: npm install -g localtunnel + - name: Start LocalTunnel for localhost:8080 🌍 + run: lt --port 8080 > localtunnel_url.txt & + - name: Display LocalTunnel public URL run: | sleep 5 - curl -s http://localhost:4040/api/tunnels | jq '.tunnels[0].public_url' + cat localtunnel_url.txt + - name: Cypress run uses: cypress-io/github-action@v6 with: From 04db0437f4ef76353124b0896b713200b72d0690 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 14:31:27 -0400 Subject: [PATCH 08/15] Add password --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3fbc1708..5efe7b68d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: run: | sleep 5 cat localtunnel_url.txt + curl https://loca.lt/mytunnelpassword - name: Cypress run uses: cypress-io/github-action@v6 From 886633795935d0b0437715c9fa95843fddb28395 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:08:48 -0400 Subject: [PATCH 09/15] Use frpc --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5efe7b68d..f5d53b0ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,15 +44,39 @@ jobs: check-latest: true cache: 'npm' - - name: Install LocalTunnel - run: npm install -g localtunnel - - name: Start LocalTunnel for localhost:8080 🌍 - run: lt --port 8080 > localtunnel_url.txt & - - name: Display LocalTunnel public URL + - name: Generate unique subdomain + id: subdomain run: | - sleep 5 - cat localtunnel_url.txt - curl https://loca.lt/mytunnelpassword + # 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 "[web]" >> 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 From 07f89c8feaef1a7f433c96b2d969718c80614d9c Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:20:33 -0400 Subject: [PATCH 10/15] Disable host check to debug --- cypress.config.js | 1 + 1 file changed, 1 insertion(+) 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, }, }, }); From 20b0174a907c43330c24e73bd6964b63c127e6e2 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:26:13 -0400 Subject: [PATCH 11/15] Use localtunnel --- .github/workflows/ci.yml | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5d53b0ce..5efe7b68d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,39 +44,15 @@ jobs: check-latest: true cache: 'npm' - - name: Generate unique subdomain - id: subdomain + - name: Install LocalTunnel + run: npm install -g localtunnel + - name: Start LocalTunnel for localhost:8080 🌍 + run: lt --port 8080 > localtunnel_url.txt & + - name: Display LocalTunnel public URL 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 "[web]" >> 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" + sleep 5 + cat localtunnel_url.txt + curl https://loca.lt/mytunnelpassword - name: Cypress run uses: cypress-io/github-action@v6 From 859f03dc23ba72c9657ebeb0a07a05c766595f35 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:38:45 -0400 Subject: [PATCH 12/15] Use frpc --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5efe7b68d..8d872f932 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,21 +44,45 @@ jobs: check-latest: true cache: 'npm' - - name: Install LocalTunnel - run: npm install -g localtunnel - - name: Start LocalTunnel for localhost:8080 🌍 - run: lt --port 8080 > localtunnel_url.txt & - - name: Display LocalTunnel public URL + - name: Generate unique subdomain + id: subdomain run: | - sleep 5 - cat localtunnel_url.txt - curl https://loca.lt/mytunnelpassword + # 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 + start: npm run serve -- --disable-host-check wait-on: http://localhost:8080/js/app.js config-file: cypress.config.js spec: "tests/e2e/specs/**/*" From 6356269e29cb0eea78e64010348148bf579c8aa5 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:49:53 -0400 Subject: [PATCH 13/15] Fix missig clossing tag --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d872f932..077bc7f7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: echo "server_port = 9000" >> frpc.ini echo "token = ${{ secrets.NGROK_AUTH_TOKEN }}" >> frpc.ini - echo "[${{ steps.subdomain.outputs.subdomain }]" >> 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 From 9f1995059180ff5528bedf28b8765f2cc9e7db79 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 20:54:08 -0400 Subject: [PATCH 14/15] Disable check --- webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index a57d43962..f369762af 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -34,4 +34,7 @@ module.exports = { }, }, devtool: 'source-map', + devServer: { + disableHostCheck: true, + }, }; From 1e8d557f207bbde28a2cbff0eb256fdfecc97bf6 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 23 Oct 2024 21:32:55 -0400 Subject: [PATCH 15/15] Add public url --- .github/workflows/ci.yml | 2 +- webpack.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 077bc7f7e..14acbe074 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: uses: cypress-io/github-action@v6 with: install: true - start: npm run serve -- --disable-host-check + 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/**/*" diff --git a/webpack.config.js b/webpack.config.js index f369762af..4c1938490 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,5 +36,6 @@ module.exports = { devtool: 'source-map', devServer: { disableHostCheck: true, + allowedHosts: 'all', }, };