summaryrefslogtreecommitdiff
path: root/test/playwright/playwright-util.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-09 22:45:16 +0900
committerDarius Jahandarie <djahandarie@gmail.com>2023-11-09 22:45:16 +0900
commitc25e4c959e226174ff286ab7523eabcc55496bbb (patch)
tree6d665cd55128760943216784c2b9144f5a0a2b48 /test/playwright/playwright-util.js
parentb7d3cef68bc509d0dc907b380f2d1d665aa19149 (diff)
Change playwright scripts to use ESM
Diffstat (limited to 'test/playwright/playwright-util.js')
-rw-r--r--test/playwright/playwright-util.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/playwright/playwright-util.js b/test/playwright/playwright-util.js
index e28f16eb..5ceb92fd 100644
--- a/test/playwright/playwright-util.js
+++ b/test/playwright/playwright-util.js
@@ -15,10 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-const path = require('path');
-const {test: base, chromium} = require('@playwright/test');
+import {test as base, chromium} from '@playwright/test';
+import path from 'path';
+import {fileURLToPath} from 'url';
-export const root = path.join(__dirname, '..', '..');
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+export const root = path.join(dirname, '..', '..');
export const test = base.extend({
context: async ({ }, use) => {
@@ -106,4 +108,4 @@ const ankiRouteResponses = {
'canAddNotes': Object.assign({body: JSON.stringify([true, true])}, baseAnkiResp),
'storeMediaFile': Object.assign({body: JSON.stringify('mock_audio.mp3')}, baseAnkiResp),
'addNote': Object.assign({body: JSON.stringify(102312488912)}, baseAnkiResp)
-}; \ No newline at end of file
+};