Skip to content

feat(doAndDontBlock): cypress to vitest GCM-209#1377

Open
benfrontify wants to merge 5 commits into
mainfrom
feat(do-and-dont)--migrate-tests-to-Vitest-GCM-209
Open

feat(doAndDontBlock): cypress to vitest GCM-209#1377
benfrontify wants to merge 5 commits into
mainfrom
feat(do-and-dont)--migrate-tests-to-Vitest-GCM-209

Conversation

@benfrontify

Copy link
Copy Markdown
Contributor

No description provided.

@benfrontify benfrontify requested a review from a team as a code owner June 17, 2026 09:57
@benfrontify benfrontify requested a review from silviojaeger June 17, 2026 09:57
@benfrontify benfrontify marked this pull request as draft June 17, 2026 09:59
@benfrontify benfrontify requested review from Copilot and removed request for silviojaeger June 17, 2026 09:59
@benfrontify benfrontify marked this pull request as ready for review June 17, 2026 12:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Dos & Don’ts block tests from Cypress component tests to Vitest + Testing Library, while doing a small refactor to centralize theme color fallback logic.

Changes:

  • Replaces DosDontsBlock.spec.ct.tsx (Cypress CT) with DosDontsBlock.spec.tsx (Vitest/Testing Library).
  • Updates dos-donts-block package config/deps to remove Cypress and add Vitest/Testing Library.
  • Refactors theme color defaulting into a helper (getThemeColorOrDefault) to reduce duplication.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates lockfile for removed Cypress and added Vitest/Testing Library dependencies.
packages/dos-donts-block/tsconfig.json Removes Cypress types and switches TS types to Testing Library jest-dom.
packages/dos-donts-block/src/DosDontsBlock.tsx Extracts theme color lookup/fallback into a helper to reduce repeated logic.
packages/dos-donts-block/src/DosDontsBlock.spec.tsx Adds new Vitest/Testing Library test suite for the block.
packages/dos-donts-block/src/DosDontsBlock.spec.ct.tsx Removes Cypress component tests for this block.
packages/dos-donts-block/package.json Removes Cypress devDependency; adds Vitest and Testing Library deps for this package.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +29
const [DosDontsBlockWithStubs] = withAppBridgeBlockStubs(DosDontsBlock, {
blockSettings: { columns: 2 },
}) as [React.ComponentType, unknown];

Comment on lines +137 to +143
const image = screen.queryByTestId(DO_DONT_IMAGE);
if (image) {
expect(image.getAttribute('alt')).toBe('Alt text');
} else {
expect(screen.getByTestId(DOS_DONTS_BLOCK)).toBeTruthy();
}
});
Comment on lines +189 to +201
if (!firstEditor) {
return;
}

await user.dblClick(firstEditor);
await user.type(firstEditor, 'This is an example do description.');
await user.keyboard('{Control>}a{/Control}');

const linkButton = document.querySelector(FLOATING_LINK_BUTTON);
if (!linkButton) {
return;
}
await user.click(linkButton);
Comment on lines +225 to +237
if (!firstEditor) {
return;
}

await user.dblClick(firstEditor);
await user.type(firstEditor, 'This is an example do description.');
await user.keyboard('{Control>}a{/Control}');

const buttonPlugin = document.querySelector(FLOATING_BUTTON_BUTTON);
if (!buttonPlugin) {
return;
}
await user.click(buttonPlugin);
Comment thread packages/dos-donts-block/package.json Outdated
Comment on lines +45 to +47
"tailwindcss": "^3.4.17",
"typescript": "^6.0.2"
"typescript": "^6.0.2",
"vitest": "^4.1.7"

render(<DosDontsBlockWithStubs />);

expect(screen.getByTestId(DOS_DONTS_ADD_BUTTONS)).toBeTruthy();

render(<DosDontsBlockWithStubs />);

expect(screen.getByTestId(DOS_DONTS_ADD_BUTTONS)).toBeTruthy();
Comment thread packages/dos-donts-block/package.json Outdated
"tailwindcss": "^3.4.17",
"typescript": "^6.0.2"
"typescript": "^6.0.2",
"vitest": "^4.1.7"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"vitest": "^4.1.7"
"vitest": "^4.1.9"

Always use latest and it would be nice if you could bump it as well in all other package.json

export const DO_COLOR_DEFAULT_VALUE = { red: 0, green: 200, blue: 165, alpha: 1 };
export const DONT_COLOR_DEFAULT_VALUE = { red: 255, green: 55, blue: 90, alpha: 1 };

const getThemeColorOrDefault = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is not related to changing the test to vitest

@ragi96 ragi96 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Merge main into it first

@benfrontify benfrontify force-pushed the feat(do-and-dont)--migrate-tests-to-Vitest-GCM-209 branch from f3ed0ed to 260082c Compare June 22, 2026 13:20
@benfrontify

Copy link
Copy Markdown
Contributor Author

my tests passed, dose this come from my code?

@benfrontify benfrontify requested a review from ragi96 June 22, 2026 14:04
@ragi96

ragi96 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

my tests passed, dose this come from my code?

Looks like the pnpm-lock got corrupted

@@ -6,10 +6,22 @@ import { THEME_PREFIX } from '@frontify/guideline-blocks-settings';
export const DO_COLOR_DEFAULT_VALUE = { red: 0, green: 200, blue: 165, alpha: 1 };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

unrelated changes, only to cypress to vitest

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