test(e2e):[color-picker,color-select-panel,crop] Add E2E TEST (#1144)

* test[config-provider/user-head]Add E2E TEST

* test[dialog-box,numeric]Update E2E TEST

* test[dialog-box,numeric]Update E2E TEST

* test(modal):[modal]update test E2E TEST

* test:[toggle-menu,slide-bar,link-menu,divider,user-contact]update test E2E TEST

* test:[carousel,color-picker]Update E2E TEST

* test:[carousel,color-picker]Update E2E TEST

* test:[carousel,color-picker]Update E2E TEST

* test:[carousel,color-picker]Update E2E TEST

* test(e2e):[carousel] Update E2E TEST

* test(e2e):[crop,color-select-panel,color-picker] Add E2E TEST
This commit is contained in:
James 2023-12-15 11:03:16 +08:00 committed by GitHub
parent cdc4b1c223
commit b4cab3020c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 442 additions and 6 deletions

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('测试Alpha', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-picker#enable-alpha')
await page.locator('.tiny-color-picker__inner').click()
await page.locator('.black').click()
await page.getByText('演示AlphaAlpha选择。取消选择').click()
await page.getByText('用户选择了取消').click()
await page.locator('.tiny-color-picker__inner').click()
await page.locator('.black').click()
await page.getByRole('button', { name: '选择' }).click()
await page.getByText('#804040FF').click()
})

View File

@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test'
test('基本用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-picker#basic-usage')
await page.locator('.tiny-color-picker__inner').click()
await page.locator('.black').click()
await page.getByRole('button', { name: '选择' }).click()
await page.locator('#basic-usage').getByRole('img').click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
})

View File

@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test'
test('默认显示色盘', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-picker#default-visible')
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
})

View File

@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test'
test('动态切换颜色', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-picker#dynamic-color-change')
await page.getByRole('button', { name: '切换', exact: true }).click()
await page.getByRole('button', { name: '切换', exact: true }).click()
await page.getByRole('button', { name: '切换', exact: true }).click()
})

View File

@ -0,0 +1,10 @@
import { test, expect } from '@playwright/test'
test('事件触发', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-picker#event')
await page.locator('#event').getByRole('img').click()
await page.getByRole('button', { name: '选择' }).click()
await page.locator('#event').getByRole('img').click()
await page.getByRole('button', { name: '取消' }).click()
})

View File

@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test'
test('测试Alpha', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-select-panel#alpha')
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.locator('.black').click()
await page.getByRole('button', { name: '选择' }).click()
})

View File

@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test'
test('基本用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-select-panel#basic-usage')
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
})

View File

@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test'
test('事件触发', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-select-panel#event')
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.locator('.black').click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '取消' }).click()
})

View File

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test'
test('历史记录', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-select-panel#history')
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.locator('.black').click()
await page.getByRole('button', { name: '选择' }).click()
await page.getByRole('button', { name: 'Append history color' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '历史记录' }).click()
await page.getByRole('button', { name: 'Pop history color' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '历史记录' }).click()
})

View File

@ -0,0 +1,25 @@
import { test, expect } from '@playwright/test'
test('预定义颜色', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('color-select-panel#predefine')
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.locator('.black').click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
await page.getByRole('button', { name: 'Append predefine color' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '预定义颜色' }).click()
await page.locator('.tiny-color-select-panel__predefine > div:nth-child(8)').click()
await page.getByRole('button', { name: 'Pop predefine color' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '预定义颜色' }).click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
await page.getByRole('button', { name: '选择' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '预定义颜色' }).click()
await page.getByRole('button', { name: 'Append predefine color' }).click()
await page.getByRole('button', { name: 'Show Color select panel' }).click()
await page.getByRole('button', { name: '预定义颜色' }).click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('裁剪框宽高比', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#aspect-ratio')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.icon').first().click()
await page.locator('.iconButton > .tiny-svg').first().click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(7) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
})

View File

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test'
test('自动裁剪面积', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#auto-crop-area')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.icon').first().click()
await page.locator('.icon').first().click()
await page.locator('.iconButton > .tiny-svg').first().click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(7) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('基本用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#basic-usage')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg > .st0').click()
})

View File

@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test'
test('裁剪框方法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#crop-meth')
await page.getByRole('link', { name: '裁剪框方法 事件' }).click()
await page.getByRole('button', { name: '启用裁剪框' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(2)').click()
await page.locator('.icon').first().click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg > .st0').click()
})

View File

@ -5,7 +5,7 @@
:cropvisible="visible"
@update:cropvisible="visible = $event"
:src="imgUrl"
:movable="false"
:movable="true"
drag-mode="move"
></tiny-crop>
</div>

View File

@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test'
test('拖拽模式', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#drag-mode')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
const crops = page.locator('#drag-mode').getByRole('img').nth(1).boundingBox()
const { x, y } = await crops
// 开始拖拽
await page.mouse.move(x, y)
await page.mouse.down()
await page.mouse.move(x + 50, y - 100)
await page.mouse.move(x - 50, y + 150)
await page.mouse.up()
})

View File

@ -5,7 +5,7 @@
:cropvisible="visible"
@update:cropvisible="visible = $event"
:src="imgUrl"
:movable="false"
:movable="true"
drag-mode="move"
></tiny-crop>
</div>

