feat: refs #6695 implement parallel Cypress testing and enhance timeout configurations
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
cd410fa7cf
commit
010313ada9
|
@ -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
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
cypressParallel() {
|
||||
TEST_PATHS=(
|
||||
'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'
|
||||
wait
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
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 \
|
||||
-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
|
||||
|
||||
# cypress run --headless --browser chromium --spec \"test/cypress/integration\"
|
Loading…
Reference in New Issue