Skip to content

Commit

Permalink
fix(SidePanel): avt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devadula-nandan committed Dec 5, 2024
1 parent 9663b22 commit 7817430
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions e2e/components/SidePanel/SidePanel-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ test.describe('SidePanel @avt', () => {
carbonTheme: 'white',
},
});
await page.getByText('Open side panel').click();
await expect(page).toHaveNoACViolations('SidePanel @avt-default-state');
});

Expand All @@ -31,7 +30,6 @@ test.describe('SidePanel @avt', () => {
carbonTheme: 'white',
},
});
await page.getByText('Open side panel').click();
await expect(page.getByText('Main view')).toBeVisible();
await page.getByText('View all').click();
await expect(page.getByText('Detail view')).toBeVisible();
Expand All @@ -47,7 +45,6 @@ test.describe('SidePanel @avt', () => {
carbonTheme: 'white',
},
});
await page.getByText('Open side panel').click();
await expect(page.getByLabel('Close')).toBeFocused();
await page.keyboard.press('Tab');
await expect(page.getByText('Copy')).toBeFocused();
Expand All @@ -66,7 +63,6 @@ test.describe('SidePanel @avt', () => {
carbonTheme: 'white',
},
});
await page.getByText('Open side panel').click();
await expect(page.getByLabel('Close')).toBeFocused();
await page.getByLabel('Close').click();
await expect(page.getByText('Open side panel')).toBeFocused();
Expand All @@ -82,8 +78,6 @@ test.describe('SidePanel @avt', () => {
},
});

// Open side panel
await page.getByText('Open side panel').click();
// Expect close button to be focused
await expect(page.getByLabel('Close')).toBeFocused();

Expand All @@ -92,5 +86,15 @@ test.describe('SidePanel @avt', () => {

// Expect the second input to be focus as the first input is disabled
await expect(page.locator('#side-panel-story-text-input-b')).toBeFocused();

// Expect focus to return to trigger button, on a closed panel
await page.keyboard.press('Escape');
await expect(
page.getByRole('button', { name: 'Open side panel' })
).toBeFocused();

// Move focus to first element, on an open panel
await page.getByRole('button', { name: 'Open side panel' }).click();
await expect(page.getByLabel('Close')).toBeFocused();
});
});

0 comments on commit 7817430

Please sign in to comment.