diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b8439a0..d911564 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -26,3 +26,20 @@ jobs:
node-version: 20.17
- run: npm ci
- run: npm run test:unit
+
+ e2e-tests:
+ timeout-minutes: 5
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20.17
+ - run: npm ci
+ - run: npm run build
+ - name: Install Playwright Browsers
+ run: npx playwright install --with-deps
+ - name: Run Playwright tests
+ run: npx run test:e2e
diff --git a/e2e/home.spec.ts b/e2e/home.spec.ts
new file mode 100644
index 0000000..72ffbab
--- /dev/null
+++ b/e2e/home.spec.ts
@@ -0,0 +1,21 @@
+import {test, expect} from '@playwright/test';
+
+// See here how to get started:
+// https://playwright.dev/docs/intro
+test('visits the app root url', async ({page}) => {
+ await page.goto('/');
+ await expect(page.locator('h1')).toHaveText('Eat Your Veggies');
+ await expect(page).toHaveTitle('Eat Your Veggies - Home');
+ await expect(page.getByTestId('home-locale-button-fi')).toBeVisible();
+});
+
+test('home page actions work', async ({page}) => {
+ await page.goto('/');
+ await page.getByTestId('home-locale-button-fi').click();
+ await expect(page).toHaveTitle('Eat Your Veggies - Etusivu');
+ await expect(page.getByTestId('home-locale-button-en')).toBeVisible();
+ await page.getByTestId('home-info-button').click();
+ await expect(page.getByTestId('dialog')).toBeVisible();
+ await page.getByTestId('dialog-close-button').click();
+ await expect(page.getByTestId('dialog')).toBeHidden();
+});
diff --git a/e2e/vue.spec.ts b/e2e/vue.spec.ts
deleted file mode 100644
index 3e5a3d0..0000000
--- a/e2e/vue.spec.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { test, expect } from '@playwright/test';
-
-// See here how to get started:
-// https://playwright.dev/docs/intro
-test('visits the app root url', async ({ page }) => {
- await page.goto('/');
- await expect(page.locator('div.greetings > h1')).toHaveText('You did it!');
-})
diff --git a/playwright.config.ts b/playwright.config.ts
index 0b2730b..1d6127b 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -28,19 +28,21 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
- reporter: 'html',
+ reporter: 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
- baseURL: 'http://localhost:5173',
+ baseURL: 'http://localhost:5173/veggies/',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Only on CI systems run the tests headless */
headless: !!process.env.CI,
+
+ testIdAttribute: 'data-test-id',
},
/* Configure projects for major browsers */
@@ -58,39 +60,11 @@ export default defineConfig({
},
},
{
- name: 'webkit',
+ name: 'Mobile Chrome',
use: {
- ...devices['Desktop Safari'],
+ ...devices['Pixel 5'],
},
},
-
- /* Test against mobile viewports. */
- // {
- // name: 'Mobile Chrome',
- // use: {
- // ...devices['Pixel 5'],
- // },
- // },
- // {
- // name: 'Mobile Safari',
- // use: {
- // ...devices['iPhone 12'],
- // },
- // },
-
- /* Test against branded browsers. */
- // {
- // name: 'Microsoft Edge',
- // use: {
- // channel: 'msedge',
- // },
- // },
- // {
- // name: 'Google Chrome',
- // use: {
- // channel: 'chrome',
- // },
- // },
],
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
diff --git a/src/components/HomeLocaleChanger.vue b/src/components/HomeLocaleChanger.vue
index d6da62f..91104dc 100644
--- a/src/components/HomeLocaleChanger.vue
+++ b/src/components/HomeLocaleChanger.vue
@@ -18,6 +18,7 @@ const availableLocales = computed(() =>
Adopt a healthy lifestyle by eating 30 plant-based ingredients each week. Track your progress easily with this free app.
-