Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ sw.*
/playwright-report/
/blob-report/
/playwright/.cache/
.auth/
11 changes: 11 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
18 changes: 0 additions & 18 deletions e2e/example.spec.ts

This file was deleted.

30 changes: 30 additions & 0 deletions e2e/find.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { test, expect } from '@playwright/test'

test('test', async ({ page }) => {
await page.goto('https://reims2.app/find')
await page.getByLabel('Category').fill('m')
await page.getByLabel('Category').press('Enter')

await page.getByLabel('Sphere').first().fill('1.2')
await page.getByLabel('Sphere').first().press('Enter')
await expect(page.getByLabel('Sphere').first()).toHaveValue('1.25')

await page.getByLabel('Cylinder').first().fill('1.7')

await page.getByLabel('Axis').first().fill('001')

await page.getByLabel('Additional').first().fill('1')
await page.getByLabel('Additional').first().press('Enter')
await expect(page.getByLabel('Additional').first()).toHaveValue('1.00')
await expect(page.getByLabel('Additional').nth(1)).toHaveValue('1.00')

await page.locator('#input-30').fill('2.0')

await page.locator('#input-32').fill('1.5')

await page.locator('#input-34').fill('002')

await page.locator('#input-36').press('Enter')

await expect(page.getByRole('main')).toContainText('SKU 0926')
})
17 changes: 17 additions & 0 deletions e2e/login.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test'

const authFile = 'e2e/.auth/user.json'
const PASSWORD = process.env.REIMS_PASSWORD as string

test('test', async ({ page }) => {
await page.goto('https://reims2.app/')
await page.getByRole('link', { name: 'Open REIMS2' }).click()
await page.getByLabel('Username').fill('reims')
await page.getByLabel('Password').fill(PASSWORD)
await page.getByLabel('Password').press('Enter')
await page.waitForURL('**/find')
await expect(page.getByRole('link', { name: 'REIMS Santa Ana' })).toBeInViewport()

// await expect(page.locator('div').filter({ hasText: 'Setting up REIMS2' }).nth(2)).toBeVisible()
await page.context().storageState({ path: authFile })
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@vitest/coverage-v8": "2.0.5",
"@vitest/ui": "2.0.5",
"@vue/eslint-config-typescript": "13.0.0",
"dotenv": "^16.4.5",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
Expand Down
30 changes: 21 additions & 9 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { defineConfig, devices } from '@playwright/test'
import dotenv from 'dotenv'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
dotenv.config()

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down Expand Up @@ -33,19 +29,35 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [
{
name: 'setup',
testMatch: /.*\.setup\.ts/,
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
use: {
...devices['Desktop Chrome'],
storageState: 'e2e/.auth/user.json',
},
dependencies: ['setup'],
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
use: {
...devices['Desktop Firefox'],
storageState: 'e2e/.auth/user.json',
},
dependencies: ['setup'],
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
use: {
...devices['Desktop Safari'],
storageState: 'e2e/.auth/user.json',
},
dependencies: ['setup'],
},

/* Test against mobile viewports. */
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4208,6 +4208,13 @@ __metadata:
languageName: node
linkType: hard

"dotenv@npm:^16.4.5":
version: 16.4.5
resolution: "dotenv@npm:16.4.5"
checksum: 10/55a3134601115194ae0f924e54473459ed0d9fc340ae610b676e248cca45aa7c680d86365318ea964e6da4e2ea80c4514c1adab5adb43d6867fb57ff068f95c8
languageName: node
linkType: hard

"eastasianwidth@npm:^0.2.0":
version: 0.2.0
resolution: "eastasianwidth@npm:0.2.0"
Expand Down Expand Up @@ -7358,6 +7365,7 @@ __metadata:
"@vueuse/core": "npm:10.11.1"
axios: "npm:1.7.4"
dayjs: "npm:1.11.12"
dotenv: "npm:^16.4.5"
eslint: "npm:8.57.0"
eslint-config-prettier: "npm:9.1.0"
eslint-config-standard: "npm:17.1.0"
Expand Down