Skip to content

Commit 465ed0d

Browse files
YevheniiaMazurvalorkin
authored andcommitted
fix(tests): remove unstable part of e2e (#3716)
1 parent 1ff5f54 commit 465ed0d

File tree

6 files changed

+22
-114
lines changed

6 files changed

+22
-114
lines changed

cypress/integration/accordion_page_spec.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { AccordionPo } from '../support/accordion.po';
33
describe('Accordion page test suite', () => {
44
const accordion = new AccordionPo();
55
const accordionExamples = accordion.accordionDemosArr;
6-
const accordionTitles = accordion.exampleTitlesArr;
76

87
beforeEach(() => accordion.navigateTo());
98

@@ -154,18 +153,4 @@ describe('Accordion page test suite', () => {
154153
cy.get('@thirdPanel')
155154
.should('not.have.class', 'panel-open');
156155
});
157-
158-
it('each demo examples are not mixed up with each other and contains code examples', () => {
159-
cy.get('examples').find('h3').as('exampleTitles').each(($title, i) => {
160-
expect($title).to.contain(accordionTitles[i]);
161-
162-
cy.get('@exampleTitles').contains(accordionTitles[i]).parent().as('currentBlock');
163-
164-
cy.get('@currentBlock').find(accordionExamples[i])
165-
.should('to.exist');
166-
cy.get('@currentBlock').find('.section').eq(1)
167-
.should('be.visible')
168-
.and('not.to.be.empty');
169-
});
170-
});
171156
});

cypress/integration/alerts_page_spec.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AlertsPo } from '../support/alerts.po';
33
describe('Alerts page test suite', () => {
44
const alerts = new AlertsPo();
55
const alertsDemos = alerts.exampleDemosArr;
6-
const alertsTitles = alerts.exampleTitlesArr;
6+
77
let alertTypes: string[];
88
let stylesColors: string[];
99

@@ -146,18 +146,4 @@ describe('Alerts page test suite', () => {
146146
cy.get('@configuredAlerts').eq(1)
147147
.should('to.have.class', alertTypes[1]);
148148
});
149-
150-
it('each demo examples are not mixed up with each other and contains code examples', () => {
151-
cy.get('examples').find('h3').as('exampleTitles').each(($title, i) => {
152-
expect($title).to.contain(alertsTitles[i]);
153-
154-
cy.get('@exampleTitles').contains(alertsTitles[i]).parent().as('currentBlock');
155-
156-
cy.get('@currentBlock').find(alertsDemos[i])
157-
.should('to.exist');
158-
cy.get('@currentBlock').find('.section').eq(1)
159-
.should('be.visible')
160-
.and('not.to.be.empty');
161-
});
162-
});
163149
});

cypress/integration/buttons_page_spec.ts

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { ButtonsPo } from '../support/buttons.po';
22

