Set up end-to-end tests (#85)
This commit is contained in:
parent
3c369b435e
commit
d0965d17e4
22 changed files with 1470 additions and 108 deletions
13
packages/playground/src/tests/setting-static-props/index.tsx
Normal file
13
packages/playground/src/tests/setting-static-props/index.tsx
Normal file
|
@ -0,0 +1,13 @@
|
|||
import studio from '@theatre/studio'
|
||||
import {getProject} from '@theatre/core'
|
||||
|
||||
studio.initialize({usePersistentStorage: false})
|
||||
|
||||
const project = getProject('sample project')
|
||||
const sheet = project.sheet('sample sheet')
|
||||
const obj = sheet.object('sample object', {
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
})
|
|
@ -0,0 +1,47 @@
|
|||
import {test, expect} from '@playwright/test'
|
||||
import percySnapshot from '@percy/playwright'
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
|
||||
test.describe('setting-static-props', () => {
|
||||
test.beforeEach(async ({page}) => {
|
||||
// Go to the starting url before each test.
|
||||
await page.goto('http://localhost:8080/tests/setting-static-props')
|
||||
})
|
||||
|
||||
test('Undo/redo', async ({page}) => {
|
||||
await page.locator('[data-testid="OutlinePanel-TriggerButton"]').click()
|
||||
|
||||
await page.locator('span:has-text("sample object")').first().click()
|
||||
|
||||
const detailPanel = page.locator('[data-testid="DetailPanel-Object"]')
|
||||
|
||||
const firstInput = detailPanel.locator('input[type="text"]').first()
|
||||
// Click input[type="text"] >> nth=0
|
||||
await firstInput.click()
|
||||
// Fill input[type="text"] >> nth=0
|
||||
await firstInput.fill('1')
|
||||
// Press Enter
|
||||
await firstInput.press('Enter')
|
||||
const secondInput = detailPanel.locator('input[type="text"]').nth(1)
|
||||
// Click input[type="text"] >> nth=1
|
||||
await secondInput.click()
|
||||
// Fill input[type="text"] >> nth=1
|
||||
await secondInput.fill('2')
|
||||
// Press Enter
|
||||
await secondInput.press('Enter')
|
||||
|
||||
const metaKey = isMac ? 'Meta' : 'Control'
|
||||
|
||||
// Press z with modifiers
|
||||
await page.locator('body').press(`${metaKey}+z`)
|
||||
await expect(firstInput).toHaveAttribute('value', '1')
|
||||
await expect(secondInput).toHaveAttribute('value', '0')
|
||||
await page.locator('body').press(`${metaKey}+Shift+z`)
|
||||
await expect(firstInput).toHaveAttribute('value', '1')
|
||||
await expect(secondInput).toHaveAttribute('value', '2')
|
||||
|
||||
// Our first visual regression test
|
||||
await percySnapshot(page, test.info().titlePath.join('/') + '/After redo')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue