Skip to content

feat(visual-checks-sidebar): add sidebar for visual checks page - #682

Merged
shadowusr merged 8 commits into
masterfrom
users/rocketraccoon/TESTPLANE-403.visual-check-sidebar
Jul 15, 2025
Merged

shadowusr merged 8 commits into
masterfrom
users/rocketraccoon/TESTPLANE-403.visual-check-sidebar

Conversation

@sonic16x

Copy link
Copy Markdown
Contributor

No description provided.

@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch from 125b094 to c004ff3 Compare June 29, 2025 15:37
@github-actions

Copy link
Copy Markdown

✅ Testplane run succeed

Report

@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch 4 times, most recently from 4d6a012 to 0bc95f8 Compare June 30, 2025 09:05
@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch from 0bc95f8 to bf2dd96 Compare June 30, 2025 09:09
rocketraccoon and others added 3 commits July 3, 2025 14:23
@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch from 3ef5159 to fba4ac8 Compare July 4, 2025 09:34

@shadowusr shadowusr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Считаю, что получилось отлично как с точки зрения UX, так и в плане рефакторинга, класс!

В целом всё ок, протестировал локально — всё работает.

После фикса замечаний можно вливать.
Ещё предлагаю написать хотя бы какие-то тесты на новую функциональность, т.к. без написания тестов размер техдолга лишь растет. Можно написать несколько e2e на критические сценарии и несколько юнитов. К тому же тесты нередко подсказывают, как можно лучше написать код. Плюс тесты довольно неплохо можно нагенерить нейронкой.

Также из-за не работающего CI обязательно надо прогнать все проверки локально.

Comment thread lib/static/modules/reducers/filters.ts Outdated
filteredBrowsers?: BrowserItem[];
}

const updateAppState = (state: State, page: Pages, data: FilterData): State => (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Точно ли нам нужен тут доп. хелпер, если у нас уже есть applyStateUpdate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С ним удобее, т.к. везде app меняется, но добавил использование applyStateUpdate внутри него

Comment thread lib/static/modules/reducers/filters.ts Outdated
}

const newState = {
...state,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот тут тоже все эти ...state по идее уйдут, если заюзать applyStateUpdate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переделал на applyStateUpdate

Comment thread lib/static/modules/reducers/filters.ts Outdated
}
};

if (window.location.hash === 'visual-checks-page') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хммм, а как это может работать? Открываю произвольный отчет, урл такой:

http://localhost:8000/new-ui?browser=chrome-desktop%3A138.0&browser=chrome-123%3A123.0&switched-from-old-ui=1#/visual-checks
Image

Плюс в else считать, что мы в suitesPage не стоит, мы добавим новые страницы

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да тут косяк был, поправил, проверка хэша в редюсере наверноен е самое лучшее решение, но алтернатива только прокидывать page для этих экшенов + выше мы похожим способом уже читаем из урла параметры


const sectionSizes = localStorageWrapper.getItem(SECTION_SIZES_LOCAL_STORAGE_KEY, [MIN_SECTION_SIZE_PERCENT, 100 - MIN_SECTION_SIZE_PERCENT]) as number[];
const suitesSectionSizes = localStorageWrapper.getItem(
`${SECTION_SIZES_LOCAL_STORAGE_KEY}-${Pages.suitesPage}`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут конечно как будто нужен хелпер для генерации такой строки. легко будет поменять этот ключ в одном месте и забыть про другое...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал

"lib/*": ["../../../../lib/*"],
"@/*": ["../../../../lib/*"]
"@/*": ["../../../../lib/*"],
"@gravity-ui/uikit/unstable": ["../../../../node_modules/@gravity-ui/uikit/build/esm/unstable.d.ts"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А что без этого перестало работать? Странно, как оно раньше было...

Comment thread lib/static/modules/actions/filters.ts Outdated
import {Pages} from '@/static/new-ui/types/store';

interface FilterPayload<T>{
page: Pages;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можешь не править, но вот как раз из-за этого кажется что обычно лучше именовать enum'ы в единственном числе. Тогда тип будет логичнее выглядеть — page: Page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил)

disabled: boolean;
}

export function TabsSelect({list, value, onChange, disabled}: TabsSelectProps): ReactNode {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть ощущение, что название слишком общее — в чем разница RadioButton и TabsSelect? Кажется что это одно и то же, написанное разными словами... Думаю стоит отразить тут то, что это по сути компонент именно для фильтрации тестов. Но не критично

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обсудили в лс, пока так оставил

}
};

const onThreeItemClick = useCallback((item: TreeViewItemData, expanded: boolean) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опечатка — three->tree

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил

stats: Stats;
}

export const getVisualThreeViewData = createSelector(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже опечатка three->tree, проверь остальные места тоже, плз

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил

},
parentNode
};
}) as TreeNode[];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему тут пришлось кастить? Вижу, что формат в map довольно обширный, но никак вроде не тайпчекается, может добавить satisfies или explicit return type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил

@shadowusr

Copy link
Copy Markdown
Member

Еще заметил момент, что у нас в TreeView осталась логика специфичная для suites:

@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch from 7de189d to 81b5f87 Compare July 14, 2025 12:43

@shadowusr shadowusr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В целом всё ок. PR замечательный. Критичных замечаний у меня не осталось.

Comment thread lib/static/modules/reducers/filters.ts Outdated
}
};

switch (window.location.hash) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так, а вот тут у нас идет строгий матчинг на #/suites... А это будет работать, если у нас конкретный тест выбран, там же хеш будет не только #/suites?

beforeEach(async ({browser}) => {
const menuItem = await browser.$('[data-qa="visual-checks-page-menu-item"]');
await menuItem.click();
await browser.pause(1000);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь и везде ниже: browser.pause, конечно, нежелательно использовать. Мы же тут хотим дождаться чего-то конкретного, может воспользоваться соответствующей функцией? (browser.waitUntil, waitForDisplayed). Но не критично

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут у нас получается нет тестов на новую логику про извлечение страницы из хеша и выставления соответствующего стейта. Кажется, что добавить было бы полезно и возможно как раз в тестах мы бы поймали кейс с #/suites/some-suite. Но на твое усмотрение


const list = await browser.$('[data-qa="tree-view-list"]');

await expect(list).toHaveChildren(3);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут конечно хотелось бы чуть больше тестов на этот функционал: какие именно это 3 элемента, отображение элементов в all, что должно случиться при клике на элемент, справа ведь должно отобразиться название скриншота, что должно случиться в gui с элементами при accept (остаться в failed/all), при undo. Т.е. отталкиваться от того, какое конечное поведение для юзера мы делаем. Может это может дешево нагенерить нейронка по аналогии.

Но на твое усмотрение. То, что появились тесты покрывающие хотя бы часть функционала — это супер!

@sonic16x
sonic16x force-pushed the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch from 31a992a to 53d181f Compare July 15, 2025 09:38
@shadowusr
shadowusr merged commit dd3da05 into master Jul 15, 2025
@sonic16x
sonic16x deleted the users/rocketraccoon/TESTPLANE-403.visual-check-sidebar branch July 15, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants