This repository was archived by the owner on Nov 6, 2020. It is now read-only.
chore: improve cypress implementation after introduction to project#134
Merged
Mohammer5 merged 3 commits intofeat/ui-core-input-counterpartsfrom Dec 3, 2019
Merged
Conversation
HendrikThePendric
approved these changes
Dec 3, 2019
HendrikThePendric
added a commit
that referenced
this pull request
Dec 12, 2019
* refactor(radio-group): match ui-core implementation * refactor(checkbox): adjust to new API in ui-core * feat: checkbox-group radio-group and switch-group plus project structure * chore(email-validator): rename email validator * fix: align with changes in ui-core v4.0.0 * feat: extract logic from checkbox into toggle and introduce switch * feat(input): introduce input component and story * feat(text-area): introduce component and stories * chore(file-input): cherry pick file-input work - part 1 * chore(file-input): cherry pick file-input work - part 2 * fix(file-input): align with ui-core v4.0.0 * fix(file-input): remove undefined imported variable * fix(file-input): prevent prop error by returning undefined, not false * chore(toggle-group): fix ESLint violation and remove console.log * chore(array-transformer): remove log statement * feat(single-select): introduce SingleSelect component and story * feat(multi-select): introduce MultiSelect component and stories * refactor(toggle-group): implement as functional component * docs: remove note about known issues that have been resolved by now * refactor: form-decorator Moved to the `./.storybook` folder Switched to logging values directly, which is good for non-serializable things, such as File instances * refactor: simplify code base - Stop using Toggle components to extract shared logic because it gets hard to reason about all these nested components - Implement shared hooks and propTypes to replace Toggle components - Update Checkbox/Switch(Group) to work with these shared hooks and proptypes - Remove `useOnChange` prop from FieldAdapter component, because this way of working is also hard to reason about - Refactor Checkbox and Switch to now implement onChange logic internally instead of delegating it to the FieldAdapter * fix: make sure all components work without a transformer on the field * fix(multi-select): use correct prop definition (is already an array) * fix(multi-select): simplify render function and handle optional options * refactor(multi-select): use plural noun for array * chore(deps): upgrade to ui-core 4.0.0 * fix(multi-select): prevent prop validation error when value is empty * refactor: make prop required in component module, not in shared prop * fix(single-select): ensure options is always array and simplify render * fix(email validator): remove required check * fix(switch-group): remove SwitchGroup component * refactor: implement hooks as helpers * chore(deps): upgrade ui-core to 4.0.1 to fix button errors * fix(multi-select): adjust prop-types to prevent error * refactor(file-input): implement as functional component * refactor: remove field-adapter and replace with normalize-props helper * fix: correct broken import * chore(field): add propTypes * chore(deps): remove redundant classnames package and move jest to dev * chore: add testing stories and enable testing it * chore: enable testing stories * chore: add form testing story * fix: use correct repository and translation namespace * chore(testing form): add text area to form testing story * chore: setup cypress (#133) * chore(cypress): add basic setup * chore(cypress): tweak cypress setup so it actually works * test(checkbox): try to make initial test pass * test(checkbox): fix initial feature and test * chore(eslint): format .eslintrc.js * refactor: use named function in testing story form-spy * fix: expose all react-final-form exports * fix(testing-story): tweak so we can do without useFormState * chore: improve cypress implementation after introduction to project (#134) * chore(cypress config): remove baseUrl, already set in scripts * chore(checkbox test): make sure checkbox is not checked initially * chore(visit story helper): replace colon with nothing * chore(file-input): add tests (#136) * chore(cypress file upload): provide helper commands * chore(form testing story): add single- and multie-file inputs * test(file input): add test for single & multiple files * fix: use storybook helper for getting the story id * test: complete checkbox test and introduce shared submit step * refactor: create helpers for common storybook and cypress operations * fix: improve form-decorator so form values include initial values * fix: use null as value for unchecked checkbox with value prop Previously we were using '' but this clears the form values property when the checkbox is unchecked by the user and this could be problematic, because upon submission it looks like the field has not been interacted with * test(checkbox): add additional feature+test and use dedicated test story * chore: fix feature file capitalization * chore: remove checkbox folder to remove duplicates from remote * chore: restore checkbox folder and duplicates be gone * test: add component tests (#146) * chore(storybook form decorator): add forceUpdate api when testing * chore(cypress common steps): rename shared to common & remove imports * chore(checkbox tests): remove unnecessary tests * chore(checkbox error test): rename "And" to "When" * chore(single select): add testing story * test(single select): add tests for selecting and error * chore(cypress support): add "getFormValue" helper * chore(cypress support): add "selectMultiSelectNthOption" helper * chore(multi select): add testing story * chore(cypress support): repurpose helper to select both select's options * chore(multi select): add tests for chaning the value and error display * chore(input): add testing story * test(input): add tests for typing and error * chore(input): remove unnecessary cypress common folder * chore(text area): add testing stories * test(text area): add tests for typing and error * chore(form decorator): render spy after children * chore(checkbos): use cypress helper to test form value * chore(switch): add testing stories * test(switch): add tests for typing and error * chore(checkbox group): add testing story * chore(radio group): add testing story * test(checkbox group): add tests for typing and error * test(radio group): add tests for typing and error * test(switch): add tests for boolean values * test(checkbox): add tests for boolean values * refactor: fix form-decorator by using the normal component lifecycle * refactor: use single formDecorator and update logic in stories + tests * chore: fix cypress eslint config * chore: fix typos in checkbox-group feature * fix: amend checkbox group step description to indicate requiredness * chore: fix step description in file input feature * chore: fix file-input step descriptions and remove redundant code * chore: add prefix to input testing story * chore: fix various option vs options typos in step descriptions * chore: simplify input/textarea can set a value test * chore: explain the field is required in multi-select test steps * chore: stop logging to the console in multi-select test * chore: fix test step typo for single options * chore: fix typo in radio-group feature file * chore: adjust radio-group step description to two options * chore: explain the field is required in radio-group test steps * chore: explain the field is required in single-select test steps * fix(form-decorator): remove typo from clear-cypress-props * fix: improve feature step text when user types in inputs * fix: improve create-default-change-handler logic - Throw an error if the payload cannot be processed - Make sure to check for the existence of properties instead of evaluating they are thruthy * fix: align single-select and multi-select selected options with ui-core
dhis2-bot
added a commit
that referenced
this pull request
Feb 13, 2020
# 1.0.0 (2020-02-13) ### Bug Fixes * **deps:** move @dhis2/props-types back to dependencies ([#156](#156)) ([9354cbc](9354cbc)) * **deps:** set dependencies provided by app-platform to peerDeps ([#152](#152)) ([db38005](db38005)) * force the optimize for speed flag for styled-jsx based on env ([5626711](5626711)) * force the optimize for speed flag for styled-jsx to true ([71183c1](71183c1)) * **conditional:** use render instead of onChange to have access to form ([615488d](615488d)) * **file:** show name of selected file ([d622b34](d622b34)) ### Features * add composeValidators & required and email validator functions ([9d6ec6a](9d6ec6a)) * add confitional HOC ([e677b7b](e677b7b)) * add File component ([308335f](308335f)) * add Form component & mutators ([2b0ba72](2b0ba72)) * add Radio and RadioGroup & update stories ([b93ce20](b93ce20)) * add required validator ([a7a5c37](a7a5c37)) * apply conditional HOC to File ([8559f28](8559f28)) * introduce counterparts for ui-core form components ([#108](#108)) ([9dbeb29](9dbeb29)), closes [#133](#133) [#134](#134) [#136](#136) [#146](#146) * synchronous validators ([#164](#164)) ([75cd2ea](75cd2ea)) * **conditional:** conditional as a regular component ([#16](#16)) ([8f6eae7](8f6eae7))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've made some small improvements. I think the most important one is to make sure that the checkbox is unchecked before the test checks it (otherwise we might get false positives, if the checking isn't working but the checkbox is checked initially)