Skip to content

Commit 41dea25

Browse files
committed
test(tap): webdriverio v7 migration
1 parent 0a0c6cf commit 41dea25

File tree

3 files changed

+70
-62
lines changed

3 files changed

+70
-62
lines changed

test/journeys/specs/tap/widget-recents/index.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ import {
1717
} from '../../../lib/test-helpers/recents-widget';
1818

1919
describe('Widget Recents', () => {
20-
const browserLocal = browser.select('browserLocal');
2120
let docbrown, lorraine, marty;
2221
let conversation, oneOnOneConversation;
2322

2423
before('load browser', () => {
25-
browserLocal
26-
.url('/widget-demo/production/index.html')
27-
.execute(() => {
28-
localStorage.clear();
29-
});
24+
browserLocal.url('/widget-demo/production/index.html');
25+
browserLocal.execute(() => {
26+
localStorage.clear();
27+
});
3028
});
3129

3230
before('create marty', () => testUsers.create({count: 1, config: {displayName: 'Marty McFly'}})
@@ -90,7 +88,7 @@ describe('Widget Recents', () => {
9088
lorraine.spark.internal.mercury.disconnect(),
9189
docbrown.spark.internal.mercury.disconnect(),
9290
// Demos use cookies to save state, clear before moving on
93-
browser.deleteCookie()
91+
browser.deleteCookies()
9492
]));
9593

9694
before('create group space', () => marty.spark.internal.conversation.create({
@@ -155,7 +153,7 @@ describe('Widget Recents', () => {
155153

156154
it('rooms:selected', () => {
157155
clearEventLog(browserLocal);
158-
browserLocal.click(elements.firstSpace);
156+
browserLocal.$(elements.firstSpace).click();
159157
assert.isTrue(getEventLog(browserLocal).some((event) => event.eventName === 'rooms:selected'), 'event was not seen');
160158
});
161159

@@ -183,7 +181,10 @@ describe('Widget Recents', () => {
183181
// Remove user from room
184182
clearEventLog(browserLocal);
185183
waitForPromise(lorraine.spark.internal.conversation.leave(kickedConversation, marty));
186-
browserLocal.waitUntil(() => browserLocal.getText(`${elements.firstSpace} ${elements.title}`) !== roomTitle);
184+
browserLocal.waitUntil(
185+
() => browserLocal.$(`${elements.firstSpace} ${elements.title}`).getText() !== roomTitle,
186+
{}
187+
);
187188
assert.isTrue(getEventLog(browserLocal).some((event) => event.eventName === 'memberships:deleted'), 'event was not seen');
188189
});
189190
});

test/journeys/specs/tap/widget-space/oneOnOne.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ import loginAndOpenWidget from '../../../lib/test-helpers/tap/space';
88
import {setupOneOnOneUsers} from '../../../lib/test-users';
99

1010
describe('Widget Space: One on One: TAP', () => {
11-
const browserLocal = browser.select('browserLocal');
12-
const browserRemote = browser.select('browserRemote');
1311
let local, localUser, remote, remoteUser;
1412

1513
before('load browsers', () => {
16-
browser
17-
.url('/widget-demo/production/index.html?oneOnOne')
18-
.execute(() => {
19-
localStorage.clear();
20-
});
14+
browser.url('/widget-demo/production/index.html?oneOnOne');
15+
browser.execute(() => {
16+
localStorage.clear();
17+
});
2118
});
2219

2320
before('create test users', () => {
@@ -28,39 +25,43 @@ describe('Widget Space: One on One: TAP', () => {
2825

2926
before('inject token for local user', () => {
3027
loginAndOpenWidget(local.browser, local.user.token.access_token, true, remote.user.email);
31-
local.browser.waitForExist(`[placeholder="Send a message to ${remote.displayName}"]`, 30000);
28+
local.browser.$(`[placeholder="Send a message to ${remote.displayName}"]`).waitForExist({
29+
timeout: 30000
30+
});
3231
});
3332

3433
before('open remote widget for remote user', () => {
3534
loginAndOpenWidget(remote.browser, remote.user.token.access_token, true, local.user.email);
36-
remote.browser.waitForExist(`[placeholder="Send a message to ${local.displayName}"]`, 30000);
35+
remote.browser.$(`[placeholder="Send a message to ${local.displayName}"]`).waitForExist({
36+
timeout: 30000
37+
});
3738
});
3839

3940
before('stick widgets to bottom of viewport', () => {
40-
local.browser.waitForVisible(basicElements.stickyButton);
41-
local.browser.click(basicElements.stickyButton);
42-
remote.browser.waitForVisible(basicElements.stickyButton);
43-
remote.browser.click(basicElements.stickyButton);
41+
local.browser.$(basicElements.stickyButton).waitForDisplayed();
42+
local.browser.$(basicElements.stickyButton).click();
43+
remote.browser.$(basicElements.stickyButton).waitForDisplayed();
44+
remote.browser.$(basicElements.stickyButton).click();
4445
});
4546

4647
// Demos use cookies to save state, clear before moving on
47-
after('delete cookies', () => browser.deleteCookie());
48+
after('delete cookies', () => browser.deleteCookies());
4849

4950
describe('Tab Menu', () => {
5051
it('switches to message widget', () => {
51-
local.browser.element(basicElements.controlsContainer).element(basicElements.messageActivityButton).click();
52-
assert.isTrue(local.browser.isVisible(basicElements.messageWidget));
53-
assert.isFalse(local.browser.isVisible(basicElements.meetWidget));
52+
local.browser.$(basicElements.controlsContainer).$(basicElements.messageActivityButton).click();
53+
assert.isTrue(local.browser.$(basicElements.messageWidget).isDisplayed());
54+
assert.isFalse(local.browser.$(basicElements.meetWidget).isDisplayed());
5455
});
5556

5657
it('has a meet button', () => {
57-
local.browser.element(basicElements.controlsContainer).element(basicElements.meetActivityButton).waitForVisible();
58+
local.browser.$(basicElements.controlsContainer).$(basicElements.meetActivityButton).waitForDisplayed();
5859
});
5960

6061
it('switches to meet widget', () => {
61-
local.browser.element(basicElements.controlsContainer).element(basicElements.meetActivityButton).click();
62-
assert.isTrue(local.browser.isVisible(basicElements.meetWidget));
63-
assert.isFalse(local.browser.isVisible(basicElements.messageWidget));
62+
local.browser.$(basicElements.controlsContainer).$(basicElements.meetActivityButton).click();
63+
assert.isTrue(local.browser.$(basicElements.meetWidget).isDisplayed());
64+
assert.isFalse(local.browser.$(basicElements.messageWidget).isDisplayed());
6465
});
6566
});
6667

@@ -94,7 +95,7 @@ describe('Widget Space: One on One: TAP', () => {
9495
describe('pre call experience', () => {
9596
it('has a call button', () => {
9697
switchToMeet(local.browser);
97-
local.browser.element(elements.meetWidget).element(elements.callButton).waitForVisible();
98+
local.browser.$(elements.meetWidget).$(elements.callButton).waitForDisplayed();
9899
});
99100
});
100101

test/journeys/specs/tap/widget-space/space.js

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,18 @@ import loginAndOpenWidget from '../../../lib/test-helpers/tap/space';
1111
import {createSpace, disconnectDevices, registerDevices, setupGroupTestUsers} from '../../../lib/test-users';
1212

1313
describe('Widget Space: Group Space: TAP', () => {
14-
const browserLocal = browser.select('browserLocal');
15-
const browserRemote = browser.select('browserRemote');
1614
let docbrown, lorraine, marty;
1715
let conversation, local, remote, participants;
1816

1917
before('load browsers', () => {
20-
browserLocal
21-
.url('/widget-demo/production/index.html?space&local')
22-
.execute(() => {
23-
localStorage.clear();
24-
});
25-
browserRemote
26-
.url('/widget-demo/production/index.html?space&remote')
27-
.execute(() => {
28-
localStorage.clear();
29-
});
18+
browserLocal.url('/widget-demo/production/index.html?space&local');
19+
browserLocal.execute(() => {
20+
localStorage.clear();
21+
});
22+
browserRemote.url('/widget-demo/production/index.html?space&remote');
23+
browserRemote.execute(() => {
24+
localStorage.clear();
25+
});
3026
});
3127

3228
before('create test users and spaces', () => {
@@ -41,54 +37,64 @@ describe('Widget Space: Group Space: TAP', () => {
4137
before('inject marty token', () => {
4238
local = {browser: browserLocal, user: marty, displayName: conversation.displayName};
4339
loginAndOpenWidget(local.browser, marty.token.access_token, false, conversation.hydraId);
44-
local.browser.waitForExist(`[placeholder="Send a message to ${conversation.displayName}"]`, 30000);
40+
local.browser.$(`[placeholder="Send a message to ${conversation.displayName}"]`).waitForExist({
41+
timeout: 30000
42+
});
4543
});
4644

4745
before('inject docbrown token', () => {
4846
remote = {browser: browserRemote, user: docbrown, displayName: conversation.displayName};
4947
loginAndOpenWidget(remote.browser, docbrown.token.access_token, false, conversation.hydraId);
50-
remote.browser.waitForExist(`[placeholder="Send a message to ${conversation.displayName}"]`, 30000);
48+
remote.browser.$(`[placeholder="Send a message to ${conversation.displayName}"]`).waitForExist({
49+
timeout: 30000
50+
});
5151
});
5252

5353
before('stick widgets to bottom of viewport', () => {
54-
local.browser.waitForVisible(elements.stickyButton);
55-
local.browser.click(elements.stickyButton);
56-
remote.browser.waitForVisible(elements.stickyButton);
57-
remote.browser.click(elements.stickyButton);
54+
local.browser.$(elements.stickyButton).waitForDisplayed();
55+
local.browser.$(elements.stickyButton).click();
56+
remote.browser.$(elements.stickyButton).waitForDisplayed();
57+
remote.browser.$(elements.stickyButton).click();
5858
});
5959

6060
after('disconnect', () => Promise.all([
6161
disconnectDevices(participants),
6262
// Demos use cookies to save state, clear before moving on
63-
browserLocal.deleteCookie(),
64-
browserRemote.deleteCookie()
63+
browserLocal.deleteCookies(),
64+
browserRemote.deleteCookies()
6565
]));
6666

6767
describe('Activity Section', () => {
6868
it('has a message button', () => {
6969
local.browser
70-
.element(elements.messageActivityButton)
71-
.waitForVisible();
70+
.$(elements.messageActivityButton)
71+
.waitForDisplayed();
7272
});
7373

7474
it('switches to message widget', () => {
75-
local.browser.element(elements.messageActivityButton).click();
75+
local.browser.$(elements.messageActivityButton).click();
7676
// Activity menu animates the hide, wait for it to be gone
77-
local.browser.waitForVisible(elements.activityMenu, 1500, true);
78-
assert.isTrue(local.browser.isVisible(elements.messageWidget));
79-
assert.isFalse(local.browser.isVisible(elements.meetWidget));
77+
local.browser.$(elements.activityMenu).waitForDisplayed({
78+
timeout: 1500,
79+
reverse: true
80+
});
81+
assert.isTrue(local.browser.$(elements.messageWidget).isDisplayed());
82+
assert.isFalse(local.browser.$(elements.meetWidget).isDisplayed());
8083
});
8184

8285
it('has a meet button', () => {
83-
local.browser.element(elements.meetActivityButton).waitForVisible();
86+
local.browser.$(elements.meetActivityButton).waitForDisplayed();
8487
});
8588

8689
it('switches to meet widget', () => {
87-
local.browser.element(elements.meetActivityButton).click();
90+
local.browser.$(elements.meetActivityButton).click();
8891
// Activity menu animates the hide, wait for it to be gone
89-
local.browser.waitForVisible(elements.activityMenu, 1500, true);
90-
assert.isTrue(local.browser.isVisible(elements.meetWidget));
91-
assert.isFalse(local.browser.isVisible(elements.messageWidget));
92+
local.browser.$(elements.activityMenu).waitForDisplayed({
93+
timeout: 1500,
94+
reverse: true
95+
});
96+
assert.isTrue(local.browser.$(elements.meetWidget).isDisplayed());
97+
assert.isFalse(local.browser.$(elements.messageWidget).isDisplayed());
9298
});
9399
});
94100

0 commit comments

Comments
 (0)