Skip to content

Commit 84e9782

Browse files
chore: update webdriverio and update tests (#2417)
* chore: update webdriverio to v7 * chore: migrate all integration tests to async mode * chore: trigger ci * chore: update CI to node 12.22.12 * chore: fix run integration test command in CI * chore: use latest chrome version * chore: use latest chrome version * chore: use latest chrome version * chore: add wait-on local server commando * chore: upgrade CI to node 14 * chore: update node Co-authored-by: LeandroTorresSicilia <jtorressicilia@gmail.com>
1 parent ff609a5 commit 84e9782

File tree

135 files changed

+5542
-4854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+5542
-4854
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ references:
77
defaults: &defaults
88
working_directory: ~/repo
99
docker:
10-
- image: cimg/node:12.19.0-browsers
10+
- image: cimg/node:12.22.12-browsers
1111
resource_class: medium+
1212

1313
create_env_file: &create_env_file
@@ -74,18 +74,18 @@ jobs:
7474
- run: yarn install
7575

7676
- browser-tools/install-chrome:
77-
chrome-version: 100.0.4896.127
77+
chrome-version: 103.0.5060.53
7878

7979
- run:
8080
command: yarn start
8181
background: true
8282

83-
- run: sleep 10
83+
- run: yarn wait:on:local:server
8484

8585
- run:
8686
name: run integration test
8787
command: |
88-
yarn test:integration --headless || true
88+
yarn test:integration --headless
8989
- run:
9090
name: generate report
9191
command: |

.github/workflows/firebase-hosting-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-node@v2
1212
with:
13-
node-version: '12'
13+
node-version: '14'
1414
- run: 'yarn install'
1515
- run: 'yarn build:library'
1616
- uses: FirebaseExtended/action-hosting-deploy@v0

integration/constants.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
module.exports = {
2-
TAB_KEY: '\uE004',
3-
ENTER_KEY: '\uE006',
4-
ESCAPE_KEY: '\uE00C',
5-
SPACE_KEY: '\uE00D',
6-
ARROW_LEFT_KEY: '\uE012',
7-
ARROW_UP_KEY: '\uE013',
8-
ARROW_RIGHT_KEY: '\uE014',
9-
ARROW_DOWN_KEY: '\uE015',
10-
SHIFT_KEY: '\uE008',
11-
DELETE_KEY: '\ue003',
12-
PAGEUP_KEY: '\uE00E',
13-
PAGEDOWN_KEY: '\uE00F',
14-
END_KEY: '\uE010',
15-
HOME_KEY: '\uE011',
16-
ALT_KEY: '\uE00A',
2+
TAB_KEY: 'Tab',
3+
ENTER_KEY: 'Enter',
4+
ESCAPE_KEY: 'Escape',
5+
SPACE_KEY: 'Space',
6+
ARROW_LEFT_KEY: 'ArrowLeft',
7+
ARROW_UP_KEY: 'ArrowUp',
8+
ARROW_RIGHT_KEY: 'ArrowRight',
9+
ARROW_DOWN_KEY: 'ArrowDown',
10+
SHIFT_KEY: 'Shift',
11+
DELETE_KEY: 'Delete',
12+
PAGEUP_KEY: 'PageUp',
13+
PAGEDOWN_KEY: 'PageDown',
14+
END_KEY: 'End',
15+
HOME_KEY: 'Home',
16+
ALT_KEY: 'Alt',
17+
BACKSPACE_KEY: 'Backspace',
18+
// Unicode key points
19+
SHIFT_KEY_UNICODE: '\uE008',
1720
};

integration/helpers/holdDownKey.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function holdDownKey(character) {
2-
browser.performActions([
1+
async function holdDownKey(character) {
2+
await browser.performActions([
33
{
44
type: 'key',
55
id: 'keyboard',

integration/helpers/releaseKey.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function releaseKey(character) {
2-
browser.performActions([
1+
async function releaseKey(character) {
2+
await browser.performActions([
33
{
44
type: 'key',
55
id: 'keyboard',

integration/specs/Accordion/accordion-1.spec.js

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,99 +3,100 @@ const PageAccordion = require('../../../src/components/Accordion/pageObject');
33
const ACCORDION = '#accordion-1';
44

55
describe('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
});

integration/specs/Accordion/accordion-11.spec.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,47 @@ const ACCORDION = '#accordion-11';
55
const addAdvancedSettings = () => $('#button-icon_add-new-advanced-settings').click();
66

77
describe('Accordion with AccordionOption changed dynamically', () => {
8-
beforeAll(() => {
9-
browser.url('/#!/Accordion/11');
8+
beforeAll(async () => {
9+
await browser.url('/#!/Accordion/11');
1010
});
11-
beforeEach(() => {
12-
browser.refresh();
13-
const component = $(ACCORDION);
14-
component.waitForExist();
11+
beforeEach(async () => {
12+
await browser.refresh();
13+
const component = await $(ACCORDION);
14+
await component.waitForExist();
1515
});
1616

17-
it('should select the new option with keyboard after it is added dynamically', () => {
17+
it('should select the new option with keyboard after it is added dynamically', async () => {
1818
const accordion = new PageAccordion(ACCORDION);
19-
const firstSection = accordion.getItem(0);
20-
firstSection.clickButton();
21-
browser.keys('ArrowDown');
22-
browser.keys('Enter');
23-
const secondSection = accordion.getItem(1);
24-
expect(secondSection.isExpanded()).toBe(true);
25-
expect(secondSection.getLabel()).toBe('Personal Profile');
26-
browser.refresh();
27-
addAdvancedSettings();
28-
firstSection.clickButton();
29-
browser.keys('ArrowDown');
30-
browser.keys('Enter');
31-
expect(secondSection.isExpanded()).toBe(true);
32-
expect(secondSection.getLabel()).toBe('Advanced Settings');
19+
const firstSection = await accordion.getItem(0);
20+
await firstSection.clickButton();
21+
await browser.keys('ArrowDown');
22+
await browser.keys('Enter');
23+
const secondSection = await accordion.getItem(1);
24+
await expect(await secondSection.isExpanded()).toBe(true);
25+
await expect(await secondSection.getLabel()).toBe('Personal Profile');
26+
await browser.refresh();
27+
await addAdvancedSettings();
28+
await firstSection.clickButton();
29+
await browser.keys('ArrowDown');
30+
await browser.keys('Enter');
31+
await expect(await secondSection.isExpanded()).toBe(true);
32+
await expect(await secondSection.getLabel()).toBe('Advanced Settings');
3333
});
34-
it('should select the second option with keyboard after it is added and removed dynamically a new element', () => {
34+
it('should select the second option with keyboard after it is added and removed dynamically a new element', async () => {
3535
const accordion = new PageAccordion(ACCORDION);
36-
addAdvancedSettings();
37-
const firstSection = accordion.getItem(0);
38-
firstSection.clickButton();
39-
browser.keys('ArrowDown');
40-
browser.keys('Enter');
41-
const secondSection = accordion.getItem(1);
42-
expect(secondSection.isExpanded()).toBe(true);
43-
expect(secondSection.getLabel()).toBe('Advanced Settings');
44-
addAdvancedSettings();
45-
firstSection.clickButton();
46-
browser.keys('ArrowDown');
47-
browser.keys('Enter');
48-
expect(secondSection.isExpanded()).toBe(true);
49-
expect(secondSection.getLabel()).toBe('Personal Profile');
36+
await addAdvancedSettings();
37+
const firstSection = await accordion.getItem(0);
38+
await firstSection.clickButton();
39+
await browser.keys('ArrowDown');
40+
await browser.keys('Enter');
41+
const secondSection = await accordion.getItem(1);
42+
await expect(await secondSection.isExpanded()).toBe(true);
43+
await expect(await secondSection.getLabel()).toBe('Advanced Settings');
44+
await addAdvancedSettings();
45+
await firstSection.clickButton();
46+
await browser.keys('ArrowDown');
47+
await browser.keys('Enter');
48+
await expect(await secondSection.isExpanded()).toBe(true);
49+
await expect(await secondSection.getLabel()).toBe('Personal Profile');
5050
});
5151
});

integration/specs/Accordion/accordion-5.spec.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ const PageAccordion = require('../../../src/components/Accordion/pageObject');
33
const ACCORDION = '#accordion-multiple-1';
44

55
describe('Accordion when multiple is passed', () => {
6-
beforeAll(() => {
7-
browser.url('/#!/Accordion/5');
6+
beforeAll(async () => {
7+
await browser.url('/#!/Accordion/5');
88
});
9-
beforeEach(() => {
10-
browser.refresh();
11-
const component = $(ACCORDION);
12-
component.waitForExist();
9+
beforeEach(async () => {
10+
await browser.refresh();
11+
const component = await $(ACCORDION);
12+
await component.waitForExist();
1313
});
1414

15-
it('should collapse the accordion section when the accordion section is expanded and click on the button icon', () => {
15+
it('should collapse the accordion section when the accordion section is expanded and click on the button icon', async () => {
1616
const accordion = new PageAccordion(ACCORDION);
17-
const accordionSection = accordion.getItem(0);
18-
accordionSection.clickButton();
19-
expect(accordionSection.isExpanded()).toBe(false);
17+
const accordionSection = await accordion.getItem(0);
18+
await accordionSection.clickButton();
19+
await expect(await accordionSection.isExpanded()).toBe(false);
2020
});
21-
it('should expand all accordion section when the first and second accordion section are expanded and click on the third button icon', () => {
21+
it('should expand all accordion section when the first and second accordion section are expanded and click on the third button icon', async () => {
2222
const accordion = new PageAccordion(ACCORDION);
23-
const firstAccordionSection = accordion.getItem(0);
24-
const secondAccordionSection = accordion.getItem(1);
25-
const thirdAccordionSection = accordion.getItem(2);
26-
thirdAccordionSection.clickButton();
27-
expect(firstAccordionSection.isExpanded()).toBe(true);
28-
expect(secondAccordionSection.isExpanded()).toBe(true);
29-
expect(thirdAccordionSection.isExpanded()).toBe(true);
23+
const firstAccordionSection = await accordion.getItem(0);
24+
const secondAccordionSection = await accordion.getItem(1);
25+
const thirdAccordionSection = await accordion.getItem(2);
26+
await thirdAccordionSection.clickButton();
27+
await expect(await firstAccordionSection.isExpanded()).toBe(true);
28+
await expect(await secondAccordionSection.isExpanded()).toBe(true);
29+
await expect(await thirdAccordionSection.isExpanded()).toBe(true);
3030
});
3131
});

0 commit comments

Comments
 (0)