mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 07:29:42 +02:00
test: COD-30 stabilize focused test suites
This commit is contained in:
@@ -5,16 +5,22 @@ import { PORTS, KEYBOARD, SELECTORS, BODY_CLASSES, WAIT } from './helpers/consta
|
||||
import { createTestServer, stopTestServer } from './helpers/server.js';
|
||||
import { createDevicePage, getBrowser, closeAllBrowsers } from './helpers/browser.js';
|
||||
import {
|
||||
showKeyboard, hideKeyboard,
|
||||
showKeyboardViaCDP, hideKeyboardViaCDP,
|
||||
showKeyboardViaMock, hideKeyboardViaMock,
|
||||
showKeyboardViaDOM, hideKeyboardViaDOM,
|
||||
showKeyboard,
|
||||
hideKeyboard,
|
||||
showKeyboardViaCDP,
|
||||
hideKeyboardViaCDP,
|
||||
showKeyboardViaMock,
|
||||
hideKeyboardViaMock,
|
||||
showKeyboardViaDOM,
|
||||
hideKeyboardViaDOM,
|
||||
setupViewportMock,
|
||||
} from './helpers/keyboard-sim.js';
|
||||
import { getCDP, setVisualViewportHeight } from './helpers/cdp.js';
|
||||
import {
|
||||
assertHasClass, assertNotHasClass,
|
||||
assertVisible, assertHidden,
|
||||
assertHasClass,
|
||||
assertNotHasClass,
|
||||
assertVisible,
|
||||
assertHidden,
|
||||
getCSSProperty,
|
||||
} from './helpers/assertions.js';
|
||||
import { REPRESENTATIVE_DEVICES } from './devices.js';
|
||||
@@ -167,9 +173,7 @@ describe('Virtual Keyboard', () => {
|
||||
const success = await showKeyboardViaMock(page, KEYBOARD.TYPICAL_IOS_HEIGHT);
|
||||
expect(success).toBe(true);
|
||||
|
||||
const hasClass = await page.evaluate(() =>
|
||||
document.body.classList.contains('keyboard-visible'),
|
||||
);
|
||||
const hasClass = await page.evaluate(() => document.body.classList.contains('keyboard-visible'));
|
||||
expect(hasClass).toBe(true);
|
||||
} finally {
|
||||
await context.close();
|
||||
@@ -280,12 +284,13 @@ describe('Virtual Keyboard', () => {
|
||||
expect(mainPadding).toBe('');
|
||||
});
|
||||
|
||||
it('accessory bar has 7 action buttons', async () => {
|
||||
const count = await page.evaluate(() => {
|
||||
const buttons = document.querySelectorAll('.keyboard-accessory-bar [data-action]');
|
||||
return buttons.length;
|
||||
it('accessory bar has the simple-mode action buttons', async () => {
|
||||
const actions = await page.evaluate(() => {
|
||||
return Array.from(document.querySelectorAll('.keyboard-accessory-bar [data-action]')).map(
|
||||
(button) => (button as HTMLElement).dataset.action
|
||||
);
|
||||
});
|
||||
expect(count).toBe(7);
|
||||
expect(actions).toEqual(['scroll-up', 'scroll-down', 'init', 'clear', 'paste', 'dismiss']);
|
||||
});
|
||||
|
||||
it('double-tap confirm on /clear button', async () => {
|
||||
@@ -321,27 +326,6 @@ describe('Virtual Keyboard', () => {
|
||||
expect(text).toBe('Tap again');
|
||||
});
|
||||
|
||||
it('double-tap confirm on /compact button', async () => {
|
||||
await showKeyboard(page, KEYBOARD.TYPICAL_IOS_HEIGHT);
|
||||
await page.waitForTimeout(WAIT.KEYBOARD_ANIMATION);
|
||||
|
||||
await page.evaluate(`
|
||||
if (typeof app !== 'undefined') app.activeSessionId = 'test-session';
|
||||
`);
|
||||
|
||||
await page.evaluate(() => {
|
||||
const btn = document.querySelector('[data-action="compact"]') as HTMLElement;
|
||||
btn?.click();
|
||||
});
|
||||
await page.waitForTimeout(100);
|
||||
|
||||
const confirming = await page.evaluate(() => {
|
||||
const btn = document.querySelector('[data-action="compact"]');
|
||||
return btn?.classList.contains('confirming') ?? false;
|
||||
});
|
||||
expect(confirming).toBe(true);
|
||||
});
|
||||
|
||||
it('double-tap expires after 2s', async () => {
|
||||
await showKeyboard(page, KEYBOARD.TYPICAL_IOS_HEIGHT);
|
||||
await page.waitForTimeout(WAIT.KEYBOARD_ANIMATION);
|
||||
|
||||
Reference in New Issue
Block a user