Skip to content

chore: fix-form-fields-tests#162

Merged
cerebrl merged 4 commits into
mainfrom
form-fields-tests
Mar 27, 2025
Merged

chore: fix-form-fields-tests#162
cerebrl merged 4 commits into
mainfrom
form-fields-tests

Conversation

@ryanbas21
Copy link
Copy Markdown
Collaborator

JIRA Ticket

https://pingidentity.atlassian.net/browse/SDKS-3657?atlOrigin=eyJpIjoiODI5YWZmZTc5MGZlNDFiOGFkMDEyMGMzY2QwNDBlNDYiLCJwIjoiaiJ9

Description

Fixes the current form-fields tests. adds the required configuration to the server-config file.

We may want to adjust this in the tenant (which requires changes here) so that its known this is a test configuration in the tenant.

This test really just ensures that when we submit the required form fields, the request is sent and matches the correct schema when we send it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 12, 2025

⚠️ No Changeset found

Latest commit: 64c4723

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Mar 12, 2025

View your CI Pipeline Execution ↗ for commit 64c4723.

Command Status Duration Result
nx affected -t build typecheck lint test e2e-ci ✅ Succeeded 1m 31s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-03-27 05:38:54 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 12, 2025

Deployed 90c1fd1 to https://ForgeRock.github.io/ping-javascript-sdk/pr-162/90c1fd131cf7db8619611290ed24b7ddf8240376 branch gh-pages in ForgeRock/ping-javascript-sdk

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.59%. Comparing base (6c5ad9d) to head (64c4723).

Files with missing lines Patch % Lines
packages/davinci-client/src/lib/client.store.ts 0.00% 3 Missing ⚠️
packages/davinci-client/src/lib/node.reducer.ts 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (20.00%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
+ Coverage   44.92%   50.59%   +5.66%     
==========================================
  Files          33       24       -9     
  Lines        1538     1354     -184     
  Branches      186      177       -9     
==========================================
- Hits          691      685       -6     
+ Misses        847      669     -178     
Files with missing lines Coverage Δ
packages/davinci-client/src/lib/client.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/collector.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/collector.utils.ts 82.89% <100.00%> (ø)
packages/davinci-client/src/lib/davinci.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/types.ts 0.00% <ø> (ø)
packages/davinci-client/src/lib/node.reducer.ts 77.17% <0.00%> (ø)
packages/davinci-client/src/lib/client.store.ts 0.45% <0.00%> (ø)

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

['dropdown-field-key']: '',
['radio-group-key']: '',
'combobox-field-key': ['option1 value', 'option2 value'],
'checkbox-field-key': [],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i'm not rendering this because the data we have ends up with the same exact text / label for this and radio

and then we have to getByAll and index through it I think or filter them. we can do it I just chose not to.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These components i "wrote" with AI, so it did much of the heavy lifting. so excuse the blocks of code.

Copy link
Copy Markdown
Collaborator

@cerebrl cerebrl left a comment

Choose a reason for hiding this comment

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

I think much of this code written by AI needs to be deeply refactored. It seems to have mimicked how many people try to re-engineer native elements for various reasons that are usually not good ideas.

Comment on lines +47 to +65
// If this checkbox is being checked
if (target.checked) {
// Uncheck the previously selected checkbox if there was one
if (selectedCheckbox && selectedCheckbox !== target) {
selectedCheckbox.checked = false;
}

// Update the selected checkbox reference
selectedCheckbox = target;

console.log(event.target);
// Call the updater with the selected value
updater(target.value);
} else {
// If the user is trying to uncheck the selected checkbox,
// prevent that to maintain a selected state
target.checked = true;
}
});
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.

I'm a bit confused by this code. It seems there's a belief that this should act like a radio group? If so, that is incorrect as "checkbox", in this case is "multi-value".

Comment thread e2e/davinci-app/components/combobox.ts Outdated
};

// Populate dropdown with options
collector.output.options.forEach((option) => {
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.

Rather than all of this, I'd just recommend using the native <select multiple> option: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple.

Comment thread e2e/davinci-app/main.ts Outdated
) {
dropdownComponent(formEl, collector, davinciClient.update(collector));
} else if (collector.type === 'SingleSelectCollector' && collector.input.type === 'RADIO') {
checkboxComponent(formEl, collector, davinciClient.update(collector));
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.

If the type is RADIO, why are we using "checkbox"?

Comment on lines +17 to +27
await page.getByRole('checkbox', { name: 'option2 label' }).check();
await page.getByRole('checkbox', { name: 'option3 label' }).check();
await page.getByRole('checkbox', { name: 'option2 label' }).check();
await page.getByRole('button', { name: 'Select options ▼' }).click();
await page.locator('[id="combobox-field-key-option-option1\\ value"]').check();
await page.locator('[id="combobox-field-key-option-option2\\ value"]').check();
await page.locator('[id="combobox-field-key-option-option3\\ value"]').check();
await page.locator('[id="combobox-field-key-option-option1\\ value"]').uncheck();
await page.locator('[id="combobox-field-key-option-option3\\ value"]').uncheck();
await page.locator('[id="combobox-field-key-option-option1\\ value"]').check();
await page.getByRole('button', { name: 'Apply' }).click();
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.

I think if we switch to a native element, that would clean this up quite a bit.

@cerebrl cerebrl force-pushed the form-fields-tests branch 2 times, most recently from cef7fd7 to 1ef084c Compare March 27, 2025 05:33
@cerebrl cerebrl force-pushed the form-fields-tests branch from 1ef084c to 64c4723 Compare March 27, 2025 05:36
@cerebrl cerebrl merged commit 3b420a6 into main Mar 27, 2025
3 checks passed
@cerebrl cerebrl deleted the form-fields-tests branch March 27, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants