feat(core): added code to handle keyboard inputs (#4006)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Priyansh Gupta
2023-08-31 23:45:55 +05:30
committed by GitHub
parent 6be176b4e3
commit 18d5a99af5
4 changed files with 111 additions and 21 deletions

View File

@@ -20,6 +20,39 @@ test('Open settings modal', async ({ page }) => {
await expect(modal).toBeVisible();
});
test('change language using keyboard', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await openSettingModal(page);
const locator = page.getByTestId('language-menu-button');
const oldName = await locator.textContent();
await locator.click();
await page.waitForTimeout(200);
await page.keyboard.press('ArrowDown', {
delay: 50,
});
await page.keyboard.press('Enter', {
delay: 50,
});
{
const newName = await locator.textContent();
expect(oldName).not.toBe(newName);
}
await locator.click();
await page.waitForTimeout(200);
await page.keyboard.press('ArrowUp', {
delay: 50,
});
await page.keyboard.press('Enter', {
delay: 50,
});
{
const newName = await locator.textContent();
expect(oldName).toBe(newName);
}
});
test('Change theme', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);