From 9aed749e680cfd7a65dd6ec9cc7e66ef5977ae17 Mon Sep 17 00:00:00 2001 From: JaimeLoredo Date: Sat, 27 Apr 2024 21:23:30 +0200 Subject: [PATCH 01/10] e2e v1: not working yet --- webapp/e2e/singlePlayer.js | 346 ++++++++++++++++++ webapp/package-lock.json | 701 ++++++++++++++++++++++++++++--------- webapp/package.json | 2 +- 3 files changed, 892 insertions(+), 157 deletions(-) create mode 100644 webapp/e2e/singlePlayer.js diff --git a/webapp/e2e/singlePlayer.js b/webapp/e2e/singlePlayer.js new file mode 100644 index 00000000..6a332091 --- /dev/null +++ b/webapp/e2e/singlePlayer.js @@ -0,0 +1,346 @@ + +const puppeteer = require('puppeteer'); // Add this line to import puppeteer + +(async () => { + const browser = await puppeteer.launch(); + const page = await browser.newPage(); + const timeout = 5000; + page.setDefaultTimeout(timeout); + + { + const targetPage = page; + await targetPage.setViewport({ + width: 215, + height: 702 + }) + } + { + const targetPage = page; + const promises = []; + const startWaitingForEvents = () => { + promises.push(targetPage.waitForNavigation()); + } + startWaitingForEvents(); + await targetPage.goto('http://localhost:3000/'); + await Promise.all(promises); + } + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"login\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 107.90000009536743, + y: 19.399993896484375, + }, + }); + } + await new Promise(resolve => setTimeout(resolve, 1000)); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@id=\\":r1:\\"])') + ]) + .setTimeout(timeout) + .fill('PabloS'); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@id=\\":r3:\\"])') + ]) + .setTimeout(timeout) + .fill('PabloPassword'); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"init\\"]/div/main/div/div[3]/button[1])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 83, + y: 9.89996337890625, + }, + }); + } + await page.waitFor(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/button[1]/a)') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 95.71249771118164, + y: 15.600006103515625, + }, + }); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"add-bot-button\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 48.20000076293945, + y: 23.48748779296875, + }, + }); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"add-bot-button\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 62.20000076293945, + y: 27.6875, + }, + }); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"start-game-button\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 26.412498474121094, + y: 49.88751220703125, + }, + }); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Zaragoza City\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 74.94900703430176, + y: 30.647064208984375, + }, + }); + } + await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Santa Cruz de Tenerife\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 75.07829856872559, + y: 30.558135986328125, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-City of Valencia\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 75.08199691772461, + y: 30.557891845703125, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Kampala\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 74.91261291503906, + y: 30.493377685546875, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-San Salvador\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 74.6823673248291, + y: 30.49365234375, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-804237\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 74.88681030273438, + y: 30.449310302734375, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-461346\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 74.88809204101562, + y: 30.450042724609375, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-B\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 53.96490669250488, + y: 28.493682861328125, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Ag\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 54.44675827026367, + y: 28.767486572265625, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-United States of America\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 53.76158142089844, + y: 28.448974609375, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-United Kingdom\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 53.84560585021973, + y: 28.494049072265625, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[2])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 56, + y: 51.25, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer--45\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 45.233205795288086, + y: 29.246139526367188, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer--86\\"])') + ]) + .setTimeout(timeout) + .click({ + offset: { + x: 45.07732582092285, + y: 29.157562255859375, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(/html)') + ]) + .setTimeout(timeout) + .click({ + delay: 413.79999999981374, + offset: { + x: 63, + y: 268, + }, + }); + }await page.waitForTimeout(1000); + { + const targetPage = page; + await puppeteer.Locator.race([ + targetPage.locator('::-p-xpath(/html)') + ]) + .setTimeout(timeout) + .click({ + delay: 428.70000000018626, + offset: { + x: 425, + y: 462, + }, + }); + } + + await browser.close(); + +})().catch(err => { + console.error(err); + process.exit(1); +}); diff --git a/webapp/package-lock.json b/webapp/package-lock.json index c96c7b59..12889c3f 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -19,6 +19,7 @@ "gapi-script": "^1.2.0", "i18next": "^23.10.0", "jwt-decode": "^4.0.0", + "puppeteer": "^22.7.1", "react": "^18.2.0", "react-admin": "^4.16.16", "react-dom": "^18.2.0", @@ -39,7 +40,6 @@ "jest-cucumber": "^3.0.1", "jest-environment-node": "^29.7.0", "mongodb-memory-server": "^9.1.4", - "puppeteer": "^2.1.1", "react-i18next": "^11.6.0", "sass": "^1.71.1", "serve": "^14.2.1", @@ -4412,6 +4412,73 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", "dev": true }, + "node_modules/@puppeteer/browsers": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.2.3.tgz", + "integrity": "sha512-bJ0UBsk0ESOs6RFcLXOt99a3yTDcOKlzfjad+rhFwdaG1Lu/Wzq58GHYCDTlZ9z6mldf4g+NTb+TXEfe0PpnsQ==", + "dependencies": { + "debug": "4.3.4", + "extract-zip": "2.0.1", + "progress": "2.0.3", + "proxy-agent": "6.4.0", + "semver": "7.6.0", + "tar-fs": "3.0.5", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@puppeteer/browsers/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@puppeteer/browsers/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@puppeteer/browsers/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, "node_modules/@react-oauth/google": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/@react-oauth/google/-/google-0.12.1.tgz", @@ -5048,6 +5115,11 @@ "node": ">= 6" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -5293,12 +5365,6 @@ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" }, - "node_modules/@types/mime-types": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz", - "integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==", - "dev": true - }, "node_modules/@types/minimatch": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", @@ -5515,6 +5581,15 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", @@ -6412,6 +6487,17 @@ "node": ">=0.10.0" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/ast-types-flow": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", @@ -6422,12 +6508,6 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" }, - "node_modules/async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "dev": true - }, "node_modules/async-mutex": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz", @@ -6570,8 +6650,7 @@ "node_modules/b4a": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", - "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==", - "dev": true + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" }, "node_modules/babel-jest": { "version": "27.5.1", @@ -6858,6 +6937,47 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/bare-events": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.2.2.tgz", + "integrity": "sha512-h7z00dWdG0PYOQEvChhOSWvOfkIKsdZGkWr083FgN/HyoQuebSew/cgirYqh9SCuy/hRvxc5Vy6Fw8xAmYHLkQ==", + "optional": true + }, + "node_modules/bare-fs": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.3.0.tgz", + "integrity": "sha512-TNFqa1B4N99pds2a5NYHR15o0ZpdNKbAeKTE/+G6ED/UeOavv8RY3dr/Fu99HW3zU3pXpo2kDNO8Sjsm2esfOw==", + "optional": true, + "dependencies": { + "bare-events": "^2.0.0", + "bare-path": "^2.0.0", + "bare-stream": "^1.0.0" + } + }, + "node_modules/bare-os": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.3.0.tgz", + "integrity": "sha512-oPb8oMM1xZbhRQBngTgpcQ5gXw6kjOaRsSWsIeNyRxGed2w/ARyP7ScBYpWR1qfX2E5rS3gBw6OWcSQo+s+kUg==", + "optional": true + }, + "node_modules/bare-path": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.2.tgz", + "integrity": "sha512-o7KSt4prEphWUHa3QUwCxUI00R86VdjiuxmJK0iNVDHYPGo+HsDaVCnqCmPbf/MiW1ok8F4p3m8RTHlWk8K2ig==", + "optional": true, + "dependencies": { + "bare-os": "^2.1.0" + } + }, + "node_modules/bare-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-1.0.0.tgz", + "integrity": "sha512-KhNUoDL40iP4gFaLSsoGE479t0jHijfYdIcxRn/XtezA2BaUD0NRf/JGRpsMq6dMNM+SrCrB0YSSo/5wBY4rOQ==", + "optional": true, + "dependencies": { + "streamx": "^2.16.1" + } + }, "node_modules/base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", @@ -6907,6 +7027,14 @@ } ] }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -7260,7 +7388,6 @@ "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "dev": true, "engines": { "node": "*" } @@ -7564,6 +7691,19 @@ "node": ">=6.0" } }, + "node_modules/chromium-bidi": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.5.19.tgz", + "integrity": "sha512-UA6zL77b7RYCjJkZBsZ0wlvCTD+jTjllZ8f6wdO4buevXgTZYjV+XLB9CiEa2OuuTGGTLnI7eN9I60YxuALGQg==", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.22.4" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -7889,21 +8029,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, - "node_modules/concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "engines": [ - "node >= 0.8" - ], - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, "node_modules/confusing-browser-globals": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", @@ -8448,6 +8573,14 @@ "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==" }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "engines": { + "node": ">= 14" + } + }, "node_modules/data-urls": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", @@ -8689,6 +8822,19 @@ "node": ">=0.10.0" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -8764,6 +8910,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/devtools-protocol": { + "version": "0.0.1273771", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1273771.tgz", + "integrity": "sha512-QDbb27xcTVReQQW/GHJsdQqGKwYBE7re7gxehj467kKP2DKuYBUj6i2k5LRiAC66J1yZG/9gsxooz/s9pcm0Og==" + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -9005,7 +9156,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "dependencies": { "once": "^1.4.0" } @@ -9070,6 +9220,14 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "engines": { + "node": ">=6" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -10442,35 +10600,38 @@ } }, "node_modules/extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dependencies": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", + "debug": "^4.1.1", + "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, "bin": { "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" } }, - "node_modules/extract-zip/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dependencies": { - "ms": "2.0.0" + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/extract-zip/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -10479,8 +10640,7 @@ "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "dev": true + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" }, "node_modules/fast-glob": { "version": "3.3.2", @@ -10553,7 +10713,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "dev": true, "dependencies": { "pend": "~1.2.0" } @@ -11159,6 +11318,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-uri": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", + "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4", + "fs-extra": "^11.2.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/get-uri/node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -11955,8 +12141,7 @@ "node_modules/ip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", - "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", - "dev": true + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" }, "node_modules/ipaddr.js": { "version": "2.1.0", @@ -17440,18 +17625,6 @@ "resolved": "https://registry.npmjs.org/microseconds/-/microseconds-0.2.0.tgz", "integrity": "sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==" }, - "node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -17587,6 +17760,11 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, "node_modules/mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -17855,6 +18033,14 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/new-find-package-json": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/new-find-package-json/-/new-find-package-json-2.0.0.tgz", @@ -18390,6 +18576,71 @@ "node": ">=6" } }, + "node_modules/pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -18541,8 +18792,7 @@ "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" }, "node_modules/performance-now": { "version": "2.1.0", @@ -19914,7 +20164,6 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -20000,6 +20249,67 @@ "node": ">= 0.10" } }, + "node_modules/proxy-agent": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", + "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.3", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -20029,7 +20339,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -20044,60 +20353,77 @@ } }, "node_modules/puppeteer": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz", - "integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==", - "deprecated": "< 21.5.0 is no longer supported", - "dev": true, + "version": "22.7.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.7.1.tgz", + "integrity": "sha512-JBCBCwQ9+dyPp5haqeecgv0N0vgWFx44woUeKJaPeJT8CU3RXrd8F/tqJQbuAmcWlbMhYJSlTJkIFrwVAs6BNA==", "hasInstallScript": true, "dependencies": { - "@types/mime-types": "^2.1.0", - "debug": "^4.1.0", - "extract-zip": "^1.6.6", - "https-proxy-agent": "^4.0.0", - "mime": "^2.0.3", - "mime-types": "^2.1.25", - "progress": "^2.0.1", - "proxy-from-env": "^1.0.0", - "rimraf": "^2.6.1", - "ws": "^6.1.0" + "@puppeteer/browsers": "2.2.3", + "cosmiconfig": "9.0.0", + "devtools-protocol": "0.0.1273771", + "puppeteer-core": "22.7.1" + }, + "bin": { + "puppeteer": "lib/esm/puppeteer/node/cli.js" }, "engines": { - "node": ">=8.16.0" + "node": ">=18" } }, - "node_modules/puppeteer/node_modules/agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true, + "node_modules/puppeteer-core": { + "version": "22.7.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.7.1.tgz", + "integrity": "sha512-jD7T7yN7PWGuJmNT0TAEboA26s0VVnvbgCxqgQIF+eNQW2u71ENaV2JwzSJiCHO+e72H4Ue6AgKD9USQ8xAcOQ==", + "dependencies": { + "@puppeteer/browsers": "2.2.3", + "chromium-bidi": "0.5.19", + "debug": "4.3.4", + "devtools-protocol": "0.0.1273771", + "ws": "8.16.0" + }, "engines": { - "node": ">= 6.0.0" + "node": ">=18" } }, - "node_modules/puppeteer/node_modules/https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", - "dev": true, + "node_modules/puppeteer/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/puppeteer/node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dependencies": { - "agent-base": "5", - "debug": "4" + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" }, "engines": { - "node": ">= 6.0.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/puppeteer/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, + "node_modules/puppeteer/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { - "glob": "^7.1.3" + "argparse": "^2.0.1" }, "bin": { - "rimraf": "bin.js" + "js-yaml": "bin/js-yaml.js" } }, "node_modules/q": { @@ -20167,8 +20493,7 @@ "node_modules/queue-tick": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "dev": true + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" }, "node_modules/ra-core": { "version": "4.16.16", @@ -21950,9 +22275,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -22392,7 +22717,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -22583,7 +22907,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", - "dev": true, "dependencies": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -22593,6 +22916,30 @@ "npm": ">= 3.0.0" } }, + "node_modules/socks-proxy-agent": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.3.tgz", + "integrity": "sha512-VNegTZKhuGq5vSD6XNKlbqWhyt/40CgoEw8XxD6dhnm8Jq9IEa3nIa4HwnM8XOqU0CdB0BwWVXusqiFXfHB3+A==", + "dependencies": { + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -23006,13 +23353,15 @@ } }, "node_modules/streamx": { - "version": "2.15.6", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", - "integrity": "sha512-q+vQL4AAz+FdfT137VF69Cc/APqUbxy+MDOImRrMvchJpigHj9GksgDU2LYbO9rx7RX6osWgxJB2WxhYv4SZAw==", - "dev": true, + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.16.1.tgz", + "integrity": "sha512-m9QYj6WygWyWa3H1YY69amr4nVgy61xfjys7xO7kviL5rfIEc2naf+ewFiOA+aEJD7y0JO3h2GoiUv4TDwEGzQ==", "dependencies": { "fast-fifo": "^1.1.0", "queue-tick": "^1.0.1" + }, + "optionalDependencies": { + "bare-events": "^2.2.0" } }, "node_modules/strict-uri-encode": { @@ -23555,11 +23904,23 @@ "node": ">=6" } }, + "node_modules/tar-fs": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.5.tgz", + "integrity": "sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^2.1.1", + "bare-path": "^2.1.0" + } + }, "node_modules/tar-stream": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", - "dev": true, "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", @@ -23723,8 +24084,7 @@ "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "node_modules/thunky": { "version": "1.1.0", @@ -24016,12 +24376,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", - "dev": true - }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -24056,6 +24410,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/underscore": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", @@ -24293,6 +24679,11 @@ "requires-port": "^1.0.0" } }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==" + }, "node_modules/use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -24707,26 +25098,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/webpack-dev-server/node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/webpack-manifest-plugin": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/webpack-manifest-plugin/-/webpack-manifest-plugin-4.1.1.tgz", @@ -25391,12 +25762,23 @@ } }, "node_modules/ws": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", - "dev": true, - "dependencies": { - "async-limiter": "~1.0.0" + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/xml-name-validator": { @@ -25484,7 +25866,6 @@ "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "dev": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -25501,6 +25882,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/zustand": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/zustand/-/zustand-3.7.2.tgz", diff --git a/webapp/package.json b/webapp/package.json index 293e3b57..67cbdf32 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -14,6 +14,7 @@ "gapi-script": "^1.2.0", "i18next": "^23.10.0", "jwt-decode": "^4.0.0", + "puppeteer": "^22.7.1", "react": "^18.2.0", "react-admin": "^4.16.16", "react-dom": "^18.2.0", @@ -61,7 +62,6 @@ "jest-cucumber": "^3.0.1", "jest-environment-node": "^29.7.0", "mongodb-memory-server": "^9.1.4", - "puppeteer": "^2.1.1", "react-i18next": "^11.6.0", "sass": "^1.71.1", "serve": "^14.2.1", From a79ec7f97d1dc69040b6758a15b7b6eb9d57272f Mon Sep 17 00:00:00 2001 From: JaimeLoredo Date: Sun, 28 Apr 2024 13:08:25 +0200 Subject: [PATCH 02/10] Test e2e singlePlayer --- webapp/e2e/singlePlayer.js | 387 ++++++------------------------------- 1 file changed, 56 insertions(+), 331 deletions(-) diff --git a/webapp/e2e/singlePlayer.js b/webapp/e2e/singlePlayer.js index 6a332091..7195376d 100644 --- a/webapp/e2e/singlePlayer.js +++ b/webapp/e2e/singlePlayer.js @@ -1,343 +1,68 @@ -const puppeteer = require('puppeteer'); // Add this line to import puppeteer +const puppeteer = require('puppeteer'); + +function delay(time) { + return new Promise(function(resolve) { + setTimeout(resolve, time) + }); +} (async () => { - const browser = await puppeteer.launch(); + // Abrir un navegador Puppeteer + const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); const timeout = 5000; + + // Configurar un tiempo de espera predeterminado para las acciones de la página page.setDefaultTimeout(timeout); - { - const targetPage = page; - await targetPage.setViewport({ - width: 215, - height: 702 - }) - } - { - const targetPage = page; - const promises = []; - const startWaitingForEvents = () => { - promises.push(targetPage.waitForNavigation()); - } - startWaitingForEvents(); - await targetPage.goto('http://localhost:3000/'); - await Promise.all(promises); - } - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"login\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 107.90000009536743, - y: 19.399993896484375, - }, - }); - } - await new Promise(resolve => setTimeout(resolve, 1000)); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@id=\\":r1:\\"])') - ]) - .setTimeout(timeout) - .fill('PabloS'); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@id=\\":r3:\\"])') - ]) - .setTimeout(timeout) - .fill('PabloPassword'); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"init\\"]/div/main/div/div[3]/button[1])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 83, - y: 9.89996337890625, - }, - }); - } - await page.waitFor(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/button[1]/a)') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 95.71249771118164, - y: 15.600006103515625, - }, - }); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"add-bot-button\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 48.20000076293945, - y: 23.48748779296875, - }, - }); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"add-bot-button\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 62.20000076293945, - y: 27.6875, - }, - }); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"start-game-button\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 26.412498474121094, - y: 49.88751220703125, - }, - }); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Zaragoza City\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 74.94900703430176, - y: 30.647064208984375, - }, - }); - } - await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Santa Cruz de Tenerife\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 75.07829856872559, - y: 30.558135986328125, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-City of Valencia\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 75.08199691772461, - y: 30.557891845703125, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Kampala\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 74.91261291503906, - y: 30.493377685546875, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-San Salvador\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 74.6823673248291, - y: 30.49365234375, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-804237\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 74.88681030273438, - y: 30.449310302734375, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-461346\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 74.88809204101562, - y: 30.450042724609375, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-B\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 53.96490669250488, - y: 28.493682861328125, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-Ag\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 54.44675827026367, - y: 28.767486572265625, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-United States of America\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 53.76158142089844, - y: 28.448974609375, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer-United Kingdom\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 53.84560585021973, - y: 28.494049072265625, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[2])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 56, - y: 51.25, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer--45\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 45.233205795288086, - y: 29.246139526367188, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(//*[@data-testid=\\"answer--86\\"])') - ]) - .setTimeout(timeout) - .click({ - offset: { - x: 45.07732582092285, - y: 29.157562255859375, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(/html)') - ]) - .setTimeout(timeout) - .click({ - delay: 413.79999999981374, - offset: { - x: 63, - y: 268, - }, - }); - }await page.waitForTimeout(1000); - { - const targetPage = page; - await puppeteer.Locator.race([ - targetPage.locator('::-p-xpath(/html)') - ]) - .setTimeout(timeout) - .click({ - delay: 428.70000000018626, - offset: { - x: 425, - y: 462, - }, - }); + // Ir a la página de inicio de sesión + await page.goto('http://localhost:3000/'); + + // Esperar a que aparezca el botón de inicio de sesión y hacer clic en él + await page.waitForSelector('button.MuiButtonBase-root:nth-child(2)'); + await page.click('button.MuiButtonBase-root:nth-child(2)'); + + // Esperar a que aparezca el campo de nombre de usuario, escribir el nombre de usuario y esperar + await page.waitForSelector('div.MuiFormControl-root:nth-child(2) > div:nth-child(2)'); + await page.click('div.MuiFormControl-root:nth-child(2) > div:nth-child(2)'); // Hacer clic en el campo de usuario + await page.type('div.MuiFormControl-root:nth-child(2) > div:nth-child(2)', 'PabloS',{ delay: 100 }); + + // Esperar a que aparezca el campo de contraseña, escribir la contraseña y esperar + await page.waitForSelector('div.MuiFormControl-root:nth-child(3) > div:nth-child(2)'); + await page.click('div.MuiFormControl-root:nth-child(3) > div:nth-child(2)'); // Hacer clic en el campo de contraseña + await page.type('div.MuiFormControl-root:nth-child(3) > div:nth-child(2)', 'PabloPassword',{ delay: 100 }); + + // Esperar a que aparezca el botón de inicio de sesión y hacer clic en él + await page.waitForSelector('button.MuiButtonBase-root:nth-child(1)'); + await page.click('button.MuiButtonBase-root:nth-child(1)'); + + // Esperar a que aparezca el botón de juego individual y hacer clic en él + await page.waitForSelector('button.game-page-button:nth-child(1)'); + await page.click('button.game-page-button:nth-child(1)'); + + // Esperar a que aparezca el botón "add bot" y hacer clic en él + await page.waitForSelector('.add-bot-button'); + await page.click('.add-bot-button'); + await delay(6000); + // Esperar a que aparezca el botón "start game" y hacer clic en él + await page.waitForSelector('.start-game-button'); + await page.click('.start-game-button'); + await delay(1500); + // Selector base para el botón de respuesta + const answerSelector = '.answer-grid > button:nth-child'; + + // Hacer clic en el botón de respuesta 13 veces utilizando un bucle for + for (let i = 1; i <= 13; i++) { + const fullSelector = `${answerSelector}(${1})`; // Selector completo para cada botón de respuesta + await page.waitForSelector(fullSelector); // Esperar a que aparezca el botón de respuesta actual + await page.click(fullSelector); // Hacer clic en el botón de respuesta actual + console.log('Clicked answer', i); // Imprimir un mensaje en la consola + await delay(5000); + } + // Cerrar el navegador await browser.close(); })().catch(err => { From c40bf0162c6e4e322026e6b8b23199d854c1661b Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 20:01:08 +0200 Subject: [PATCH 03/10] some multiplayer tests --- webapp/e2e/jest.config.js | 3 +- .../game/multiplayer/GameMultiPlayer.tsx | 5 +- .../game/multiplayer/LobbyMultiPlayer.tsx | 10 +++- .../game/multiplayer/MenuMultiplayer.tsx | 6 +-- .../game/multiplayer/MultiPlayer.test.js | 50 +++++++++++++++++++ 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 webapp/src/components/game/multiplayer/MultiPlayer.test.js diff --git a/webapp/e2e/jest.config.js b/webapp/e2e/jest.config.js index db3be3d9..d0232b7c 100644 --- a/webapp/e2e/jest.config.js +++ b/webapp/e2e/jest.config.js @@ -1,5 +1,6 @@ module.exports = { testMatch: ["**/steps/*.js"], testTimeout: 30000, - setupFilesAfterEnv: ["expect-puppeteer"] + setupFilesAfterEnv: ["expect-puppeteer"], + testEnvironment: 'jest' } \ No newline at end of file diff --git a/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx b/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx index b7e96009..516c4ead 100644 --- a/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx @@ -78,11 +78,14 @@ const GameMultiPlayer: FC = () => { }); newSocket.on('joinedParty', (user: UserPlayer) => { + console.log('joined party'); setStage(2); }) newSocket.on('lobbyUsers', (users: UserPlayer[]) => { + console.log("lobby users 1"); setUsers(users); + console.log("lobby users 1"); }); newSocket.on('partyNotFound', () => { @@ -114,7 +117,7 @@ const GameMultiPlayer: FC = () => { <> {stage === 1 && } - {stage === 2 && } + {stage === 2 && } {stage === 3 && } {stage === 4 && } diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index e135d86b..3d8c9ace 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -13,6 +13,7 @@ interface LobbyMultiPlayerProps { const LobbyMultiPlayer: FC = ({ socket, handleCurrentStage, partyCode, users }) => { + console.log("Lobby multiplayer"); const [isFetched, setFetched] = useState(true); const uuid = localStorage.getItem("uuid"); @@ -24,13 +25,19 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; + console.log("before try"); + try { + console.log("try"); const requestData = { players: users.map((user) => ({ uuid: user.uuid })) } const lang = localStorage.getItem("lang") + console.log("Before response"); const response = await axios.post(`${apiEndpoint}/createGame/${lang}`, requestData); + console.log("after response"); + console.log(response); socket.emit('updateQuestions', partyCode, response.data); setFetched(true); @@ -39,6 +46,7 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag } }; + console.log("after try"); const exitLobby = () => { socket.emit('exitParty', partyCode) handleCurrentStage(1) @@ -49,7 +57,7 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag } return ( -
+

