From 7e5aedeb0a1ffa727005c98d80044429bf20ff45 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Tue, 28 May 2024 17:46:32 -0700
Subject: Move takeScreenshot() function into a test helper file
---
test/integration/select.test.js | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
(limited to 'test/integration/select.test.js')
diff --git a/test/integration/select.test.js b/test/integration/select.test.js
index 69eea00..2594179 100644
--- a/test/integration/select.test.js
+++ b/test/integration/select.test.js
@@ -2,8 +2,7 @@ const { Builder, By, until } = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome.js'),
chromeOptions = new chrome.Options(),
{ expect, it } = require('@jest/globals'),
- { mkdir, writeFile, readFile } = require('node:fs/promises'),
- path = require('path'),
+ { readFile } = require('node:fs/promises'),
{ HttpResponse } = require('selenium-webdriver/devtools/networkinterceptor');
chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox');
@@ -182,11 +181,3 @@ it('selects a trooper by clicking on its record and deselects it by clicking on
afterEach(async () => {
await driver.quit();
});
-
-async function takeScreenshot(driver) {
- const dir = './test/screenshots';
- const fileName = path.relative(process.cwd(), __filename) + ' "' + expect.getState().currentTestName + `" ${new Date().toISOString()}.png`;
- const image = await driver.takeScreenshot();
- await mkdir(dir, { recursive: true });
- await writeFile(`${dir}/${fileName.replaceAll('/', '-')}`, image, 'base64');
-}
--
cgit v1.2.3