3-
// need to refactor tests for making them faster
43
describe('Buttons page test suite', () => {
54
const buttons = new ButtonsPo();
6-
const buttonTitles = buttons.exampleTitlesArr;
75
const buttonDemos = buttons.exampleDemosArr;
86

7+
const buttonNames = ['Left', 'Middle', 'Right'];
8+
const buttonOutput = ['left', 'middle', 'right'];
9+
910
beforeEach(() => buttons.navigateTo());
1011

1112
it('buttons page loads and displays it\'s content', () => {
@@ -47,46 +48,27 @@ describe('Buttons page test suite', () => {
4748

4849

4950
it('checkbox example contains checkboxes, that can be checked or unchecked', () => {
50-
// let btnTextTempl: string;
51-
// setting all checkboxes to unchecked
52-
// cy.get(buttonDemos[1]).as('checkboxes').find('.btn').as('btnBlock').eq(1).click();
53-
54-
buttons.clickByText(buttonDemos[1], 'Middle');
55-
cy.get(buttonDemos[1]).children('.card-header').should('to.contain', `"middle": false`);
56-
57-
// cy.get(buttonDemos[1]).find('.btn').as('checkbox').each(($btn, i) => {
58-
// cy.get('@checkbox').eq(i).invoke('text').then(btnText => {
59-
// btnTextTempl = btnText.toString().toLowerCase();
60-
//
61-
// cy.get('@checkbox').eq(i).click();
62-
// cy.get('@checkboxes').children('.card-header')
63-
// .should('to.contain', `"${ btnTextTempl }": true`);
64-
//
65-
// cy.get('@checkbox').eq(i).click();
66-
// cy.get('@checkboxes').children('.card-header')
67-
// .should('to.contain', `"${ btnTextTempl }": false`);
68-
// });
69-
// });
51+
buttons.clickByText(buttonDemos[1], buttonNames[0]);
52+
buttons.clickByText(buttonDemos[1], buttonNames[1]);
53+
54+
cy.get(buttonDemos[1]).children('.card-header').as('output')
55+
.should('to.contain', `"${buttonOutput[0]}": true`);
56+
cy.get('@output')
57+
.should('to.contain', `"${buttonOutput[1]}": false`);
7058
});
7159

7260
it('checkbox example contains checkboxes, that can be checked or unchecked and reactive form', () => {
73-
let btnTextTempl: string;
74-
// setting all checkboxes to unchecked
75-
cy.get(buttonDemos[2]).as('checkboxesForm').find('.btn').eq(1).click();
76-
77-
cy.get(buttonDemos[2]).find('.btn').as('checkbox').each(($btn, i) => {
78-
cy.get('@checkbox').eq(i).invoke('text').then(btnText => {
79-
btnTextTempl = btnText.toString().toLowerCase();
80-
81-
cy.get('@checkbox').eq(i).click();
82-
cy.get('@checkboxesForm').children('.card-header')
83-
.should('to.contain', `"${ btnTextTempl }": true`);
84-
85-
cy.get('@checkbox').eq(i).click();
86-
cy.get('@checkboxesForm').children('.card-header')
87-
.should('to.contain', `"${ btnTextTempl }": false`);
88-
});
89-
});
61+
buttons.clickByText(buttonDemos[2], buttonNames[1]);
62+
buttons.clickByText(buttonDemos[2], buttonNames[2]);
63+
64+
cy.get(buttonDemos[2]).children('.card-header').as('output')
65+
.should('to.contain', `"${buttonOutput[1]}": false`);
66+
cy.get('@output')
67+
.should('to.contain', `"${buttonOutput[2]}": true`);
68+
69+
buttons.clickByText(buttonDemos[2], buttonNames[1]);
70+
cy.get('@output')
71+
.should('to.contain', `"${buttonOutput[1]}": true`);
9072
});
9173

9274
it('Radio and Uncheckable Radio example contains checkboxes and radioButtons', () => {
@@ -118,7 +100,6 @@ describe('Buttons page test suite', () => {
118100
});
119101
});
120102

121-
122103
it('disabled buttons examples contains button, that can be disabled', () => {
123104
cy.get(buttonDemos[5]).as('disabledButton')
124105
.should('to.have.descendants', '.btn-primary')
@@ -129,18 +110,4 @@ describe('Buttons page test suite', () => {
129110
cy.get('@disabledButton').contains('Button')
130111
.should('not.to.be.enabled');
131112
});
132-
133-
it('each demo examples are not mixed up with each other and contains code examples', () => {
134-
cy.get('examples').find('h3').as('exampleTitles').each(($title, i) => {
135-
expect($title).to.contain(buttonTitles[i]);
136-
137-
cy.get('@exampleTitles').contains(buttonTitles[i]).parent().as('currentBlock');
138-
139-
cy.get('@currentBlock').find(buttonDemos[i])
140-
.should('to.exist');
141-
cy.get('@currentBlock').find('.section').eq(1)
142-
.should('be.visible')
143-
.and('not.to.be.empty');
144-
});
145-
});
146113
});

cypress/support/accordion.po.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ export class AccordionPo extends BaseComponent {
77
buttonEnableDisable = 'Enable / Disable first panel';
88
buttonPanelToggler = 'Toggle last panel';
99
buttonAddItem = 'Add';
10-
exampleTitlesArr = [
11-
'Simple accordion',
12-
'Disabled',
13-
'Dynamic accordion',
14-
'Open only one at a time',
15-
'Styling',
16-
'Configuring defaults'
17-
];
1810
accordionDemosArr = [
1911
'demo-accordion-basic',
2012
'demo-accordion-disabled',

cypress/support/alerts.po.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ export class AlertsPo extends BaseComponent {
1414
'Now this text is different from what it was before. Go ahead and click the button one more time',
1515
'Well done! Click reset button'
1616
];
17-
18-
exampleTitlesArr = [
19-
'Basic',
20-
'Link color',
21-
'Additional content',
22-
'Dismissing',
23-
'Dynamic html',
24-
'Dynamic content',
25-
'Dismiss on timeout',
26-
'Global styling',
27-
'Component level styling',
28-
'Configuring defaults'
29-
];
3017
exampleDemosArr = [
3118
'demo-alert-basic',
3219
'demo-alert-link',

cypress/support/buttons.po.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ export class ButtonsPo extends BaseComponent {
55
pageTitle = 'Buttons';
66
ghLinkToComponent = 'https://github.com/valor-software/ngx-bootstrap/tree/development/src/buttons';
77

8-
exampleTitlesArr = [
9-
'Single button',
10-
'Checkbox',
11-
'Checkbox with Reactive Forms',
12-
'Radio & Uncheckable Radio',
13-
'Radio with Reactive Forms',
14-
'Disabled Buttons'
15-
];
16-
178
exampleDemosArr = [
189
'demo-buttons-basic',
1910
'demo-buttons-checkbox',

0 commit comments

Comments
 (0)