Skip to content

Commit 4ed4cf4

Browse files
committed
test: enhance toggle activation checks in snippets list page
1 parent 3ce41d5 commit 4ed4cf4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/e2e/code-snippets-list.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,25 @@ test.describe('Code Snippets List Page Actions', () => {
2828

2929
await expect(toggleSwitch).toHaveAttribute('title', 'Deactivate')
3030

31+
// Check that the toggle is rendered to the right (active)
32+
const activeTransform = await toggleSwitch.evaluate(el => {
33+
return window.getComputedStyle(el, '::before').transform
34+
})
35+
expect(activeTransform).not.toBe('none')
36+
3137
await toggleSwitch.click()
3238
await page.waitForLoadState('networkidle')
3339

3440
const updatedRow = page.locator(`tr:has-text("${TEST_SNIPPET_NAME}")`)
3541
const updatedToggle = updatedRow.locator('a.snippet-activation-switch')
3642
await expect(updatedToggle).toHaveAttribute('title', 'Activate')
3743

44+
// Check that the toggle is rendered to the left (inactive)
45+
const inactiveTransform = await updatedToggle.evaluate(el => {
46+
return window.getComputedStyle(el, '::before').transform
47+
})
48+
expect(inactiveTransform).toBe('none')
49+
3850
await updatedToggle.click()
3951
await page.waitForLoadState('networkidle')
4052

0 commit comments

Comments
 (0)