|
1 | 1 | describe('Tab Demo Test', () => { |
2 | | - beforeEach(() => { |
| 2 | + it('Navigate to demo section', () => { |
3 | 3 | cy.visit('http://localhost:3000/tabs-horizontal-overflow-demo-nav-link'); |
4 | 4 | }); |
5 | 5 |
|
6 | | - it( |
7 | | - 'Allows users to select a tab from the overflow menu', |
8 | | - { |
9 | | - defaultCommandTimeout: 10000 |
10 | | - }, |
11 | | - () => { |
12 | | - // verify that the expected tabs are showing/not showing as expected based on screen size |
13 | | - [ |
14 | | - 'Tab item 1', |
15 | | - 'Tab item 2', |
16 | | - 'Tab item 3', |
17 | | - 'Tab item 4', |
18 | | - 'Tab item 5', |
19 | | - 'Tab item 6', |
20 | | - 'Tab item 7', |
21 | | - 'More' |
22 | | - ].forEach((tab) => cy.contains('.pf-v6-c-tabs__link', tab).should('exist')); |
23 | | - ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((tab) => cy.contains(tab).should('not.exist')); |
| 6 | + it('Allows users to select a tab from the overflow menu', () => { |
| 7 | + // verify that the expected tabs are showing/not showing as expected based on screen size |
| 8 | + ['Tab item 1', 'Tab item 2', 'Tab item 3', 'Tab item 4', 'Tab item 5', 'Tab item 6', 'Tab item 7', 'More'].forEach( |
| 9 | + (tab) => cy.contains('.pf-v6-c-tabs__link', tab).should('exist') |
| 10 | + ); |
| 11 | + ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((tab) => cy.contains(tab).should('not.exist')); |
24 | 12 |
|
25 | | - // open the overflow menu and verify that the overflowing tabs are now visible within it |
26 | | - cy.contains('.pf-v6-c-tabs__link', 'More').click(); |
27 | | - cy.wait(8000); |
28 | | - ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => |
29 | | - cy.contains(menuItem).should('exist') |
30 | | - ); |
| 13 | + // open the overflow menu and verify that the overflowing tabs are now visible within it |
| 14 | + cy.get('.pf-v6-c-tabs__link').last().click(); |
| 15 | + ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => |
| 16 | + cy.get('.pf-v6-c-menu__item').contains(menuItem).should('exist') |
| 17 | + ); |
31 | 18 |
|
32 | | - // select a tab and verify that it replaces the default overflow tab text, closes the overflow menu, and shows its content |
33 | | - cy.contains('Tab item 9').click(); |
34 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('not.exist'); |
35 | | - cy.contains('.pf-v6-c-tabs__link', 'Tab item 9').should('exist'); |
36 | | - ['Tab item 8', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => cy.contains(menuItem).should('not.exist')); |
37 | | - cy.contains('Tab 9 section').should('not.be.hidden'); |
| 19 | + // select a tab and verify that it replaces the default overflow tab text, closes the overflow menu, and shows its content |
| 20 | + cy.contains('Tab item 9').click(); |
| 21 | + cy.contains('.pf-v6-c-tabs__link', 'More').should('not.exist'); |
| 22 | + cy.contains('.pf-v6-c-tabs__link', 'Tab item 9').should('exist'); |
| 23 | + ['Tab item 8', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => cy.contains(menuItem).should('not.exist')); |
| 24 | + cy.contains('Tab 9 section').should('not.be.hidden'); |
38 | 25 |
|
39 | | - // select a non-overflow tab and verify that overflow tab text returns to the default and the now selected tab content shows |
40 | | - cy.contains('Tab item 1').click(); |
41 | | - cy.contains('Tab item 9').should('not.exist'); |
42 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('exist'); |
43 | | - cy.contains('Tab 9 section').should('be.hidden'); |
44 | | - cy.contains('Tab 1 section').should('not.be.hidden'); |
45 | | - } |
46 | | - ); |
| 26 | + // select a non-overflow tab and verify that overflow tab text returns to the default and the now selected tab content shows |
| 27 | + cy.contains('Tab item 1').click(); |
| 28 | + cy.contains('Tab item 9').should('not.exist'); |
| 29 | + cy.contains('.pf-v6-c-tabs__link', 'More').should('exist'); |
| 30 | + cy.contains('Tab 9 section').should('be.hidden'); |
| 31 | + cy.contains('Tab 1 section').should('not.be.hidden'); |
| 32 | + }); |
47 | 33 |
|
48 | 34 | // Re-enable once https://github.com/patternfly/patternfly/issues/7449 is resolved |
49 | 35 | xit('Adjusts tabs showing on resize', () => { |
|
0 commit comments