Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for the chunk and app js required to run the tests #1888

Open
wants to merge 15 commits into
base: release-2024-fall
Choose a base branch
from
39 changes: 37 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = defineConfig({
devServer: {
framework: 'vue-cli',
bundler: 'webpack',
disableHostCheck: true,
},
},
});
9 changes: 9 additions & 0 deletions tests/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ module.exports = {
},
},
devtool: 'source-map',
devServer: {
disableHostCheck: true,
allowedHosts: 'all',
},
};
Loading