forked from jsnbuchanan/crowd-funder-for-time-pwa
fix(tests): Improve gift recording test reliability
- Add better error handling and logging for gift recording flow - Add explicit navigation to contacts page before finding gift button - Add info icon click handling when needed - Add more comprehensive button detection with multiple selectors - Add debug logging for page state and navigation - Add screenshot capture on failures - Add retry logic with proper state verification - Fix linter errors in playwright config The changes help diagnose and handle various UI states that can occur during gift recording, making the tests more reliable especially on Linux.
This commit is contained in:
@@ -124,3 +124,37 @@ export async function createRandomNumbersArray(count: number): Promise<number[]>
|
||||
|
||||
return numbersArray;
|
||||
}
|
||||
|
||||
export function isLinuxEnvironment() {
|
||||
return process.platform === 'linux';
|
||||
}
|
||||
|
||||
export function getOSSpecificTimeout(): number {
|
||||
// Increase base timeout for Linux
|
||||
const isLinux = process.platform === 'linux';
|
||||
return isLinux ? 180000 : 60000; // 3 minutes for Linux, 1 minute for others
|
||||
}
|
||||
|
||||
export function getOSSpecificConfig() {
|
||||
if (isLinuxEnvironment()) {
|
||||
return {
|
||||
retries: 2,
|
||||
timeout: 90000, // Increased global timeout
|
||||
expect: {
|
||||
timeout: 30000 // Increased expect timeout
|
||||
},
|
||||
// Add video recording for failed tests on Linux
|
||||
use: {
|
||||
video: 'retain-on-failure',
|
||||
trace: 'retain-on-failure'
|
||||
}
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
// Add helper for test grouping
|
||||
export function isResourceIntensiveTest(testPath: string): boolean {
|
||||
return testPath.includes('35-record-gift-from-image-share') ||
|
||||
testPath.includes('40-add-contact');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user