mattermost-mobile-upstream/.github/actions/compute-e2e-build-fingerprint/paths.test.js
yasser khan 587e15ea89
chore(e2e): Cache app builds. Skip E2E on docs only PR. (#9930)
Based on the later commits (after the earlier experimentation and reversions), the meaningful end state of the PR is:

**Summary:** Improve E2E CI reliability, performance, and security by introducing robust build caching with safe fingerprinting and cache isolation, duration-based test sharding with graceful fallbacks, more reliable E2E impact detection and status handling, stronger cancellation/concurrency behavior, multiple iOS Detox stability fixes, and hardening GitHub Actions to avoid executing PR-authored code. Also includes CI fixes for iOS builds and a temporary Android E2E test skip for a known regression.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-08-04 19:13:39 +05:30

55 lines
2.2 KiB
JavaScript

'use strict';
const {loadPaths, fingerprintPathsForPlatform, impactGlobs, fingerprintPathToGlob} = require('./paths');
describe('e2e impact paths', () => {
const paths = loadPaths();
it('should list fingerprint paths for each known platform', () => {
for (const platform of ['ios', 'android-detox', 'android-maestro']) {
const list = fingerprintPathsForPlatform(paths, platform);
expect(list.length).toBeGreaterThan(paths.fingerprintShared.length);
expect(list).toEqual(expect.arrayContaining(paths.fingerprintShared));
}
});
it('should reject unknown platforms', () => {
expect(() => fingerprintPathsForPlatform(paths, 'windows')).toThrow(/Unknown platform/);
});
it('should convert fingerprint dirs to globs so the impact filter covers them', () => {
expect(fingerprintPathToGlob('app/')).toBe('app/**');
expect(fingerprintPathToGlob('package.json')).toBe('package.json');
expect(fingerprintPathToGlob('scripts/')).toBe('scripts/**');
});
it('should include every fingerprint path in the impact globs (no drift)', () => {
const globs = new Set(impactGlobs(paths));
const fingerprintEntries = [
...paths.fingerprintShared,
...Object.values(paths.fingerprintByPlatform).flat(),
];
for (const entry of fingerprintEntries) {
expect(globs.has(fingerprintPathToGlob(entry))).toBe(true);
}
});
it('should keep test-only and sharding infra in triggerExtra (run E2E, not fingerprint)', () => {
expect(paths.triggerExtra).toEqual(expect.arrayContaining([
'detox/e2e/**',
'detox/maestro/**',
'detox/utils/**',
'.github/actions/generate-specs/**',
'.github/actions/s3-spec-durations/**',
]));
for (const extra of paths.triggerExtra) {
expect(paths.fingerprintShared).not.toContain(extra.replace(/\/\*\*$/, '/'));
}
});
it('should fingerprint scripts/ wholesale so postinstall and friends invalidate cache', () => {
expect(paths.fingerprintShared).toContain('scripts/');
expect(impactGlobs(paths)).toContain('scripts/**');
});
});