CodeceptJS become slow after an angular update

Discussão em 'Angular' iniciado por Nicolas Ferreira, Dezembro 16, 2024.

  1. On my project we have some End to End tests and we use CodeceptJS with Playwright (https://codecept.io/helpers/Playwright/). These tests are launched by the developers on their laptop and by our CI/CD Jenkins pipeline.

    On angular 12 the Scenarios are "fast" on the dev laptop and on our Jenkins server, the average time to complete a scenario is 7-8s.

    Actually I'm trying to update angular from 12 to 16 (a necessary library of our project can use only angular 16 for the moment) but the tests become very slow on our Jenkins server, whereas on the laptop it's still fast.

    On Jenkins with angular 16 the average time is 13-14s, whereas on the devs laptop it take 7-8s.

    To resume :

    Angular 12

    • Jenkins -> 7-8s
    • Devs laptop -> 7-8s

    Angular 16

    • Jenkins 13-14s
    • Devs laptop -> 7-8s

    I don't understand why.. Do you have any idea ?

    It's a big problem for us, the tests failed because it's too slow and the time to deploy a new version become too long.

    The version of the CodeceptJS npm library is 3.6.1

    The devs laptops use windows 11 The jenkins server use Ubuntu 20.04

    The CodeceptJS config used to execute the tests on the devs laptops

    require('ts-node/register');
    const { locator } = require('codeceptjs');

    const { setHeadlessWhen } = require('@codeceptjs/configure');

    // turn on headless mode when running with HEADLESS=true environment variable
    // export HEADLESS=true && npx codeceptjs run
    setHeadlessWhen(process.env.HEADLESS);

    exports.config = {
    tests: './tests/scenarios/**/*_test.ts',
    output: './output',
    // The retry option will impact the stacktrace size,
    // to debug your test you can comment all this object configuration.
    retry: {
    Scenario: 2
    },
    helpers: {
    'Playwright': {
    url: '',
    show: true,
    browser: 'chromium',
    desiredCapabilities: {
    chromeOptions: {
    args: ['--auto-open-devtools-for-tabs'],
    },
    },
    restart: 'session'
    },
    'MockDataHelper': {
    require: './tests/helpers/mockDataHelper.ts',
    },
    'ChaiWrapper': {
    'require': 'codeceptjs-chai'
    },
    'FormsHelper': {
    require: './tests/helpers/forms_helper.ts',
    },
    'TextGrabber': {
    require: './tests/helpers/textgrabber_helper.ts',
    },
    ....
    },
    include: {
    ...
    },
    bootstrap: () => {
    locator.addFilter((providedLocator, locatorObj) => {
    if (typeof providedLocator === 'string') {
    if (providedLocator.indexOf('&') !== -1) {
    locatorObj.value = providedLocator.replace(/&(\w+)/gm, '*[local-name()=\'$1\']');
    locatorObj.type = 'xpath';
    }
    }
    });
    },
    mocha: {},
    name: '',
    plugins: {
    'retryFailedStep': {
    enabled: true,
    },
    'tryTo': {
    enabled: true,
    },
    'screenshotOnFail': {
    enabled: true,
    },
    'allure': {
    enabled: true
    },
    'pauseOnFail': {
    enabled: false
    }
    },
    };



    The CodeceptJS config used to execute the tests on the Jenkins server

    require('ts-node/register');
    const { locator } = require('codeceptjs');

    const { setHeadlessWhen } = require('@codeceptjs/configure');

    // turn on headless mode when running with HEADLESS=true environment variable
    // export HEADLESS=true && npx codeceptjs run
    setHeadlessWhen(process.env.HEADLESS);

    exports.config = {
    tests: './tests/scenarios/**/*_test.ts',
    output: 'xxx',
    // retry: {
    // Scenario: 3
    // },
    helpers: {
    'Playwright': {
    url: 'xxx',
    show: false,
    browser: 'chromium',
    desiredCapabilities: {
    chromeOptions: {
    args: [
    '--headless',
    '--disable-gpu',
    '--no-sandbox',
    '--disk-cache-size=1',
    '--max_old_space_size=8192',
    '--disable-gl-drawing-for-tests'
    ],
    },
    // close all unexpected popups
    unexpectedAlertBehaviour: 'dismiss',
    },
    restart: 'session'
    },
    'MockDataHelper': {
    require: './tests/helpers/mockDataHelper.ts',
    },
    'ChaiWrapper': {
    'require': 'codeceptjs-chai'
    },
    ....
    },
    include: {
    xxx
    },
    bootstrap: () => {
    locator.addFilter((providedLocator, locatorObj) => {
    if (typeof providedLocator === 'string') {
    if (providedLocator.indexOf('&') !== -1) {
    locatorObj.value = providedLocator.replace(/&(\w+)/gm, '*[local-name()=\'$1\']');
    locatorObj.type = 'xpath';
    }
    }
    });
    },
    mocha: {},
    name: 'xxx',
    plugins: {
    'pauseOnFail': {},
    'retryFailedStep': {
    enabled: true,
    },
    'tryTo': {
    enabled: true,
    },
    'screenshotOnFail': {
    enabled: true,
    },
    'allure': {
    'enabled': true,
    'outputDir': 'allure-tests'
    }
    },
    };



    We tried to add more RAM to the jenkins server but it's just reduce the time Scenario completion time by 1s. Now the RAM is 20g

    Continue reading...

Compartilhe esta Página