aboutsummaryrefslogtreecommitdiff
path: root/test/playwright/playwright-util.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-10 00:05:01 +0000
committerGitHub <noreply@github.com>2023-11-10 00:05:01 +0000
commit6b51d59fce9c56f3b1e069f620c5064f8cb51406 (patch)
tree839f379feabe210433278974a975297cec46a97e /test/playwright/playwright-util.js
parentb7d3cef68bc509d0dc907b380f2d1d665aa19149 (diff)
parent2cd7b14333a727418584d95c71ee6cb10b9a4197 (diff)
Merge pull request #310 from themoeway/playwright-esm
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
+};