Opinion on running testCases on simulator

Hi All,

I want your opinion as what is the best way to run iOS testCases back to back?
Suppose I have few feature files in my framework, for running them I have to fast reset my simulator because I don’t think there is any other way to clean the app cache in IOS.

Due to this reason, I think only first feature file is running correctly, rest of the features files in sequence is failing due some weird reasons which seems to be related to performance of simulator after fast reset.

How can I improve performance of the simulator on my Virtual machine on which my automation tests are running? Is there something I am missing in my config file? Please suggest!

Below are my configs:

Ios.config:
import config from ‘./wdio.conf’;
import PlatformInfo from ‘./platform.info’;

// Appium capabilities
config.capabilities = [
    {
        platformName: 'iOS',
        noReset: false,
        fullReset: true,
        maxInstances: 1,
        automationName: 'XCUITest',
        deviceName: PlatformInfo.deviceName(),
        platformVersion: PlatformInfo.platformVersion(),
        app: PlatformInfo.appName(),
        appWaitDuration: 20000,
        newCommandTimeout: 90000,
        webviewConnectTimeout: 20000,
        fullContextList: true,
        autoAcceptAlerts: true,
        chromedriverExecutable: '',
        chromeOptions: {
            'w3c': false,
            'args': [
                '--disable-popup-blocking',
            ],
          },
    },
];

config.cucumberOpts.tagExpression = '@iosApp';// pass tag to run tests specific to ios

exports.config = config;

wdio.config
import ADBHelper from ‘…/src/utils/adbHelper’;
import { Logger } from ‘tslog’;
import allure from ‘allure-commandline’;

const platformName = process.env.PLATFORM_NAME;
const log: Logger = new Logger();
const config = {
    runner: 'local',

    specs: [
        './test/features/*.feature',
    ],
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
        './test/features/introScreens.feature',
    ],

    maxInstances: 10,

    capabilities: [{
        maxInstances: 5,
        platformName: '',
        noReset: false,
        fullReset: false,
        automationName: '',
        deviceName: '',
        platformVersion: '',
        app: '',
        appWaitDuration: 20000,
        newCommandTimeout: 12000,
        webviewConnectTimeout: 10000,
        fullContextList: false,
        autoAcceptAlerts: true,
        chromedriverExecutable: '',
        chromeOptions: {
            'w3c': false,
            'args': [
                '--no-sandbox',
            ],
        },
    }],
 
    logLevel: 'trace',

    bail: 0,
    waitforTimeout: 10000,

    services: [
        'appium',
    ],
    appium: {
        command: 'appium',
        // --chromedriver-executable ./node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v91.0.4472.101',
    },
    port: 4723,
    path: '/wd/hub',

    framework: 'cucumber',
    cucumberOpts: {
        backtrace: false,
        requireModule: [],
        failAmbiguousDefinitions: false,
        failFast: false,
        ignoreUndefinedDefinitions: false,
        name: [],
        profile: [],
        require: [
            './src/stepDefinitions/*.ts',
        ],
        tagExpression: '@androidApp',
        snippetSyntax: undefined,
        snippets: true,
        source: true,
        strict: false,
        tagsInTitle: false,
        timeout: 90000,
        retry: 0,
    },

    reporters: [
        'spec',
        [
            'allure',
            {
                outputDir: 'allure-results',
                disableWebdriverStepsReporting: true,
                disableWebdriverScreenshotsReporting: false,
                useCucumberStepReporter: true,
                issueLinkTemplate: 'https://gelato.atlassian.net/browse/{}',
                tmsLinkTemplate: 'https://docs.google.com/spreadsheets/d/{}',
            },
        ],
    ],
 
    afterStep(uri, feature, scenario) {
        if (scenario.error) {
            driver.takeScreenshot();
        }
    },
    
    after() {
        if (platformName === 'android') {
            ADBHelper.executeADBShellCommand('pm clear com.gelato.api.stage'.split(' '));
            ADBHelper.executeADBShellCommand('pm clear com.android.chrome'.split(' '));
        }
    }
 
    onComplete() {
        const TIMEOUT = 5000;
        const reportError = new Error('Could not generate Allure report');
        const generation = allure(['generate', 'allure-results', '--clean']);
        return new Promise<void>((resolve, reject) => {
            const generationTimeout = setTimeout(
                () => reject(reportError),
                TIMEOUT);

            generation.on('exit', (exitCode: number) => {
                clearTimeout(generationTimeout);

                if (exitCode !== 0) {
                    return reject(reportError);
                }

                log.info('Allure report successfully generated');
                return resolve();
            });
        });
    },
};

export default config;