()
| 851 | } |
| 852 | |
| 853 | async _finishTest() { |
| 854 | if (this.isRunning) { |
| 855 | try { |
| 856 | await Promise.race([this._stopBrowser(), new Promise((_, reject) => setTimeout(() => reject(new Error('Test finish timeout')), 10000))]) |
| 857 | } catch (e) { |
| 858 | console.warn('Warning during test finish cleanup:', e.message) |
| 859 | // Track cleanup failures to prevent false positives |
| 860 | this.hasCleanupError = true |
| 861 | this.testFailures.push(`Test finish cleanup failed: ${e.message}`) |
| 862 | |
| 863 | this.isRunning = false |
| 864 | // Set flags to prevent further operations after cleanup failure |
| 865 | this.page = null |
| 866 | this.browserContext = null |
| 867 | this.browser = null |
| 868 | |
| 869 | // Propagate the error to fail the test properly |
| 870 | throw new Error(`Test cleanup failed: ${e.message}`) |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | async _cleanup() { |
| 876 | // Final cleanup when test run completes |
nothing calls this directly
no test coverage detected