-
Notifications
You must be signed in to change notification settings - Fork 1
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/ Slider component interaction test #129
base: config/e2e-cypress
Are you sure you want to change the base?
Conversation
ํจ์ ๋ด๋ถ์์ getComputedStyle๋ฅผ ์ฌ์ฉํ์ฌ window์์ ํ์๋๋ ์คํ์ผ ๊ฐ์ผ๋ก ๋น๊ตํฉ๋๋ค.
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.
๊ณ ์ํ์ จ์ต๋๋ค~ ๋๋ฌด ์ ๊ธฐํด์
๊ทผ๋ฐ ์ ํ๊ฒฝ์์๋ ํ ์คํธ๊ฐ ๊ฐํ์ ์ผ๋ก ์คํจํด์. ์ปดํจํฐ ์ฑ๋ฅ์ ๋ฐ๋ผ ์ข ๊ฐ๋ฆฌ๋ ๊ฒ ๊ฐ๊ธด ํ๋ฐ(์ ๊ฐ ์์ ์ HDD์ ํ๊ณ ์์ด์ ใ ใ ..) ๋ชจ๋ ๊ฐ์ ์ง์ ์์ ์คํจํ๋๊ฑธ๋ก ๋ณด์ ์คํ ๋ฆฌ๋ฅผ ๋ถ๋ฌ์ค๋ ๊ฒ ์ค๋ ๊ฑธ๋ ค์ ํ์์์์ผ๋ก alias ์ ์๋ฅผ ๋ชปํ๋๋ด์. ์ฌ์ค ์ ์ปดํจํฐ์์ ์๋๋๊ฑด ์๊ด์ด ์๊ธด ํ๋ฐ ํน์ ํด๊ฒฐํ ๋ฐฉ๋ฒ์ด ์๋ ์ฐพ์๋ด์ผ๊ฒ ์ด์.
Error: AssertionError: Timed out retrying after 4000ms: Expected to find element: `#story--components-slider--start-from-end`, but never found it. Queried from:
> <body.sb-show-main.sb-main-fullscreen>
Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Start From End slider`
at Context.eval (webpack:///./cypress/support/commands.ts:7:0)
}); | ||
|
||
it('Increase with right arrow', () => { | ||
cy.get("@thumb").trigger('keydown', { keyCode : 39 }); |
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.
ํค๋ณด๋ ์ ๊ทผ์ฑ ๊ตฌํ์ ๋ง์ ์ปดํฌ๋ํธ์ ๋์ด ์์ผ๋ ์ด๊ฒ๋ constants๊ฐ์๊ฑธ๋ก ์ ์ํด์ ์ฐ๋ฉด ๊ด์ฐฎ์ง ์์๊น ํ๋ ์๊ฐ์ด ๋ค์ด์ ?ใ
?
์์ง ์ง์ ์์ฑํด๋ณด์ง ์์์ ๋ชจ๋ฅด๊ฒ ์ง๋ง์ ใ
ใ
..
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.
์ข์ ์๊ฒฌ์
๋๋ค.
์์ ๊ด๋ฆฌ๋ฅผ ์ด๋ป๊ฒ ํ ์ง ๋ ํผ๋ฐ์ค๋ฅผ ์ฐพ์๋ณผ๊ฒ์
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.
์ด๋ฏธ constants์ key๊ฐ ์ ์๋์ด ์์ด์ ๊ทธ๊ฑฐ ์ฌ์ฉํ๋ฉด ์ปดํฌ๋ํธ ์ฝ๋๋ ํต์ผ์ฑ ์ ์ง ๋ฉด์์๋ ์ข์ง ์์๊น์? ์ด๋ค ํ ์คํธ๊ฐ failํ์ ๋ ์ด๋ค ๋ถ๋ถ์ ํ์ธํด์ผ ํ๋์ง ์ถ์ ํ๊ธฐ ํธํ ๊ฒ ๊ฐ์์. keycode๋ deprecated property์ด๊ธฐ๋ ํด์ ์ฌ์ฉ ์ง์ํ๋๊ฒ ..ใ ใ !
cy.get('@slider').find(THUMB_ID).as('thumb'); | ||
} | ||
|
||
const shouldBeEqualPercentage = (dimension: FilledDimension, position: ThumbPosition) => { |
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.
์ด ํจ์๋ค์ async-await
์ ์ฌ์ฉํ๋ฉด ์๋๋ ๊ฑด๊ฐ์? ์๋๋ฉด then์ ์ฌ์ฉํ ์ฝ๋๊ฐ ๋ ์ข์ ์ด์ ๊ฐ ์๋ค๋๊ฐ?
์ ๊ฐ ์ฐ๊ณ ์ถ์ ๊ฑด ์๋๊ณ ํ
์คํธ ์ฝ๋๋ค์ ๋ณด๋ฉด ๋ค ์ด๋ฌ๋ ๊ฒ ๊ฐ์์์ ใ
ใ
..
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.
์ผ๋จ ๊ณต์ ๋ฌธ์์์๋ then ๋ฌธ๋ฒ๋ง ์ ์ํ๊ณ ์๊ณ
๋ณ๋๋ก async-await์ ์ ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ์๋ cypress-promise๋ฅผ ์ ์ฉํด์ผ ํ๋ ๊ฑธ๋ก ํ์
ํ์ด์.
API ์์ฒญ๋ ์์ด์ ๊ธฐ๋ณธ ๊ธฐ๋ฅ (์ผ๋ฐ ํจ์, alias) ๋ด์์ ์์ฑํ ์ ์์ ๊ฒ ๊ฐ์์ ์ค์นํ์ง ์์์ด์.
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.
๊ทผ๋ฐ ์ ๋ ์์ง ๋ค ํ์ ํ๊ฑด ์๋๋ผ์ ์ข์๊ฑฐ ์ฐพ์ผ์๋ฉด ์๋ ค์ฃผ์ธ์ ใ ใ ..
cypress/e2e/components/slider.cy.ts
Outdated
cy.getStory('slider', storyName).as('slider'); | ||
cy.get('@slider').find(TRACK_ID).as('track'); | ||
cy.get('@slider').find(FILLED_ID).as('filled'); | ||
cy.get('@slider').find(THUMB_ID).as('thumb'); |
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.
as('name')
์ผ๋ก ์ ์ธํ๋ฉด ๊ทธ ์ดํ์ ์ฝ๋์์ @name
์ด๋ผ๋ alias๋ก ์ฐธ์กฐํ ์ ์๋ ๊ฑฐ ๋ง๋์?
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.
๋ค ์ ํํฉ๋๋ค ๐๐๐
Timed out ๊ด๋ จ ๋ฌธ์ ๊ฐ ์๋ค์! ์์๋ณด๊ฒ ์ต๋๋ค ใ ใ |
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.
์ ์ปดํจํฐ์์๋ ์ฐ์ฌ๋์ด ๋ง์ํ์ ๊ฒ์ฒ๋ผ ํ๋ฒ์ฉ ํ
์คํธ ํต๊ณผ๊ฐ ์๋ผ์.. ๋งค๋ฒ ํต๊ณผ ์๋๋ ์ง์ ๋ ๋ฐ๋๋ค์.
์ค๋ฅ ๋ฉ์์ง๋ก ์ถ์ธกํด๋ดค์ ๋๋ ๋น๋๊ธฐ๋ก ๋์ํ๋ ๋ก์ง์ด ์์ ๋ณด์ฅ์ด ์๋ผ์ ํ
์คํธ ํต๊ณผ๊ฐ ๋์๋ค ์๋์๋ค ํ๋๊ฑฐ ๊ฐ์์
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.
์ ์ปดํจํฐ์์๋ ์ฐ์ฌ๋์ด ๋ง์ํ์ ๊ฒ์ฒ๋ผ ํ๋ฒ์ฉ ํ
์คํธ ํต๊ณผ๊ฐ ์๋ผ์.. ๋งค๋ฒ ํต๊ณผ ์๋๋ ์ง์ ๋ ๋ฐ๋๋ค์.
์ค๋ฅ ๋ฉ์์ง๋ก ์ถ์ธกํด๋ดค์ ๋๋ ๋น๋๊ธฐ๋ก ๋์ํ๋ ๋ก์ง์ด ์์ ๋ณด์ฅ์ด ์๋ผ์ ํ
์คํธ ํต๊ณผ๊ฐ ๋์๋ค ์๋์๋ค ํ๋๊ฑฐ ๊ฐ์์
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.
์คํํด๋ณด๋ ๋ค๋ฅธ ๋ถ๋ค์ด๋ ๊ฐ์ ์ด์๊ฐ ๋ฐ์ํ๊ธฐ๋ ํ๋๋ฐ, ์ ๋ฏผ๋ ๋ง์์ฒ๋ผ ๋น๋๊ธฐ ๋ก์ง๋ค์ ์์๊ฐ ๋ณด์ฅ๋์ง ์์์ ๊ทธ๋ฐ ๊ฒ ๊ฐ์์. ์ ๋ ๊ณต๋ถํด๋ณด๊ณ ๋ญ๊ฐ ๋ ์๊ฒ๋๋ฉด ๊ณต์ ํ ๊ฒ์!
}); | ||
|
||
it('Increase with right arrow', () => { | ||
cy.get("@thumb").trigger('keydown', { keyCode : 39 }); |
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.
์ด๋ฏธ constants์ key๊ฐ ์ ์๋์ด ์์ด์ ๊ทธ๊ฑฐ ์ฌ์ฉํ๋ฉด ์ปดํฌ๋ํธ ์ฝ๋๋ ํต์ผ์ฑ ์ ์ง ๋ฉด์์๋ ์ข์ง ์์๊น์? ์ด๋ค ํ ์คํธ๊ฐ failํ์ ๋ ์ด๋ค ๋ถ๋ถ์ ํ์ธํด์ผ ํ๋์ง ์ถ์ ํ๊ธฐ ํธํ ๊ฒ ๊ฐ์์. keycode๋ deprecated property์ด๊ธฐ๋ ํด์ ์ฌ์ฉ ์ง์ํ๋๊ฒ ..ใ ใ !
์คํ ๋ฆฌ Docs์์ iframe ๋ด๋ถ์ ์๋ DOM ์์์ ์ ๊ทผํ๋ ๋ฐฉ์์ผ๋ก visitStory๊ฐ ์์ฑ๋์ด ์๋ ์ ์ ์์ ํฉ๋๋ค. ๊ฐ๋ณ ์คํ ๋ฆฌ์ ๋ํ iframe ๋ด๋ถ๋ก ๋ฐ๋ก ์ ๊ทผํ ์ ์๋๋ก URL ์ฃผ์๋ฅผ ์์ ํฉ๋๋ค. ์ด๋ก ์ธํด์ getStory ์ปค๋งจ๋๋ ๋ ์ด์ ์ฌ์ฉํ์ง ์๊ฒ ๋์ด ์ญ์ ํฉ๋๋ค. ๋๋ถ์ด initAlias ํจ์์์ ์คํ ๋ฆฌ์ ์ต์์ ๋ถ๋ชจ ์์์ธ #root๋ก๋ถํฐ ํ์ ์ปดํฌ๋ํธ๋ฅผ ์ฐพ๋๋ก ๋ณ๊ฒฝํฉ๋๋ค. ์์ธ๋ฌ ๊ณตํต์ ์ผ๋ก ์ ์ฉ๋๋ beforeEach๋ ์ญ์ ํฉ๋๋ค.
๐ค ๊ฐ์
๐ซ ์ค๋ช
Storybook์ผ๋ก ์์ฑํ Slider ์ปดํฌ๋ํธ์ ๊ฐ ์คํ ๋ฆฌ์ E2E ํ ์คํธ ์ฝ๋๋ฅผ ์์ฑํ์ต๋๋ค.
Default slider
์ ๋ํ ํ ์คํธ ์ฝ๋๋ฅผ ๊ธฐ์ค์ผ๋ก ์ค๋ช ๋๋ฆฌ๋ฉด,Click min value : slider track์ ๊ฐ์ฅ ์ผ์ชฝ ํน์ ์๋์ชฝ์ ํด๋ฆญํ์ ๋ ์ต์๊ฐ์ผ๋ก ์ค์ ๋๋์ง
Click max value : slider track์ ๊ฐ์ฅ ์ค๋ฅธ์ชฝ ํน์ ์์ชฝ์ ํด๋ฆญํ์ ๋ ์ต๋๊ฐ์ผ๋ก ์ค์ ๋๋์ง
Increase with right arrow : โก๏ธ key๋ฅผ ํ๋ฒ ๋๋ ์ ๋, 1 (step) ๋งํผ ์ฆ๊ฐํ๋์ง
Increase with up arrow : โฌ๏ธ key๋ฅผ ํ๋ฒ ๋๋ ์ ๋, 1 (step) ๋งํผ ์ฆ๊ฐํ๋์ง
Decrease with left arrow : โฌ ๏ธ key๋ฅผ ํ๋ฒ ๋๋ ์ ๋, 1 (step) ๋งํผ ๊ฐ์ํ๋์ง
Decrease with down arrow : โฌ๏ธ key๋ฅผ ํ๋ฒ ๋๋ ์ ๋, 1 (step) ๋งํผ ๊ฐ์ํ๋์ง
Increase with page up :
PageUp key
๋ฅผ ๋๋ ์ ๋, 10% ์ฆ๊ฐํ๋์งDecrease with page down :
PageDown key
๋ฅผ ๋๋ ์ ๋, 10% ๊ฐ์ํ๋์งSet min with home key :
Home key
๋ฅผ ๋๋ ์ ๋, ์ต์๊ฐ์ผ๋ก ์ค์ ๋๋์งSet max with end key :
End key
๋ฅผ ๋๋ ์ ๋, ์ต๋๊ฐ์ผ๋ก ์ค์ ๋๋์ง๊ทธ ์ธ์ ์คํ ๋ฆฌ์ ๋ํด์๋ ํ์ํ๋ค๊ณ ํ๋จํ ํ ์คํธ ์ผ์ด์ค๋ง ์ถ๊ฐํ์ต๋๋ค.
์ถ์ํํ์ง ์๋ ๊ฒ์ด ํ ์คํธ๋ฅผ ์ฝ๋ ๊ฒ์ ๋ ๋์์ด ๋ ๊ฒ์ด๋ผ๊ณ ํ๋จํ์ฌ ์ผ๋ถ๋ฌ ๋ฐ๋ณต๋๋ ๋ถ๋ถ์ ๋จ๊ฒจ๋ ์ ๋ ์์ต๋๋ค.
cypress/support/commands.ts ํ์ผ์
์ปค์คํ ์ปค๋งจ๋
๋ฅผ ์ ์ํ์ต๋๋ค.*์ปค์คํ ์ปค๋งจ๋
Cypress์์ ์ ๊ณตํ๋ ์ปค๋งจ๋(๋ฉ์๋)๋ฅผ ์กฐํฉํด์ ์ปค์คํ ํ ์ ์์ต๋๋ค.
Chainingํด์ ์ฌ์ฉํ ์ ์๋ ํจ์๋ฅผ ์ ์ํ๋ค๊ณ ๋ณด์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค.
cypress/support/index.d.ts ํ์ผ์ ์ปค์คํ ์ปค๋งจ๋ ๋ฐ ๊ธฐํ ํจ์์์ ์ฌ์ฉํ ํ์ ์ ์ ์ํ์ต๋๋ค.
๐ท ์คํฌ๋ฆฐ์ท (Optional)
โก๏ธ 58๊ฐ์ ํ ์คํธ๋ฅผ ์์ฑํ์ต๋๋ค.
