Skip to content

Commit

Permalink
chore: Add aftereach to transaction tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yordan Iliev <[email protected]>
  • Loading branch information
yiliev0 committed Jan 15, 2025
1 parent d39e260 commit c481042
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions automation/tests/transactionTests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ test.describe('Transaction tests', () => {
await resetDbState();
});

test.afterEach(async ({}, testInfo) => {
if (testInfo.status !== 'passed') {
try {
if (!window.isClosed()) {
const screenshotPath = `./test-results/screenshots/${testInfo.title.replace(/\s+/g, '_')}.png`;
await window.screenshot({ path: screenshotPath });
console.log(`Screenshot saved: ${screenshotPath}`);
} else {
console.log('Window is already closed, skipping screenshot.');
}
} catch (e) {
console.error('Failed to take screenshot:', e);
}
}
});

test.beforeEach(async () => {
// await transactionPage.closeCompletedTransaction();
await transactionPage.clickOnTransactionsMenuButton();
Expand Down

0 comments on commit c481042

Please sign in to comment.