-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(button): added unit tests #433
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
🔥🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work man, so many test cases you did.
There is one doubt for "Only icon" story, otherwise looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Please, before merging, edit the PR title so once it is squashed and merged it is in small caps: test(button): adding unit tests
import { test } from 'stencil-playwright'; | ||
import { expect } from '@playwright/test'; | ||
|
||
const componentName = 'basic'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Is this a common practice, or more a personal style :)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally personal style :)
Like for now with dropdown I do this
const componentTestPath = 'src/components/dropdown/test/default/index.html';
and then
await page.goto(componentTestPath);
Its just so I don't have to update the await page.goto(componentTestPath);
every time I copy a testcase :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would still need to decide on what approach to take :) Or we just do whatever Martin proposed. I think it all works. I also tried beforeEach
test but that did not work with spying on clicks and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to componentTestPath because I think its a bit more clear on what is happening and less text. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I think we in the team should decide on what approach we want to take. I don't know what Martin proposed. I think we are just now starting out to test so maybe we should have that talk soon. So we create some common ways of doing things. We have the "How we test" in IXIB-book. And then, some things will always be a personal style and that is totally fine I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timrombergjakobsson Yes it looks like I'm following the IXIB-book in this PR.
It mentions nothing about how we would like to specify playwright page.goto path so I just did what made most sense to me but we might need to spend an hour to talk about it?
packages/core/src/components/button/test/secondary/button.e2e.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
* feat(button): add unit tests for basic and disabled button * test: button tests to check for colors and other things to find a good pattern * test: adding more tests for more test cases in button * test: small update to button tests * test: make sure disabled button has the correct cursor when disabled test * fix: update pr with button without text and icon and check for width * chore(all tests): update to componentTestPath instead of componentName * test(button): update test text to be correct after pr comment * test(button): update small text --------- Co-authored-by: Lindqvist Nathalie <nathalie.lindqvist@scania.com>
* test(button): added unit tests (#433) * feat(button): add unit tests for basic and disabled button * test: button tests to check for colors and other things to find a good pattern * test: adding more tests for more test cases in button * test: small update to button tests * test: make sure disabled button has the correct cursor when disabled test * fix: update pr with button without text and icon and check for width * chore(all tests): update to componentTestPath instead of componentName * test(button): update test text to be correct after pr comment * test(button): update small text --------- Co-authored-by: Lindqvist Nathalie <nathalie.lindqvist@scania.com> * test(message): added unit tests (#437) * test(message): added unit tests * fix: review update * test(button): refactor unit tests (#440) * test(button): updates all tests for less implementation details * test(button): update to better reflect how we should test * test(button): remove id from index on tests since its not used * test(dropdown): added unit tests (#435) * chore(dropdown): wip unit tests for no-result-text * test(dropdown): added tests * test(dropdown): updated tests after meeting to follow standards * test(dropdown): update so that label outside test work with also helpertext * test(dropdown): add some screenshot testing and update some test names * test(dropdown): update test to not use implementation details * test(dropdown): test correctly * test(dropdown): new tests for dropdown multiselect * test(dropdown): update all tests to have less implementation details * test(dropdown): update dropdown to use hidden and add basic dropdown * test(dropdown): update tests to be less implementation detail oriented --------- Co-authored-by: Default <alex.john.eneroth@gmail.om> * fix(chip): double click for radio type (#441) * fix(chip): set checked to true for radio * fix: mutable for checked prop * fix: throw error instead of warning * build(deps-dev): bump @adobe/css-tools in /packages/angular Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2. - [Changelog](https://github.com/adobe/css-tools/blob/main/History.md) - [Commits](https://github.com/adobe/css-tools/commits) --- updated-dependencies: - dependency-name: "@adobe/css-tools" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * test(textarea): added unit tests (#436) * test(textarea): adding unit tests * test(textarea): remove hydrated class check from tests * test(textarea): update tests with some comments on all the expect * test(textarea): update check on component to be truthy * test(textarea): update after pr comments * test(textarea): remove test for filling or clicking readonly textarea since it does not work * test(textarea): updates after reading article * test(textarea): added basic test and also update test to use getByRole * test(textarea): added screenshot for when adding text to textarea * test(textarea): add tests for label and update some screenshot names * fix(popover-core): show prop read on an initial load (#439) * fix(textarea): remove only on tests read-only textarea (#443) * test(table): added unit tests (#438) * test(table): added unit tests * test(table): added a bunch more unit tests * test(table): change toBeTruthy to toHaveCount instead * test(table): update all tests to follow less implementation details * test(table): update tests to reflect hidden * chore: typo correction just to trigger SonarCloud * test(table): rename basic to default * test(table): update name of test in multiselect --------- Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> * fix(css): headline-05 updated to correct value (#445) * fix(css): headline-05 updated to correct value * fix(headline-05): updated typography in tegel * fix(message): updated storybook to now have two mode-variant (#446) * feat(dropdown): added support for normalized text when searching (#444) * feat(dropdown): added support for normalized text when searching * test(dropdown): move some files around * fix(dropdown: filter): line height increase --------- Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> * docs(table): added tds-table-body to the filtering and pagination (#447) * feat(css): update from rem to px on utility classes (#448) * Release of @scania/tegel@1.3.2 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alfred Skedebäck <alfred.skedeback@umain.com> Co-authored-by: Lindqvist Nathalie <nathalie.lindqvist@scania.com> Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> Co-authored-by: Default <alex.john.eneroth@gmail.om> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: theJohnnyMe <theJohnnyMe@users.noreply.github.com>
Describe pull-request
Followed the test steps in ticket/excel to test.
Solving issue
Fixes: CDEP-2961
How to test
npm run test
in core to run the tests. Make sure they run.Additional context
I'm not sure how we would like to check for colors on the button, but this way I found works for me.
I'm 100% sure I missed some tests and that some tests dont make sense. But they all run and will break if something changes on the button that is changing.
We are still in exploration for good testing.