{t('lobby_multiplayer_title')}

{t('lobby_multiplayer_party_code')}{partyCode}

diff --git a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx index 57bd7d9d..bdf23e4d 100644 --- a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx +++ b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx @@ -40,14 +40,14 @@ const MenuMultiplayer: FC = ({socket, handleCurrentStage, } return ( -
+

{t('menu_multiplayer_create_or_join')}

-
setTypedCode(e.target.value)}> - +
) diff --git a/webapp/src/components/game/multiplayer/MultiPlayer.test.js b/webapp/src/components/game/multiplayer/MultiPlayer.test.js new file mode 100644 index 00000000..d4faa37a --- /dev/null +++ b/webapp/src/components/game/multiplayer/MultiPlayer.test.js @@ -0,0 +1,50 @@ +import React from 'react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import GameMultiPlayer from './GameMultiPlayer'; + +const mockAxios = new MockAdapter(axios); + +describe('Multiplayer Lobby component', () => { + + beforeEach(() => { + mockAxios.reset(); + }); + + it('user creates a party', async () => { + + const mockQuestions = [ + { + uuid: '1', + question: 'What is the capital of France?', + correctAnswer: 'Paris', + incorrectAnswer1: 'London', + incorrectAnswer2: 'Berlin', + incorrectAnswer3: 'Madrid', + } + ]; + + const mockResponse = { data: mockQuestions }; + mockAxios.onPost('http://localhost:8000/createGame/en').reply(200, mockResponse); + + // Mock local storage + const localStorageMock = { + getItem: jest.fn((key) => { + return key === 'username' ? 'testUser' : key === 'score' ? '100' : key === 'uuid' ? '111111' : null; + }), + }; + Object.defineProperty(window, 'localStorage', { value: localStorageMock }); + + const multiplayer = render( + + ); + // Wait for the Snackbar to be open + await waitFor(() => { + expect(screen.getByTestId("menu-multiplayer")).toBeInTheDocument(); + }); + + + fireEvent.click(screen.getByTestId("multiplayer-create-party-button")); + }); +}) \ No newline at end of file From 1f46216598b17a43c5ec5f1635e31f55b01a9f2a Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 20:18:46 +0200 Subject: [PATCH 04/10] Added test for joining party --- .../game/multiplayer/GameMultiPlayer.tsx | 3 -- .../game/multiplayer/JoinParty.test.js | 54 +++++++++++++++++++ .../game/multiplayer/LobbyMultiPlayer.tsx | 8 --- .../game/multiplayer/MenuMultiplayer.tsx | 4 +- .../game/multiplayer/MultiPlayer.test.js | 6 ++- 5 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 webapp/src/components/game/multiplayer/JoinParty.test.js diff --git a/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx b/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx index 516c4ead..de7bca48 100644 --- a/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/GameMultiPlayer.tsx @@ -78,14 +78,11 @@ const GameMultiPlayer: FC = () => { }); newSocket.on('joinedParty', (user: UserPlayer) => { - console.log('joined party'); setStage(2); }) newSocket.on('lobbyUsers', (users: UserPlayer[]) => { - console.log("lobby users 1"); setUsers(users); - console.log("lobby users 1"); }); newSocket.on('partyNotFound', () => { diff --git a/webapp/src/components/game/multiplayer/JoinParty.test.js b/webapp/src/components/game/multiplayer/JoinParty.test.js new file mode 100644 index 00000000..f098886f --- /dev/null +++ b/webapp/src/components/game/multiplayer/JoinParty.test.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import GameMultiPlayer from './GameMultiPlayer'; + +const mockAxios = new MockAdapter(axios); + +describe('Multiplayer Lobby component', () => { + + beforeEach(() => { + mockAxios.reset(); + }); + + it('user creates a party', async () => { + + const mockQuestions = [ + { + uuid: '1', + question: 'What is the capital of France?', + correctAnswer: 'Paris', + incorrectAnswer1: 'London', + incorrectAnswer2: 'Berlin', + incorrectAnswer3: 'Madrid', + } + ]; + + const mockResponse = { data: mockQuestions }; + mockAxios.onPost('http://localhost:8000/createGame/en').reply(200, mockResponse); + + // Mock local storage + const localStorageMock = { + getItem: jest.fn((key) => { + return key === 'username' ? 'testUser' : key === 'score' ? '100' : key === 'uuid' ? '111111' : null; + }), + }; + Object.defineProperty(window, 'localStorage', { value: localStorageMock }); + + const multiplayer = render( + + ); + // Wait for the Snackbar to be open + await waitFor(() => { + expect(screen.getByTestId("menu-multiplayer")).toBeInTheDocument(); + }); + + + fireEvent.click(screen.getByTestId("multiplayer-create-party-button")); + + expect(screen.getByTestId("lobby-multiplayer")).toBeInTheDocument(); + }); + + +}) \ No newline at end of file diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index 3d8c9ace..1bd8fc48 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -12,8 +12,6 @@ interface LobbyMultiPlayerProps { } const LobbyMultiPlayer: FC = ({ socket, handleCurrentStage, partyCode, users }) => { - - console.log("Lobby multiplayer"); const [isFetched, setFetched] = useState(true); const uuid = localStorage.getItem("uuid"); @@ -25,18 +23,13 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; - console.log("before try"); - try { - console.log("try"); const requestData = { players: users.map((user) => ({ uuid: user.uuid })) } const lang = localStorage.getItem("lang") - console.log("Before response"); const response = await axios.post(`${apiEndpoint}/createGame/${lang}`, requestData); - console.log("after response"); console.log(response); socket.emit('updateQuestions', partyCode, response.data); @@ -46,7 +39,6 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag } }; - console.log("after try"); const exitLobby = () => { socket.emit('exitParty', partyCode) handleCurrentStage(1) diff --git a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx index bdf23e4d..961d0a87 100644 --- a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx +++ b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx @@ -46,8 +46,8 @@ const MenuMultiplayer: FC = ({socket, handleCurrentStage, {t('menu_multiplayer_create')}
- setTypedCode(e.target.value)}> - + setTypedCode(e.target.value)}> +
) diff --git a/webapp/src/components/game/multiplayer/MultiPlayer.test.js b/webapp/src/components/game/multiplayer/MultiPlayer.test.js index d4faa37a..58fe57d0 100644 --- a/webapp/src/components/game/multiplayer/MultiPlayer.test.js +++ b/webapp/src/components/game/multiplayer/MultiPlayer.test.js @@ -6,7 +6,7 @@ import GameMultiPlayer from './GameMultiPlayer'; const mockAxios = new MockAdapter(axios); -describe('Multiplayer Lobby component', () => { +describe('Multiplayer Manu component', () => { beforeEach(() => { mockAxios.reset(); @@ -46,5 +46,9 @@ describe('Multiplayer Lobby component', () => { fireEvent.click(screen.getByTestId("multiplayer-create-party-button")); + + expect(screen.getByTestId("lobby-multiplayer")).toBeInTheDocument(); }); + + }) \ No newline at end of file From d899d892edb2371d08d4873041b3c5261503dbdc Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 20:27:58 +0200 Subject: [PATCH 05/10] Changes in tests --- .../game/multiplayer/JoinParty.test.js | 26 ++++++++----------- .../game/multiplayer/LobbyMultiPlayer.tsx | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/webapp/src/components/game/multiplayer/JoinParty.test.js b/webapp/src/components/game/multiplayer/JoinParty.test.js index f098886f..0b777668 100644 --- a/webapp/src/components/game/multiplayer/JoinParty.test.js +++ b/webapp/src/components/game/multiplayer/JoinParty.test.js @@ -13,28 +13,25 @@ describe('Multiplayer Lobby component', () => { }); it('user creates a party', async () => { - - const mockQuestions = [ + + const mockResponse = { data: [ { uuid: '1', - question: 'What is the capital of France?', - correctAnswer: 'Paris', - incorrectAnswer1: 'London', - incorrectAnswer2: 'Berlin', - incorrectAnswer3: 'Madrid', + question: '56*54-3', + correctAnswer: '3021', + incorrectAnswer1: '3000', + incorrectAnswer2: '3022', + incorrectAnswer3: '3031', } - ]; - - const mockResponse = { data: mockQuestions }; + ] }; mockAxios.onPost('http://localhost:8000/createGame/en').reply(200, mockResponse); // Mock local storage - const localStorageMock = { + Object.defineProperty(window, 'localStorage', { value: { getItem: jest.fn((key) => { - return key === 'username' ? 'testUser' : key === 'score' ? '100' : key === 'uuid' ? '111111' : null; + return key === 'username' ? 'userForTest' : key === 'score' ? '0' : key === 'uuid' ? '2222' : null; }), - }; - Object.defineProperty(window, 'localStorage', { value: localStorageMock }); + } }); const multiplayer = render( @@ -49,6 +46,5 @@ describe('Multiplayer Lobby component', () => { expect(screen.getByTestId("lobby-multiplayer")).toBeInTheDocument(); }); - }) \ No newline at end of file diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index 1bd8fc48..b736e7bd 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -55,7 +55,7 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag

{t('lobby_multiplayer_party_code')}{partyCode}

{users.map((player) => ( -
+
{player.uuid}

{player.username}

{player.isAdmin &&

{t('lobby_multiplayer_admin')}

} From 8bb581266203d9a996c2eb246fc89fe227f422fb Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 20:55:41 +0200 Subject: [PATCH 06/10] Test for multiplayer lobby added --- .../game/multiplayer/LobbyMultiPlayer.tsx | 5 ++- .../game/multiplayer/LobbyMultiplayer.test.js | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index b736e7bd..81e410a8 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -15,6 +15,7 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag const [isFetched, setFetched] = useState(true); const uuid = localStorage.getItem("uuid"); + console.log(uuid); const { t } = useTranslation(); @@ -64,8 +65,8 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag
))}
- - {isFetched && isAdmin() && } + + {isFetched && isAdmin() && } {isFetched && !isAdmin() && } {!isFetched && }
diff --git a/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js b/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js new file mode 100644 index 00000000..d7b10f73 --- /dev/null +++ b/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import LobbyMultiPlayer from './LobbyMultiPlayer'; + +// Mock Axios +const mockAxios = new MockAdapter(axios); + +describe('LobbyMultiPlayer component', () => { + // Mock props + const mockProps = { + socket: { emit: jest.fn() }, + handleCurrentStage: jest.fn(), + partyCode: '123456', + users: [{ uuid: '1', username: 'user1', totalPoints: 0, isAdmin: true }], + }; + + beforeEach(() => { + mockAxios.reset(); + }); + + it('renders lobby with correct elements', async () => { + const {getAllByTestId} = render(); + + // Ensure player items are rendered + + const players = getAllByTestId("player-item"); + + // Check if there is one player + expect(players.length).toBeGreaterThan(0); + + }); + + it('clicking exit lobby button calls handleCurrentStage', async () => { + render(); + + fireEvent.click(screen.getByTestId("exit-lobby-button")); + + expect(mockProps.handleCurrentStage).toHaveBeenCalledWith(1); + }); + +}); \ No newline at end of file From 73a753079efd4cc7cf900658206f8e1f0b58a116 Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 21:04:37 +0200 Subject: [PATCH 07/10] Added test for game menu --- .../game/multiplayer/MenuMultiplayer.test.js | 46 +++++++++++++++++++ .../game/multiplayer/MenuMultiplayer.tsx | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 webapp/src/components/game/multiplayer/MenuMultiplayer.test.js diff --git a/webapp/src/components/game/multiplayer/MenuMultiplayer.test.js b/webapp/src/components/game/multiplayer/MenuMultiplayer.test.js new file mode 100644 index 00000000..eeccaee1 --- /dev/null +++ b/webapp/src/components/game/multiplayer/MenuMultiplayer.test.js @@ -0,0 +1,46 @@ +import React from 'react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import MenuMultiplayer from './MenuMultiplayer'; + +describe('MenuMultiplayer component', () => { + // Mock props + const mockProps = { + socket: { emit: jest.fn() }, + handleCurrentStage: jest.fn(), + handlePartyCode: jest.fn(), + }; + + beforeEach(() => { + jest.clearAllMocks(); + localStorage.clear(); + }); + + it('renders menu with correct elements', () => { + render(); + + // Ensure header and buttons are rendered + expect(screen.getByTestId("title-menu-multiplayer")).toBeInTheDocument(); + expect(screen.getByTestId("multiplayer-create-party-button")).toBeInTheDocument(); + expect(screen.getByTestId("multiplayer-join-party-code")).toBeInTheDocument(); + expect(screen.getByTestId("multiplayer-join-party-button" )).toBeInTheDocument(); + }); + + it('calls createParty function when create party button is clicked', () => { + render(); + + fireEvent.click(screen.getByTestId('multiplayer-create-party-button')); + + expect(mockProps.handleCurrentStage).toHaveBeenCalledWith(2); + expect(mockProps.socket.emit).toHaveBeenCalledWith('createParty', expect.any(Object)); + }); + + it('calls joinParty function with typed code when join party button is clicked', () => { + render(); + + fireEvent.change(screen.getByTestId('multiplayer-join-party-code'), { target: { value: '123456' } }); + fireEvent.click(screen.getByTestId('multiplayer-join-party-button')); + + expect(mockProps.handlePartyCode).toHaveBeenCalledWith('123456'); + expect(mockProps.socket.emit).toHaveBeenCalledWith('joinParty', '123456', expect.any(Object)); + }); +}); \ No newline at end of file diff --git a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx index 961d0a87..c456668b 100644 --- a/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx +++ b/webapp/src/components/game/multiplayer/MenuMultiplayer.tsx @@ -41,7 +41,7 @@ const MenuMultiplayer: FC = ({socket, handleCurrentStage, return (
-

{t('menu_multiplayer_create_or_join')}

+

{t('menu_multiplayer_create_or_join')}

From 5e06df3d4bce3699874c31ed7c03f40e02f1a64e Mon Sep 17 00:00:00 2001 From: CarolinaUniovi Date: Sun, 28 Apr 2024 21:17:11 +0200 Subject: [PATCH 08/10] added test to multiplayer lobby --- webapp/e2e/jest.config.js | 1 - .../game/multiplayer/LobbyMultiPlayer.tsx | 2 +- .../game/multiplayer/LobbyMultiplayer.test.js | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/webapp/e2e/jest.config.js b/webapp/e2e/jest.config.js index d0232b7c..309197d8 100644 --- a/webapp/e2e/jest.config.js +++ b/webapp/e2e/jest.config.js @@ -2,5 +2,4 @@ module.exports = { testMatch: ["**/steps/*.js"], testTimeout: 30000, setupFilesAfterEnv: ["expect-puppeteer"], - testEnvironment: 'jest' } \ No newline at end of file diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index 81e410a8..7e028eeb 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -67,7 +67,7 @@ const LobbyMultiPlayer: FC = ({ socket, handleCurrentStag
{isFetched && isAdmin() && } - {isFetched && !isAdmin() && } + {isFetched && !isAdmin() && } {!isFetched && }
diff --git a/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js b/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js index d7b10f73..d47f1ee6 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js +++ b/webapp/src/components/game/multiplayer/LobbyMultiplayer.test.js @@ -40,4 +40,35 @@ describe('LobbyMultiPlayer component', () => { expect(mockProps.handleCurrentStage).toHaveBeenCalledWith(1); }); + it('clicking start game button emits updateQuestions event', async () => { + const mockResponse = { data: [ + { + uuid: '1', + question: '56*54-3', + correctAnswer: '3021', + incorrectAnswer1: '3000', + incorrectAnswer2: '3022', + incorrectAnswer3: '3031', + } + ] }; + mockAxios.onPost('http://localhost:8000/createGame/en').reply(200, mockResponse); + Object.defineProperty(window, 'localStorage', { value: { + getItem: jest.fn((key) => { + return key === 'uuid' ? "1" : key === 'lang' ? "en" : null; + }), + } }); + + render(); + + await waitFor(() => { + expect(screen.getByTestId("start-game-button")).toBeInTheDocument(); + }); + + fireEvent.click(screen.getByTestId("start-game-button")); + + await waitFor(() => { + expect(mockProps.socket.emit).toHaveBeenCalledWith('updateQuestions', '123456', expect.any(Object)); + }); + }); + }); \ No newline at end of file From 5a65406f742b26503aa9e82f047ee96ab841e724 Mon Sep 17 00:00:00 2001 From: carlospelazas Date: Sun, 28 Apr 2024 22:00:32 +0200 Subject: [PATCH 09/10] create dockerfiles and upload image for grafana and prometheus --- gatewayservice/monitoring/grafana/Dockerfile | 10 ++++++++++ gatewayservice/monitoring/prometheus/Dockerfile | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gatewayservice/monitoring/grafana/Dockerfile create mode 100644 gatewayservice/monitoring/prometheus/Dockerfile diff --git a/gatewayservice/monitoring/grafana/Dockerfile b/gatewayservice/monitoring/grafana/Dockerfile new file mode 100644 index 00000000..87d4c79a --- /dev/null +++ b/gatewayservice/monitoring/grafana/Dockerfile @@ -0,0 +1,10 @@ +FROM grafana/grafana + +# Copying the provisioning files +COPY ./provisioning /etc/grafana/provisioning + +# Exposing Grafana server port +EXPOSE 9091 + +# Running Grafana server +CMD [ "grafana-server" ] \ No newline at end of file diff --git a/gatewayservice/monitoring/prometheus/Dockerfile b/gatewayservice/monitoring/prometheus/Dockerfile new file mode 100644 index 00000000..d54cdcf9 --- /dev/null +++ b/gatewayservice/monitoring/prometheus/Dockerfile @@ -0,0 +1,10 @@ +FROM prom/prometheus + +# Copying the configuration file +COPY prometheus.yml /etc/prometheus/prometheus.yml + +# Exposing Prometheus server port +EXPOSE 9090 + +# Running Prometheus +ENTRYPOINT [ "prometheus", "--config.file=/etc/prometheus/prometheus.yml" ] \ No newline at end of file From 898a6a8befcf838bb18bfc2cfa1bb9ac4d080403 Mon Sep 17 00:00:00 2001 From: carlospelazas Date: Sun, 28 Apr 2024 22:03:29 +0200 Subject: [PATCH 10/10] uncomment test on release job --- .github/workflows/release.yml | 84 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98b54916..3e66644a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,47 +5,47 @@ on: types: [published] jobs: - # unit-tests: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 20 - # - run: npm --prefix users/authservice ci - # - run: npm --prefix users/userservice ci - # - run: npm --prefix gatewayservice ci - # - run: npm --prefix webapp ci - # - run: npm --prefix users/authservice test -- --coverage - # - run: npm --prefix users/userservice test -- --coverage - # - run: npm --prefix gatewayservice test -- --coverage - # - run: npm --prefix webapp test -- --coverage - # - name: Analyze with SonarCloud - # uses: sonarsource/sonarcloud-github-action@master - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # e2e-tests: - # # needs: [unit-tests] - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 20 - # - run: npm --prefix users/authservice install - # - run: npm --prefix users/userservice install - # - run: npm --prefix gatewayservice install - # - run: npm --prefix webapp install - # - run: npm --prefix webapp run build - #- run: npm --prefix webapp run test:e2e + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm --prefix users/authservice ci + - run: npm --prefix users/userservice ci + - run: npm --prefix gatewayservice ci + - run: npm --prefix webapp ci + - run: npm --prefix users/authservice test -- --coverage + - run: npm --prefix users/userservice test -- --coverage + - run: npm --prefix gatewayservice test -- --coverage + - run: npm --prefix webapp test -- --coverage + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + e2e-tests: + needs: [unit-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm --prefix users/authservice install + - run: npm --prefix users/userservice install + - run: npm --prefix gatewayservice install + - run: npm --prefix webapp install + - run: npm --prefix webapp run build + - run: npm --prefix webapp run test:e2e docker-push-webapp: name: Push webapp Docker Image to GitHub Packages runs-on: ubuntu-latest permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -69,7 +69,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -87,7 +87,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -105,7 +105,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -123,7 +123,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -141,7 +141,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -162,7 +162,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -180,7 +180,7 @@ jobs: permissions: contents: read packages: write - #needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry