-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): add full e2e coverage for Tooltip component
- Loading branch information
1 parent
6e04b33
commit 167cee9
Showing
4 changed files
with
308 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
import { TooltipPo } from '../support/tooltip.po'; | ||
|
||
describe('Tooltip demo page test suite', () => { | ||
const tooltip = new TooltipPo(); | ||
|
||
before(() => tooltip.navigateTo()); | ||
|
||
describe('Placement tooltip', () => { | ||
|
||
const basic = tooltip.exampleDemosArr.placement; | ||
const placement = tooltip.tooltipPlacements; | ||
|
||
it('when user on hovering on trigger btn in the Placement exmpl - tooltip appears on the setted placement', () => { | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placement.top.tooltipClass, | ||
placement.top.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placement.right.tooltipClass, | ||
placement.right.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placement.auto.tooltipClass, | ||
placement.auto.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placement.left.tooltipClass, | ||
placement.left.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placement.bottom.tooltipClass, | ||
placement.bottom.name | ||
); | ||
}); | ||
}); | ||
|
||
describe('Dismiss tooltip', () => { | ||
|
||
const dismissPlacement = tooltip.exampleDemosArr.dismiss; | ||
|
||
it('when user click on Dismissible btn, tooltip appears', () => { | ||
tooltip.clickOnTooltip(dismissPlacement); | ||
tooltip.isTooltipAppearsAndVisible(dismissPlacement); | ||
}); | ||
it('when user clicks the another placement, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(dismissPlacement); | ||
}); | ||
}); | ||
|
||
describe('Dynamic Content', () => { | ||
|
||
const dynamicContentPlacement = tooltip.exampleDemosArr.dynamicTooltip; | ||
|
||
it('when user clicks on the Dynamic Content tooltip btn, Tooltip appears', () => { | ||
tooltip.focusOnTooltip(dynamicContentPlacement); | ||
tooltip.isTooltipAppearsAndVisible(dynamicContentPlacement); | ||
}); | ||
|
||
it('when user clicks the another placement, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(dynamicContentPlacement); | ||
}); | ||
}); | ||
|
||
describe('Custom content template', () => { | ||
|
||
const customContentTemplate = tooltip.exampleDemosArr.customContentTemplate; | ||
|
||
it('when user clicks on the Custom content template tooltip btn, Tooltip appears', () => { | ||
tooltip.focusOnTooltip(customContentTemplate); | ||
tooltip.isTooltipAppearsAndVisible(customContentTemplate); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(customContentTemplate); | ||
}); | ||
}); | ||
|
||
describe('Dynamic Html', () => { | ||
|
||
const dynamicHtmlTooltip = tooltip.exampleDemosArr.dynamicHtmlButton; | ||
|
||
it('when user hover on the tooltip btn, Tooltip appears', () => { | ||
tooltip.focusOnTooltip(dynamicHtmlTooltip); | ||
tooltip.isTooltipAppearsAndVisible(dynamicHtmlTooltip); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(dynamicHtmlTooltip); | ||
}); | ||
}); | ||
|
||
describe('Append to body', () => { | ||
|
||
const appendToBody = tooltip.exampleDemosArr.defaultTooltip; | ||
|
||
it('when user hover on the "Default tooltip", tooltip appears and dismiss after mouse leave', () => { | ||
tooltip.focusOnBtn(appendToBody); | ||
tooltip.isTooltipAppearsAndVisible(tooltip.body); | ||
tooltip.isTooltipDismissAfterClick(appendToBody); | ||
}); | ||
|
||
it('when user hover on the "Tooltip appended to body", tooltip appears and dismiss after mouse leave', () => { | ||
tooltip.focusOnBtn(appendToBody, 1); | ||
tooltip.isTooltipAppearsAndVisible(tooltip.body); | ||
tooltip.isTooltipDismissAfterClick(appendToBody); | ||
}); | ||
}); | ||
|
||
describe('Configuring defaults', () => { | ||
|
||
const configuringDefaultsTooltip = tooltip.exampleDemosArr.configuringDefaults; | ||
|
||
it('when user clicks on the Configuring tooltip btn, Tooltip appears & dismiss after mouse leave', () => { | ||
tooltip.focusOnTooltip(configuringDefaultsTooltip); | ||
tooltip.isTooltipAppearsAndVisible(tooltip.body); | ||
}); | ||
|
||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(configuringDefaultsTooltip); | ||
}); | ||
}); | ||
|
||
describe('Custom triggers', () => { | ||
|
||
const customTriggersTooltip = tooltip.exampleDemosArr.customTriggersTooltip; | ||
|
||
it('when user focus on the "Hover on me!" btn, Tooltip appears and hide after clicks', () => { | ||
tooltip.isCustomTriggersAppearsAndVisible(customTriggersTooltip, | ||
'Hover over me!', | ||
'mouseenter', | ||
'I will hide on click' | ||
); | ||
}); | ||
|
||
it('when user clicks on the "Click on me!" btn, Tooltip appears and hide after press again', () => { | ||
tooltip.isCustomTriggersAppearsAndVisible(customTriggersTooltip, | ||
'Click on me!', | ||
'click', | ||
'I will hide on click' | ||
); | ||
}); | ||
}); | ||
|
||
describe('Manual triggering', () => { | ||
|
||
const manualTriggeringTooltip = tooltip.exampleDemosArr.manualTriggeringTooltip; | ||
|
||
it('when user clicks on Show, then tooltip appear under the text, and dismiss after click Hide', () => { | ||
tooltip.clickOnBtn(manualTriggeringTooltip, 0); | ||
tooltip.isTooltipAppearsAndVisible(tooltip.body); | ||
tooltip.clickOnBtn(manualTriggeringTooltip, 1); | ||
tooltip.isToggleTooltipDisappears(); | ||
}); | ||
|
||
it('when user clicks on Toggle, then tooltip appears and hide, after click again', () => { | ||
tooltip.clickOnBtn(manualTriggeringTooltip, 2); | ||
tooltip.isTooltipAppearsAndVisible(tooltip.body); | ||
tooltip.clickOnBtn(manualTriggeringTooltip, 2); | ||
tooltip.isToggleTooltipDisappears(); | ||
}); | ||
}); | ||
|
||
describe('Component level styling', () => { | ||
|
||
const componentLevelStyling = tooltip.exampleDemosArr.componentLevelStyling; | ||
|
||
it('when user hover on the "I have component level styling" btn, tooltip appears', () => { | ||
tooltip.focusOnTooltip(componentLevelStyling); | ||
tooltip.isTooltipAppearsAndVisible(componentLevelStyling); | ||
}); | ||
|
||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(componentLevelStyling); | ||
}); | ||
}); | ||
|
||
describe('Custom class', () => { | ||
|
||
const customClass = tooltip.exampleDemosArr.customClass; | ||
|
||
it('when user hover on the "IDemo with custom class" btn, tooltip appears', () => { | ||
tooltip.focusOnTooltip(customClass); | ||
tooltip.isTooltipAppearsAndVisible(customClass); | ||
}); | ||
|
||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(customClass); | ||
}); | ||
}); | ||
|
||
describe('Tooltip with delay', () => { | ||
|
||
const delayTooltip = tooltip.exampleDemosArr.delayTooltip; | ||
|
||
it('when user hover on the "Tooltip with 0,5sec delay" btn, tooltip appears and dismiss after mouse leave', () => { | ||
cy.viewport(1440, 900); | ||
tooltip.clickOnDemoMenu('Tooltip with delay'); | ||
tooltip.focusOnTooltip(delayTooltip); | ||
tooltip.isTooltipAppearsAndVisible(delayTooltip); | ||
}); | ||
|
||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterClick(delayTooltip); | ||
}); | ||
}); | ||
}); |
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.