diff --git a/.env b/.env index f586e49..615a814 100644 --- a/.env +++ b/.env @@ -1,2 +1,4 @@ LIVEBOOK_TOKEN_ENABLED=0 ERL_AFLAGS = "-kernel shell_history enabled" +KUBECONFIG = "~/.kube/config" +KUBECONTEXT = "kind-kino-k8s" \ No newline at end of file diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 90b6b70..d212847 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,27 +1,58 @@ name: Playwright Tests on: push: - branches: [ main, master ] + branches: [main] pull_request: - branches: [ main, master ] + branches: [main] +env: + KUBECONFIG: /home/runner/.kube/config jobs: test: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: .tool-versions + + - name: Setup elixir + id: beam + uses: erlef/setup-beam@v1 + with: + version-file: .tool-versions + version-type: strict + install-rebar: true + install-hex: true + + - name: install livebook + run: mix escript.install --force hex livebook + + - uses: engineerd/setup-kind@v0.5.0 + id: kind + with: + version: v0.20.0 + name: kino-k8s + + - name: Install dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Run livebook + env: + LIVEBOOK_TOKEN_ENABLED: 0 + run: livebook server & + + - name: Run Playwright tests + env: + KUBECONTEXT: '' + run: KUBECONFIG="${KUBECONFIG}" npx playwright test + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index faaeb69..32aaac4 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,3 @@ kino_k8s-*.tar /test-results/ /playwright-report/ /blob-report/ -/playwright/.cache/ diff --git a/.rtx.toml b/.rtx.toml index 086ee2f..75c9d05 100644 --- a/.rtx.toml +++ b/.rtx.toml @@ -1,5 +1 @@ env_file = '.env' - -[tools] -erlang = "26.1.2" -elixir = "1.15.7" \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..2536ad3 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,4 @@ +node 18.18.1 +kind 0.20.0 +erlang 26.1.2 +elixir 1.15.7 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ccc801d..41d448b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +### Added + +- Integration tests using Playwright + ## [1.1.0] - 2023-11-03 diff --git a/e2e/kino_k8s/connection_cell.spec.ts b/e2e/kino_k8s/connection_cell.spec.ts index a74a8d8..237f868 100644 --- a/e2e/kino_k8s/connection_cell.spec.ts +++ b/e2e/kino_k8s/connection_cell.spec.ts @@ -10,7 +10,10 @@ test.beforeEach(async ({ page }) => { .fill(`Mix.install([{:kino_k8s, path: "${process.cwd()}"}])`) await page.getByRole('button', { name: 'Reconnect and setup' }).click() - await expect(page.locator('#outputs-setup-2')).toHaveText(/:ok/) + + await expect(page.locator('#outputs-setup-2')).toHaveText(/:ok/, { + timeout: 300000, + }) const smart = page .locator('section') diff --git a/playwright.config.ts b/playwright.config.ts index bfe3e83..7a59eb1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, devices } from '@playwright/test'; +import { defineConfig, devices } from '@playwright/test' /** * Read environment variables from file. @@ -28,6 +28,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', + video: 'on-first-retry', }, /* Configure projects for major browsers */ @@ -74,4 +75,4 @@ export default defineConfig({ // url: 'http://127.0.0.1:3000', // reuseExistingServer: !process.env.CI, // }, -}); +}) diff --git a/test/kino_k8s_test.exs b/test/kino_k8s_test.exs deleted file mode 100644 index 4d44ba3..0000000 --- a/test/kino_k8s_test.exs +++ /dev/null @@ -1,8 +0,0 @@ -defmodule KinoK8sTest do - use ExUnit.Case - doctest KinoK8s - - test "greets the world" do - assert KinoK8s.hello() == :world - end -end