-
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 3f35e15
Showing
7 changed files
with
283 additions
and
13 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,160 @@ | ||
import { TooltipPo } from '../support/tooltip.po'; | ||
|
||
describe('Tooltip demo page test suite', () => { | ||
const tooltip = new TooltipPo(); | ||
|
||
beforeEach(() => tooltip.navigateTo()); | ||
|
||
describe('Placement tooltip', () => { | ||
const basic = tooltip.exampleDemosArr.placement; | ||
const placementsOfTheTooltipContainer = tooltip.placementsOfTheTooltipContainer; | ||
|
||
it('when user on hovering on trigger btn in the Placement exmpl - tooltip appears on the setted placement', () => { | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placementsOfTheTooltipContainer.placementTop.tooltipContainerClass, | ||
placementsOfTheTooltipContainer.placementTop.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placementsOfTheTooltipContainer.placementRight.tooltipContainerClass, | ||
placementsOfTheTooltipContainer.placementRight.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placementsOfTheTooltipContainer.placementAuto.tooltipContainerClass, | ||
placementsOfTheTooltipContainer.placementAuto.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placementsOfTheTooltipContainer.placementLeft.tooltipContainerClass, | ||
placementsOfTheTooltipContainer.placementLeft.name | ||
); | ||
tooltip.isTooltipPlacementCorrect( | ||
basic, | ||
placementsOfTheTooltipContainer.placementBottom.tooltipContainerClass, | ||
placementsOfTheTooltipContainer.placementBottom.name | ||
); | ||
}); | ||
}); | ||
|
||
describe('Dismiss tooltip', () => { | ||
const dismissPlacement = tooltip.exampleDemosArr.dismiss; | ||
it('when user click on Dismissible btn, tooltip appears', () => { | ||
tooltip.isTooltipAppearOnClick(dismissPlacement); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(dismissPlacement); | ||
}); | ||
}); | ||
|
||
describe('Dynamic Content', () => { | ||
const dynamicContentPlacement = tooltip.exampleDemosArr.dynamicTooltip; | ||
it('when the user clicks on the Dynamic Content tooltip btn, Tooltip appears', () => { | ||
tooltip.isTooltipAppearOnFocus(dynamicContentPlacement); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(dynamicContentPlacement); | ||
}); | ||
}); | ||
|
||
describe('Custom content template', () => { | ||
const customContentTemplate = tooltip.exampleDemosArr.customContentTemplate; | ||
it('when the user clicks on the Custom content template tooltip btn, Tooltip appears', () => { | ||
tooltip.isTooltipAppearOnFocus(customContentTemplate); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(customContentTemplate); | ||
}); | ||
}); | ||
|
||
describe('Dynamic Html', () => { | ||
const dynamicHtmlTooltip = tooltip.exampleDemosArr.dynamicHtmlButton; | ||
it('when user clicks on the tooltip btn, Tooltip appears', () => { | ||
tooltip.isTooltipAppearOnFocus(dynamicHtmlTooltip); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(dynamicHtmlTooltip); | ||
}); | ||
}); | ||
|
||
describe('Append to body', () => { | ||
const appendToBody = tooltip.exampleDemosArr.defaultTooltip; | ||
it('when the user hover on the Default tooltip, tooltip appears and dismiss after mouse leave', () => { | ||
tooltip.isAppendToBodyTooltipAppearsVisibleAndDismissible(appendToBody, 'Default tooltip'); | ||
tooltip.isAppendToBodyTooltipAppearsVisibleAndDismissible(appendToBody, 'Tooltip appended to body'); | ||
}); | ||
}); | ||
|
||
describe('Configuring defaults', () => { | ||
const configuringDefaultsTooltip = tooltip.exampleDemosArr.configuringDefaults; | ||
it('when the user clicks on the Configuring tooltip btn, Tooltip appears', () => { | ||
tooltip.isConfiguringTooltipAppearOnFocus(configuringDefaultsTooltip); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(configuringDefaultsTooltip); | ||
}); | ||
}); | ||
|
||
|
||
describe('Custom triggers', () => { | ||
const customTriggersTooltip = tooltip.exampleDemosArr.customTriggersTooltip; | ||
it('when the user focus on the "Hover on me!" btn, Tooltip appears and hide after clicks', () => { | ||
tooltip.isCustomTriggersClickAppearsAndVisible( | ||
customTriggersTooltip, | ||
'Hover over me!', | ||
'mouseenter', | ||
'I will hide on click' | ||
); | ||
}); | ||
it('when the user clicks on the "Click on me!" btn, Tooltip appears and hide after press again', () => { | ||
tooltip.isCustomTriggersClickAppearsAndVisible( | ||
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-container appear above the text and dismiss after user clicks "Hide"', () => { | ||
tooltip.isManualTooltipsAppearsAndVisible(manualTriggeringTooltip, 'Hello there! I was triggered manually'); | ||
}); | ||
it('when the user clicks on "Toggle", then tooltip appears and hide after press again', () => { | ||
tooltip.isToggleTooltipAppearsAndDisappears(manualTriggeringTooltip, 'Hello there! I was triggered manually'); | ||
}); | ||
}); | ||
|
||
describe('Component level styling', () => { | ||
const componentLevelStyling = tooltip.exampleDemosArr.componentLevelStyling; | ||
it('when the user hover on the "I have component level styling" btn, tooltip appears', () => { | ||
tooltip.isTooltipAppearOnFocus(componentLevelStyling); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(componentLevelStyling); | ||
}); | ||
|
||
}); | ||
|
||
describe('Custom class', () => { | ||
const customClass = tooltip.exampleDemosArr.customClass; | ||
it('when the user hover on the "IDemo with custom class" btn, tooltip appears', () => { | ||
tooltip.isTooltipAppearOnFocus(customClass); | ||
}); | ||
it('when user moves the mouse cursor away, then tooltip-container disappeared', () => { | ||
tooltip.isTooltipDismissAfterTheClicks(customClass); | ||
}); | ||
}); | ||
|
||
describe('Tooltip with delay', () => { | ||
const delayTooltip = tooltip.exampleDemosArr.delayTooltip; | ||
it('when the 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.isTooltipAppearOnFocus(delayTooltip); | ||
tooltip.isTooltipDismissAfterTheClicks(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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<button type="button" class="btn btn-primary" | ||
tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> | ||
tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." | ||
> | ||
Preconfigured tooltip | ||
</button> |
6 changes: 4 additions & 2 deletions
6
demo/src/app/components/+tooltip/demos/container/container.html
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.