View File

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test'
test('裁剪相关事件', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#event-about-crop')
await page.getByRole('button', { name: '获取Canvas数据' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(7) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('ready 事件', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#event-ready')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(9)').click()
await page.getByRole('button', { name: '销毁 cropper' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.icon').first().click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
})

View File

@ -0,0 +1,18 @@
import { test, expect } from '@playwright/test'
test('获取容器数据', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#get-container-data')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(4)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(9)').click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '获取容器数据' }).click()
})

View File

@ -0,0 +1,13 @@
import { test, expect } from '@playwright/test'
test('获取剪切框数据', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#get-crop-box-data')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(3) > .icon > path:nth-child(2)').click()
await page.locator('div:nth-child(3) > .icon > path:nth-child(2)').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(8)').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '获取裁剪框数据' }).click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('获取裁剪后的图片数据', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#get-cropped-canvas')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '获取裁剪后的图片数据' }).click()
})

View File

@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test'
test('获取裁剪后的图片数据', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#get-data')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '获取裁剪区域数据' }).click()
await page.getByRole('button', { name: '清除裁剪区域数据' }).click()
await page.getByRole('button', { name: '获取裁剪区域数据' }).click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('获取图像数据', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#get-image-data')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(9)').click()
await page.getByRole('button', { name: '获取图像数据' }).click()
})

View File

@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test'
test('裁剪框最小宽高', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#min-crop-box-width-height')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg > .st0').click()
})

View File

@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test'
test('不显示网格背景', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#no-background')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(8)').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
})

View File

@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test'
test('不显示虚线', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#no-guides')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
})

View File

@ -0,0 +1,10 @@
import { test, expect } from '@playwright/test'
test('不显示模态背景', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#no-modal')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.icon').first().click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
})

View File

@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test'
test('替换图片', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#replace-image')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(5)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(3) > .icon').click()
await page.locator('div:nth-child(9) > .tiny-svg > .st0').click()
await page.getByRole('button', { name: '替换图片' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
})

View File

@ -1,14 +1,20 @@
<template>
<div>
<tiny-button text="图片裁剪" @click="visible = !visible"></tiny-button>
<tiny-crop :cropvisible="visible" @update:cropvisible="visible = $event" :src="imgUrl" :view-mode="1"></tiny-crop>
<tiny-button text="切换模式" @click="changeMode"></tiny-button>
<tiny-crop :cropvisible="visible" @update:cropvisible="visible = $event" :src="imgUrl" :view-mode="num"></tiny-crop>
</div>
</template>
<script setup lang="jsx">
import { ref } from 'vue'
import { Button as TinyButton, Crop as TinyCrop } from '@opentiny/vue'
import { Button as TinyButton, Crop as TinyCrop, Modal } from '@opentiny/vue'
const visible = ref(false)
let num = ref(0)
const imgUrl = ref(`${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/mountain.png`)
function changeMode() {
num.value = Math.ceil(Math.random() * 3)
Modal.message({ message: '模式:' + num.value })
}
</script>

View File

@ -0,0 +1,31 @@
import { test, expect } from '@playwright/test'
test('视图模式', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#view-mode')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(6) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '切换模式' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(6)').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
await page.getByRole('button', { name: '切换模式' }).click()
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.locator('div:nth-child(7) > .tiny-svg').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(4) > .tiny-svg').click()
await page.locator('.tiny-crop__dialog-content__handle__button > div:nth-child(3)').click()
await page.locator('div:nth-child(3) > .icon').dblclick()
await page.locator('.icon').first().click()
await page.locator('.icon').first().click({
clickCount: 4
})
await page.locator('div:nth-child(8) > .tiny-svg').click()
await page.locator('div:nth-child(9) > .tiny-svg').click()
})

View File

@ -1,12 +1,13 @@
<template>
<div>
<tiny-button text="图片裁剪" @click="visible = !visible"></tiny-button>
<tiny-crop :cropvisible="visible" @update:cropvisible="visible = $event" :src="imgUrl" :view-mode="1"></tiny-crop>
<tiny-button text="切换模式" @click="changeMode"></tiny-button>
<tiny-crop :cropvisible="visible" @update:cropvisible="visible = $event" :src="imgUrl" :view-mode="num"></tiny-crop>
</div>
</template>
<script lang="jsx">
import { Button, Crop } from '@opentiny/vue'
import { Button, Crop, Modal } from '@opentiny/vue'
export default {
components: {
@ -15,9 +16,16 @@ export default {
},
data() {
return {
num: 0,
imgUrl: `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/mountain.png`,
visible: false
}
},
methods: {
changeMode() {
this.num = Math.ceil(Math.random() * 3)
Modal.message({ message: '模式:' + this.num })
}
}
}
</script>

View File

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test'
test('鼠标滚轮缩放图像时比例', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#wheel-zoom-ratio')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.mouse.wheel(100, 100)
await page.mouse.wheel(50, 50)
await page.locator('.cropper-face').click({
button: 'middle'
})
await page.locator('.cropper-face').click()
await page.locator('div:nth-child(5) > .tiny-svg').click()
await page.locator('div:nth-child(8) > .tiny-svg').click()
})

View File

@ -0,0 +1,10 @@
import { test, expect } from '@playwright/test'
test('禁用鼠标滚轮缩放图像', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('crop#zoom-on-wheel')
await page.getByRole('button', { name: '图片裁剪' }).click()
await page.mouse.wheel(100, 100)
await page.mouse.wheel(50, 50)
await page.locator('.cropper-face').click()
})