-
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 coverage for Collapse component demo (#4847)
- Loading branch information
1 parent
52fc9e8
commit bb65d16
Showing
5 changed files
with
133 additions
and
7 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,88 @@ | ||
import { CollapsePo } from '../support/collapse.po'; | ||
|
||
describe('Collapse demo page test suite', () => { | ||
const collapse = new CollapsePo(); | ||
|
||
beforeEach(() => collapse.navigateTo()); | ||
|
||
describe('Events', () => { | ||
const events = collapse.exampleDemosArr.events; | ||
|
||
it('example contains "Toggle collapse" button and div block with "Some content", "Event: expanded"', () => { | ||
collapse.isCollapseExpanded(events, 'true'); | ||
collapse.isCollapseInfoEqual(events, 'Event: expanded'); | ||
}); | ||
|
||
it('when user clicks on "Toggle collapse", then "Some content" disappear and user see "Event: collapsed"', () => { | ||
const toglerText = 'Toggle collapse'; | ||
collapse.clickByText(events, toglerText); | ||
collapse.isCollapseExpanded(events, 'false'); | ||
collapse.isCollapseInfoEqual(events, 'Event: collapsed'); | ||
|
||
}); | ||
|
||
it('when user clicks on "Toggle collapse" again, then "Some content" and "Event: expanded" appear', () => { | ||
const toglerText = 'Toggle collapse'; | ||
collapse.dblClickByText(events, toglerText); | ||
collapse.isCollapseExpanded(events, 'true'); | ||
collapse.isCollapseInfoEqual(events, 'Event: expanded'); | ||
}); | ||
}); | ||
|
||
describe('Manual toggle', () => { | ||
const manualToggle = collapse.exampleDemosArr.manualToggle; | ||
|
||
beforeEach(() => { | ||
collapse.scrollToMenu('Manual toggle'); | ||
}); | ||
|
||
it('example contains "Show content" and "Hide content" buttons, div block with "Some content"', () => { | ||
collapse.isBtnTxtEqual(manualToggle, 'Show content\n', 0); | ||
collapse.isBtnTxtEqual(manualToggle, 'Hide content\n', 1); | ||
collapse.isCollapseExpanded(manualToggle, 'true'); | ||
|
||
}); | ||
|
||
it('when user clicks on "Hide content", then collapse disappear, on "Show content" - "Some content" appear', () => { | ||
collapse.clickOnBtn(manualToggle, 1); | ||
collapse.isCollapseExpanded(manualToggle, 'false'); | ||
|
||
collapse.clickOnBtn(manualToggle, 0); | ||
collapse.isCollapseExpanded(manualToggle, 'true'); | ||
}); | ||
}); | ||
|
||
describe('Inline display', () => { | ||
const inlineDisplay = collapse.exampleDemosArr.inlineDisplay; | ||
|
||
beforeEach(() => { | ||
collapse.scrollToMenu('Inline display'); | ||
}); | ||
|
||
it('example contains "Inline-block" and "None" buttons', () => { | ||
collapse.isBtnTxtEqual(inlineDisplay, 'Inline-block\n', 0); | ||
collapse.isBtnTxtEqual(inlineDisplay, 'None\n', 1); | ||
collapse.isCollapseExpanded(inlineDisplay, 'false'); | ||
|
||
}); | ||
|
||
it('when user clicks on "Inline-block", then collapse appear with inline-block, on "None" - without inline', () => { | ||
collapse.clickOnBtn(inlineDisplay, 0); | ||
collapse.isCollapseExpanded(inlineDisplay, 'false'); | ||
collapse.isCollapseWithInline(inlineDisplay, true); | ||
|
||
collapse.clickOnBtn(inlineDisplay, 1); | ||
collapse.isCollapseExpanded(inlineDisplay, 'false'); | ||
collapse.isCollapseWithInline(inlineDisplay, false); | ||
}); | ||
}); | ||
|
||
describe('Accessibility', () => { | ||
it('example contains info about "aria-expanded", "aria-controls" attributes', () => { | ||
const accessibilityInfo = collapse.exampleDemosArr.accessibility; | ||
cy.viewport(1440, 900); | ||
collapse.clickOnDemoMenu('Accessibility'); | ||
collapse.isDemoContainsTxt(accessibilityInfo, 'aria-expanded', 'aria-controls'); | ||
}); | ||
}); | ||
}); |
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
19 changes: 19 additions & 0 deletions
19
docs/spec/collapse/collapse.examples.inline-display.use-case.md
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,19 @@ | ||
4.4: Collapse inline display example | ||
=================================== | ||
**Primary Actor**: User | ||
|
||
**Scope**: Ngx-bootstrap DEMO / BS version 3&4 | ||
|
||
**Goal**: Show user collapse with inline display example | ||
|
||
Main success scenario: | ||
---------------------- | ||
1. User opens Collapse demo page | ||
2. User clicks on Inline display sub-menu | ||
3. User see clickable "Inline-block" and "None" buttons | ||
4. When user clicks on "Inline-block", then "Some content" appear with style: inline-block | ||
5. When user clicks on "None", tthen "Some content" disappear with style: display-none | ||
|
||
Variations: | ||
----------- | ||
2*. User scrolls to Inline display sub-menu |