Skip to content

Conversation

@sonic16x
Copy link
Contributor

@sonic16x sonic16x commented Oct 28, 2025

Before we had URL format for suite page:
suites/${testId}/${state}/${attempt}

and on visual checks page:
visual-checks/${imageId}/${attempt}

imageId here is testId + ' ' + state

I made common format:
${suites | visual-checks}/${hash}/${browser}/${attempt}/${state}

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

✅ Component tests succeed

Report

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

✅ E2E tests succeed

Report

@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-778.url-refactoring branch from e3afb87 to 007bb5e Compare October 28, 2025 12:16
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 28, 2025

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/html-reporter@731

commit: 1a73031

@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-778.url-refactoring branch 4 times, most recently from dc5409b to 101a293 Compare October 29, 2025 13:15
@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-778.url-refactoring branch from 101a293 to 12192fa Compare October 30, 2025 05:10
step.args[0] as string,
currentResult?.attempt?.toString() as string
].map(encodeURIComponent).join('/'));
if (step.type === StepType.Action && step.title === 'assertView') {
Copy link
Member

Choose a reason for hiding this comment

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

What does step.title === 'assertView' mean?
Why we didn't have this condition to navigate to suites page earlier and now we do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need it for case when we want to change state name in url by click to assertView step in suite page

return currentSuite.id + ' ' + params.browser;
}

return null;
Copy link
Member

Choose a reason for hiding this comment

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

nit: This return null is redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

return result?.imageIds.map(imageId => state.tree.images.byId[imageId]) ?? [];
};

export const getCurrentSuiteId = (params: Record<string, string | undefined>): ((state: State) => string | null) => {
Copy link
Member

Choose a reason for hiding this comment

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

I dont like how "getCurrentSuiteId" returns currentSuite.id + ' ' + params.browser
If its "getCurrentSuiteId", it should only return "currentSuite.id"
If it returns currentSuite.id + ' ' + params.browser, it should not be called "getCurrentSuiteId"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change selector name to getCurrentBrowserId, in our tree and state browserId = suiteId + browserName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, I had bad naming, change all suiteId to currentBrowserId for screenshots page, in suite page we have valid naming

Comment on lines 62 to 65
const currentTreeNodeId = useMemo(
() => [currentImageSuiteId, currentImageStateName].join(' '),
[currentImageSuiteId, currentImageStateName]
);
Copy link
Member

Choose a reason for hiding this comment

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

Whats the point of "useMemo" here?
Since its just a string and they are immutable, you wouldn't get any benefits from it being the same instance ("foo" === "foo")
I think, useMemo overhead is way more than just joining 2 strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 19 to 21
export const getCurrentImageSuiteHash = (state: State): string | null => (
state.tree.suites.byId[state.tree.browsers.byId[state.app.visualChecksPage.suiteId || '']?.parentId || '']?.hash
);
Copy link
Member

Choose a reason for hiding this comment

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

So, you already have "suiteId" from "state.app.visualChecksPage.suiteId", but you are using it as a key to "state.tree.browsers.byId", which implies its browserId?

Then it should not be named "suiteId"

Also, it would be way more readable, if it would be written like this:

const suiteId = state.app.visualChecksPage.suiteId;
const browser = state.tree.browsers.byId[suiteId]; // Accessing browser by suiteId???
const suiteId = browser?.parentId || '' // Also suiteId?

return state.tree.suites.byId[suiteId].hash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 8 to 12
if (pathname.startsWith(PathNames.suites)) {
return Page.suitesPage;
}

return Page.suitesPage;
Copy link
Member

Choose a reason for hiding this comment

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

Redundant check: whats the point of "pathname.startsWith(PathNames.suites)", if we return "Page.suitesPage" in both cases?

I would write this function like this:

return pathname.startsWith(PathNames.visualChecks) ? Page.visualChecksPage : Page.suitesPage;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 20 to 24
if (page === Page.suitesPage) {
return PathNames.suites;
}

return PathNames.suites;
Copy link
Member

Choose a reason for hiding this comment

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

Redundant check: whats the point of "page === Page.suitesPage", if we return "PathNames.suites" in both cases?

I would write this function like this:

return page === Page.visualChecksPage ? PathNames.visualChecks : PathNames.suites;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-778.url-refactoring branch from 2421dff to 620cf1c Compare November 16, 2025 09:02
@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-778.url-refactoring branch from 620cf1c to 1a73031 Compare November 16, 2025 09:09
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.

3 participants