ci: refs #6695 feat jenkins parallel e2e #1473

Merged
alexm merged 60 commits from 6695-jenkins_e2e_parallel into dev 2025-03-06 08:35:45 +00:00
5 changed files with 71 additions and 16 deletions
Showing only changes of commit 010313ada9 - Show all commits

10
Jenkinsfile vendored
View File

@ -116,11 +116,11 @@ pipeline {
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true'
// sh '''
// find test/cypress/integration -name "*.spec.js" | xargs -n 1 -P 2 -I {} sh -c "xvfb-run -a cypress run --headless --browser chromium --spec '{}'"
// wait
// '''
// sh 'cypress run --browser chromium || true'
sh '''
source test/cypress/cypressParallel.sh
cypressParallel 2 || true
'''
alexm marked this conversation as resolved Outdated
Outdated
Review

Perque no fas que directament cypressParallel.sh pase els test en un comando que crida al script

Perque no fas que directament cypressParallel.sh pase els test en un comando que crida al script
}
}
}

View File

@ -1,6 +1,6 @@
import { defineConfig } from 'cypress';
let urlHost, reporter, reporterOptions, defaultCommandTimeout;
let urlHost, reporter, reporterOptions, timeouts;
if (process.env.CI) {
urlHost = 'front';
@ -17,7 +17,12 @@ if (process.env.CI) {
json: false,
},
};
defaultCommandTimeout = 30000;
timeouts = {
defaultCommandTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
};
} else {
urlHost = 'localhost';
reporter = 'cypress-mochawesome-reporter';
@ -29,18 +34,19 @@ if (process.env.CI) {
reportDir: 'test/cypress/reports',
inlineAssets: true,
};
defaultCommandTimeout = 10000;
timeouts = {
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
};
}
export default defineConfig({
e2e: {
baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false,
defaultCommandTimeout,
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
@ -60,7 +66,12 @@ export default defineConfig({
},
viewportWidth: 1280,
viewportHeight: 720,
...timeouts,
// setupNodeEvents(on, config) {
// process.env.NODE_OPTIONS = '--loader ts-node/esm';
// return config;
// },
includeShadowDom: true,
waitForAnimations: true,
},
defaultCommandTimeout,
numTestsKeptInMemory: 0,
});

View File

@ -0,0 +1,10 @@
cypressParallel() {
TEST_PATHS=(
Outdated
Review

Dixe el codi per si algu vol tirar x en concret?

Dixe el codi per si algu vol tirar x en concret?
Outdated
Review

No, que execute directament cypress

No, que execute directament cypress
'test/cypress/integration/claim/claimAction.spec.js'
'test/cypress/integration/claim/claimDevelopment.spec.js'
)
# find 'test/cypress/integration' -name "*.spec.js"
printf "%s\n" "${TEST_PATHS[@]}" | xargs -P $1 -I {} sh -c 'xvfb-run -a cypress run --headless --browser chromium --spec {}'
# cypress run --headless --browser chromium --spec 'test/cypress/integration/shelving/parking/parkingBasicData.spec.js'
Outdated
Review

Crec que sh -c no fa falta, pots executar directament el comando xvfb?

Crec que `sh -c` no fa falta, pots executar directament el comando `xvfb`?
wait
}

View File

@ -6,13 +6,16 @@ describe('ParkingBasicData', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
'not.be.visible',
);
});
it('should give an error if the code aldready exists', () => {
cy.get(codeInput).eq(0).should('have.value', '700-01').clear();
cy.get(codeInput).eq(0).type('700-02');
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'The code already exists');
cy.checkNotification('The code already exists');
});
it('should edit the code and sector', () => {
@ -24,7 +27,8 @@ describe('ParkingBasicData', () => {
cy.dataCy('Picking order_input').clear().type(80230);
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
cy.get(sectorSelect).should('have.value', 'First sector');
cy.get(codeInput).should('have.value', '700-01');
cy.dataCy('Picking order_input').should('have.value', 80230);

30
test/cypress/run.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
Review

Este es soles per a local

Este es soles per a local
CYPRESS_SPEC_FOLDER="test/cypress/integration"
cleanup() {
docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml down || true
}
trap cleanup SIGINT
#CLEAN
rm -rf test/cypress/screenshots
rm -rf test/cypress/results
rm -rf junit
#RUN
CI=true TZ=Europe/Madrid docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml up -d
sleep 20 # FIXME:
docker run -it --rm \
Outdated
Review

Si les imatges no es pot accedir sense login... No podran gastarho

Si les imatges no es pot accedir sense login... No podran gastarho
-v "$(pwd)":/app \
-e CI=true \
-e TZ=Europe/Madrid \
--network e2e_default \
lilium-dev \
bash -c '
source test/cypress/cypressParallel.sh
cypressParallel 4
'
cleanup
Outdated
Review

Hasta 4 he vist q se pot pero ja mes fa q se penje el pc

Hasta 4 he vist q se pot pero ja mes fa q se penje el pc
# cypress run --headless --browser chromium --spec \"test/cypress/integration\"