From d23ee7bfedf933794f34dc826d13eff30f2c10bd Mon Sep 17 00:00:00 2001 From: harehare Date: Wed, 30 Oct 2024 22:38:16 +0900 Subject: [PATCH] :green_heart: Fix e2e test --- .github/workflows/test.yml | 4 ++-- frontend/e2e/textusm.spec.ts | 4 +++- frontend/package.json | 4 +--- frontend/playwright.config.ts | 25 ++++++++++++++++++------- lua/init.lua | 13 +++++++++++++ 5 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 lua/init.lua diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88de20062..8d66b45c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,8 +98,8 @@ jobs: run: npm run test:e2e working-directory: frontend env: - API_ROOT: ${{ secrets.API_ROOT }} - WEB_ROOT: ${{ secrets.WEB_ROOT }} + API_ROOT: http://localhost:8081 + WEB_ROOT: http://localhost:3000 APP_VERSION: "" FIREBASE_API_KEY: textusm FIREBASE_AUTH_DOMAIN: textusm diff --git a/frontend/e2e/textusm.spec.ts b/frontend/e2e/textusm.spec.ts index a3c9d685b..bf2005efe 100644 --- a/frontend/e2e/textusm.spec.ts +++ b/frontend/e2e/textusm.spec.ts @@ -103,10 +103,12 @@ test('Save the diagram to remote and load it', async ({ page }) => { await editText(page, 'test1\n test2\n test3'); await page.locator('[data-test-id="save-menu"]').click(); + await page.waitForURL(/edit.+/); + await page.waitForLoadState('networkidle'); await page.waitForSelector('[data-test-id="list-menu"]'); await page.locator('[data-test-id="list-menu"]').click(); - await page.waitForSelector('[data-test-id="diagram-list-item"]'); + await page.waitForLoadState('networkidle'); await page.locator('[data-test-id="diagram-list-item"]').first().click(); await page.waitForLoadState('networkidle'); diff --git a/frontend/package.json b/frontend/package.json index 75070fe93..8ad9e5cf7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -42,7 +42,6 @@ "elm-review": "^2.12.0", "elm-test": "^0.19.1-revision12", "firebase-tools": "^13.15.1", - "kill-port": "^2.0.1", "prettier": "^3.3.3", "rimraf": "^6.0.1", "size-limit": "^11.0.2", @@ -89,12 +88,11 @@ "prod": "NODE_ENV=production NODE_OPTIONS='--max-old-space-size=4096' vite build", "postprod": "rimraf -rf dist/*.map", "preview": "concurrently \"vite preview\" \"cd ../backend/ && just run\"", - "preview:dev": "concurrently \"npm run dev:frontend\" \"cd ../backend/ && just run\"", "prepreview": "npm run prod", "setup:emulators": "cd .. && firebase init emulators", "test": "elm-test", "test:e2e:init": "playwright install --with-deps", - "test:e2e": "firebase emulators:exec --only auth 'playwright test' ; kill-port 8081" + "test:e2e": "firebase emulators:exec --only auth 'playwright test'" }, "browserslist": [ "defaults" diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 7fba4bf85..c3e11a612 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -20,11 +20,22 @@ export default defineConfig({ use: { ...devices['Desktop Firefox'] }, }, ], - webServer: { - command: 'DB_TYPE=sqlite FIREBASE_AUTH_EMULATOR_HOST="localhost:9099" USE_HTTPS=0 npm run preview:dev', - url: 'http://localhost:3000', - reuseExistingServer: !process.env.CI, - stdout: 'pipe', - stderr: 'pipe', - }, + webServer: [ + { + command: 'npm run dev:frontend', + url: 'http://localhost:3000', + reuseExistingServer: !process.env.CI, + timeout: 10 * 60 * 1000, + stdout: 'pipe', + stderr: 'pipe', + }, + { + command: 'cd ../backend && DB_TYPE=sqlite FIREBASE_AUTH_EMULATOR_HOST="localhost:9099" USE_HTTPS=0 just run', + url: 'http://localhost:8081/healthcheck', + reuseExistingServer: !process.env.CI, + timeout: 10 * 60 * 1000, + stdout: 'pipe', + stderr: 'pipe', + }, + ], }); diff --git a/lua/init.lua b/lua/init.lua new file mode 100644 index 000000000..0a111fb55 --- /dev/null +++ b/lua/init.lua @@ -0,0 +1,13 @@ +local M = {} + +local testModule = require('simple-nvim-plugin/testModule') + +function M.test() + print('hello world'); +end + +function M.callModule(str) + testModule.test(str) +end + +return M