@@ -3,99 +3,100 @@ const PageAccordion = require('../../../src/components/Accordion/pageObject');
33const ACCORDION = '#accordion-1' ;
44
55describe ( 'Accordion whend multiple is not passed' , ( ) => {
6- beforeAll ( ( ) => {
7- browser . url ( '/#!/Accordion/1' ) ;
6+ beforeAll ( async ( ) => {
7+ await browser . url ( '/#!/Accordion/1' ) ;
88 } ) ;
9- beforeEach ( ( ) => {
10- browser . refresh ( ) ;
11- const component = $ ( ACCORDION ) ;
12- component . waitForExist ( ) ;
9+
10+ beforeEach ( async ( ) => {
11+ await browser . refresh ( ) ;
12+ const component = await $ ( ACCORDION ) ;
13+ await component . waitForExist ( ) ;
1314 } ) ;
1415
15- it ( 'should expand the accordion section when its button icon is clicked' , ( ) => {
16+ it ( 'should expand the accordion section when its button icon is clicked' , async ( ) => {
1617 const accordion = new PageAccordion ( ACCORDION ) ;
17- const accordionSection = accordion . getItem ( 0 ) ;
18- accordionSection . clickButton ( ) ;
19- expect ( accordionSection . isExpanded ( ) ) . toBe ( true ) ;
18+ const accordionSection = await accordion . getItem ( 0 ) ;
19+ await accordionSection . clickButton ( ) ;
20+ await expect ( await accordionSection . isExpanded ( ) ) . toBe ( true ) ;
2021 } ) ;
21- it ( 'should collapse the accordion section when click twice on the button icon' , ( ) => {
22+ it ( 'should collapse the accordion section when click twice on the button icon' , async ( ) => {
2223 const accordion = new PageAccordion ( ACCORDION ) ;
23- const accordionSection = accordion . getItem ( 0 ) ;
24- accordionSection . clickButton ( ) ;
25- accordionSection . clickButton ( ) ;
26- expect ( accordionSection . isExpanded ( ) ) . toBe ( false ) ;
24+ const accordionSection = await accordion . getItem ( 0 ) ;
25+ await accordionSection . clickButton ( ) ;
26+ await accordionSection . clickButton ( ) ;
27+ await expect ( await accordionSection . isExpanded ( ) ) . toBe ( false ) ;
2728 } ) ;
28- it ( 'should close the first accordion section and expand the second when the first is expanded and is clicked the button icon of the second' , ( ) => {
29+ it ( 'should close the first accordion section and expand the second when the first is expanded and is clicked the button icon of the second' , async ( ) => {
2930 const accordion = new PageAccordion ( ACCORDION ) ;
30- const firstAccordionSection = accordion . getItem ( 0 ) ;
31- const secondAccordionSection = accordion . getItem ( 1 ) ;
32- firstAccordionSection . clickButton ( ) ;
33- secondAccordionSection . clickButton ( ) ;
34- expect ( firstAccordionSection . isExpanded ( ) ) . toBe ( false ) ;
35- expect ( secondAccordionSection . isExpanded ( ) ) . toBe ( true ) ;
31+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
32+ const secondAccordionSection = await accordion . getItem ( 1 ) ;
33+ await firstAccordionSection . clickButton ( ) ;
34+ await secondAccordionSection . clickButton ( ) ;
35+ await expect ( await firstAccordionSection . isExpanded ( ) ) . toBe ( false ) ;
36+ await expect ( await secondAccordionSection . isExpanded ( ) ) . toBe ( true ) ;
3637 } ) ;
37- it ( 'should move focus to the next button icon when the first button icon is focused and press arrow down' , ( ) => {
38+ it ( 'should move focus to the next button icon when the first button icon is focused and press arrow down' , async ( ) => {
3839 const accordion = new PageAccordion ( ACCORDION ) ;
39- const firstAccordionSection = accordion . getItem ( 0 ) ;
40- const secondAccordionSection = accordion . getItem ( 1 ) ;
41- firstAccordionSection . clickButton ( ) ;
42- browser . keys ( 'ArrowDown' ) ;
43- expect ( secondAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
40+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
41+ const secondAccordionSection = await accordion . getItem ( 1 ) ;
42+ await firstAccordionSection . clickButton ( ) ;
43+ await browser . keys ( 'ArrowDown' ) ;
44+ await expect ( await secondAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
4445 } ) ;
45- it ( 'should move focus to the last button icon when the first button icon is focused and press arrow up' , ( ) => {
46+ it ( 'should move focus to the last button icon when the first button icon is focused and press arrow up' , async ( ) => {
4647 const accordion = new PageAccordion ( ACCORDION ) ;
47- const firstAccordionSection = accordion . getItem ( 0 ) ;
48- const lastAccordionSection = accordion . getItem ( 2 ) ;
49- firstAccordionSection . clickButton ( ) ;
50- browser . keys ( 'ArrowUp' ) ;
51- expect ( lastAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
48+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
49+ const lastAccordionSection = await accordion . getItem ( 2 ) ;
50+ await firstAccordionSection . clickButton ( ) ;
51+ await browser . keys ( 'ArrowUp' ) ;
52+ await expect ( await lastAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
5253 } ) ;
53- it ( 'should move focus to the previous button icon when the second button icon is focused and press arrow up' , ( ) => {
54+ it ( 'should move focus to the previous button icon when the second button icon is focused and press arrow up' , async ( ) => {
5455 const accordion = new PageAccordion ( ACCORDION ) ;
55- const firstAccordionSection = accordion . getItem ( 0 ) ;
56- const secondAccordionSection = accordion . getItem ( 1 ) ;
57- secondAccordionSection . clickButton ( ) ;
58- browser . keys ( 'ArrowUp' ) ;
59- expect ( firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
56+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
57+ const secondAccordionSection = await accordion . getItem ( 1 ) ;
58+ await secondAccordionSection . clickButton ( ) ;
59+ await browser . keys ( 'ArrowUp' ) ;
60+ await expect ( await firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
6061 } ) ;
61- it ( 'should move focus to the first button icon when the last button icon is focused and press arrow down' , ( ) => {
62+ it ( 'should move focus to the first button icon when the last button icon is focused and press arrow down' , async ( ) => {
6263 const accordion = new PageAccordion ( ACCORDION ) ;
63- const firstAccordionSection = accordion . getItem ( 0 ) ;
64- const lastAccordionSection = accordion . getItem ( 2 ) ;
65- lastAccordionSection . clickButton ( ) ;
66- browser . keys ( 'ArrowDown' ) ;
67- expect ( firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
64+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
65+ const lastAccordionSection = await accordion . getItem ( 2 ) ;
66+ await lastAccordionSection . clickButton ( ) ;
67+ await browser . keys ( 'ArrowDown' ) ;
68+ await expect ( await firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
6869 } ) ;
69- it ( 'should move focus to the next button icon when the first button icon is focused and press arrow right' , ( ) => {
70+ it ( 'should move focus to the next button icon when the first button icon is focused and press arrow right' , async ( ) => {
7071 const accordion = new PageAccordion ( ACCORDION ) ;
71- const firstAccordionSection = accordion . getItem ( 0 ) ;
72- const secondAccordionSection = accordion . getItem ( 1 ) ;
73- firstAccordionSection . clickButton ( ) ;
74- browser . keys ( 'ArrowRight' ) ;
75- expect ( secondAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
72+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
73+ const secondAccordionSection = await accordion . getItem ( 1 ) ;
74+ await firstAccordionSection . clickButton ( ) ;
75+ await browser . keys ( 'ArrowRight' ) ;
76+ await expect ( await secondAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
7677 } ) ;
77- it ( 'should move focus to the last button icon when the first button icon is focused and press arrow left' , ( ) => {
78+ it ( 'should move focus to the last button icon when the first button icon is focused and press arrow left' , async ( ) => {
7879 const accordion = new PageAccordion ( ACCORDION ) ;
79- const firstAccordionSection = accordion . getItem ( 0 ) ;
80- const lastAccordionSection = accordion . getItem ( 2 ) ;
81- firstAccordionSection . clickButton ( ) ;
82- browser . keys ( 'ArrowLeft' ) ;
83- expect ( lastAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
80+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
81+ const lastAccordionSection = await accordion . getItem ( 2 ) ;
82+ await firstAccordionSection . clickButton ( ) ;
83+ await browser . keys ( 'ArrowLeft' ) ;
84+ await expect ( await lastAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
8485 } ) ;
85- it ( 'should move focus to the previous button icon when the second button icon is focused and press arrow left' , ( ) => {
86+ it ( 'should move focus to the previous button icon when the second button icon is focused and press arrow left' , async ( ) => {
8687 const accordion = new PageAccordion ( ACCORDION ) ;
87- const firstAccordionSection = accordion . getItem ( 0 ) ;
88- const secondAccordionSection = accordion . getItem ( 1 ) ;
89- secondAccordionSection . clickButton ( ) ;
90- browser . keys ( 'ArrowLeft' ) ;
91- expect ( firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
88+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
89+ const secondAccordionSection = await accordion . getItem ( 1 ) ;
90+ await secondAccordionSection . clickButton ( ) ;
91+ await browser . keys ( 'ArrowLeft' ) ;
92+ await expect ( await firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
9293 } ) ;
93- it ( 'should move focus to the first button icon when the last button icon is focused and press arrow right' , ( ) => {
94+ it ( 'should move focus to the first button icon when the last button icon is focused and press arrow right' , async ( ) => {
9495 const accordion = new PageAccordion ( ACCORDION ) ;
95- const firstAccordionSection = accordion . getItem ( 0 ) ;
96- const lastAccordionSection = accordion . getItem ( 2 ) ;
97- lastAccordionSection . clickButton ( ) ;
98- browser . keys ( 'ArrowRight' ) ;
99- expect ( firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
96+ const firstAccordionSection = await accordion . getItem ( 0 ) ;
97+ const lastAccordionSection = await accordion . getItem ( 2 ) ;
98+ await lastAccordionSection . clickButton ( ) ;
99+ await browser . keys ( 'ArrowRight' ) ;
100+ await expect ( await firstAccordionSection . hasFocusButton ( ) ) . toBe ( true ) ;
100101 } ) ;
101102} ) ;
0 commit comments