Skip to content

Commit 3c579e4

Browse files
committed
test: remove expects from step defns
1 parent a51e8b6 commit 3c579e4

File tree

11 files changed

+151
-90
lines changed

11 files changed

+151
-90
lines changed

tests/e2e-playwright/specs/app-provider/lock.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ test.describe('lock', { tag: '@sse' }, () => {
9191
event: 'file-locked'
9292
})
9393
// And for "Alice" file "test.odt" should be locked
94-
await ui.resourceShouldBeLocked({
94+
await ui.resourceShouldBeLockedForUser({
9595
actorsEnvironment,
9696
stepUser: 'Alice',
9797
resource: 'test.odt'
@@ -158,7 +158,7 @@ test.describe('lock', { tag: '@sse' }, () => {
158158
event: 'file-unlocked'
159159
})
160160
// And for "Alice" file "test.odt" should not be locked
161-
await ui.resourceShouldNotBeLocked({
161+
await ui.resourceShouldNotBeLockedForUser({
162162
actorsEnvironment,
163163
stepUser: 'Alice',
164164
resource: 'test.odt'

tests/e2e-playwright/specs/app-provider/urlJourneys.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test.describe('url stability for mobile and desktop client', { tag: '@predefined
5656
]
5757
})
5858
// And for "Alice" file "MicrosoftWord.docx" should not be locked
59-
await ui.resourceShouldNotBeLocked({
59+
await ui.resourceShouldNotBeLockedForUser({
6060
actorsEnvironment,
6161
stepUser: 'Alice',
6262
resource: 'MicrosoftWord.docx'

tests/e2e-playwright/specs/app-store/details.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
32
import { config } from './../../../e2e/config.js'
43
import { ActorsEnvironment, UsersEnvironment } from '../../../e2e/support/environment'
@@ -51,12 +50,11 @@ test.describe('details', { tag: '@predefined-users' }, () => {
5150
})
5251

5352
// And "Admin" downloads app version "0.1.0"
54-
const downloadedVersion = await ui.userDownloadsAppVersion({
53+
await ui.userDownloadsAppVersion({
5554
actorsEnvironment,
5655
stepUser: 'Admin',
5756
version: '0.1.0'
5857
})
59-
expect(downloadedVersion).toContain('0.1.0')
6058

6159
// When "Admin" navigates back to the app store overview
6260
await ui.userNavigatesToAppStoreOverview({
@@ -68,12 +66,11 @@ test.describe('details', { tag: '@predefined-users' }, () => {
6866
await ui.userShouldSeeAppStore({ actorsEnvironment, stepUser: 'Admin' })
6967

7068
// And "Admin" downloads the latest version of the app "Development boilerplate"
71-
const downloadedApp = await ui.userDownloadsApp({
69+
await ui.userDownloadsApp({
7270
actorsEnvironment,
7371
stepUser: 'Admin',
7472
app: 'Development boilerplate'
7573
})
76-
expect(downloadedApp).toBeDefined()
7774

7875
// And "Admin" logs out
7976
await ui.userLogsOut({ actorsEnvironment, stepUser: 'Admin' })

tests/e2e-playwright/specs/app-store/discovery.spec.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
32
import { config } from '../../../e2e/config.js'
43
import { ActorsEnvironment, UsersEnvironment } from '../../../e2e/support/environment/index.js'
@@ -41,20 +40,23 @@ test.describe('details', { tag: '@predefined-users' }, () => {
4140
// | Draw.io |
4241
// | JSON Viewer |
4342
// | Unzip |
44-
let apps = await ui.userShouldSeeApps({ actorsEnvironment, stepUser: 'Admin' })
45-
expect(apps).toContain('Draw.io')
46-
expect(apps).toContain('JSON Viewer')
47-
expect(apps).toContain('Unzip')
43+
await ui.userShouldSeeApps({
44+
actorsEnvironment,
45+
stepUser: 'Admin',
46+
expectedApps: ['Draw.io', 'JSON Viewer', 'Unzip']
47+
})
4848

4949
// When "Admin" enters the search term "draw"
5050
await ui.userSetsSearchTerm({ actorsEnvironment, stepUser: 'Admin', searchTerm: 'draw' })
5151

5252
// Then "Admin" should see the following apps
5353
// | app |
5454
// | Draw.io |
55-
apps = []
56-
apps = await ui.userShouldSeeApps({ actorsEnvironment, stepUser: 'Admin' })
57-
expect(apps).toContain('Draw.io')
55+
await ui.userShouldSeeApps({
56+
actorsEnvironment,
57+
stepUser: 'Admin',
58+
expectedApps: ['Draw.io']
59+
})
5860

5961
// When "Admin" clicks on the tag "viewer" of the app "Draw.io"
6062
await ui.userSelectsAppTag({
@@ -68,10 +70,11 @@ test.describe('details', { tag: '@predefined-users' }, () => {
6870
// | app |
6971
// | JSON Viewer |
7072
// | Draw.io |
71-
apps = []
72-
apps = await ui.userShouldSeeApps({ actorsEnvironment, stepUser: 'Admin' })
73-
expect(apps).toContain('Draw.io')
74-
expect(apps).toContain('JSON Viewer')
73+
await ui.userShouldSeeApps({
74+
actorsEnvironment,
75+
stepUser: 'Admin',
76+
expectedApps: ['Draw.io', 'JSON Viewer']
77+
})
7578

7679
// When "Admin" clicks on the app "JSON Viewer"
7780
await ui.userSelectsApp({ actorsEnvironment, stepUser: 'Admin', app: 'JSON Viewer' })
@@ -93,10 +96,11 @@ test.describe('details', { tag: '@predefined-users' }, () => {
9396
// | app |
9497
// | JSON Viewer |
9598
// | Draw.io |
96-
apps = []
97-
apps = await ui.userShouldSeeApps({ actorsEnvironment, stepUser: 'Admin' })
98-
expect(apps).toContain('Draw.io')
99-
expect(apps).toContain('JSON Viewer')
99+
await ui.userShouldSeeApps({
100+
actorsEnvironment,
101+
stepUser: 'Admin',
102+
expectedApps: ['Draw.io', 'JSON Viewer']
103+
})
100104

101105
// And "Admin" logs out
102106
await ui.userLogsOut({ actorsEnvironment, stepUser: 'Admin' })

tests/e2e-playwright/specs/spaces/pagination.spec.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
32
import { config } from '../../../e2e/config.js'
43
import { ActorsEnvironment } from '../../../e2e/support/environment'
@@ -134,12 +133,11 @@ test.describe('check files pagination in project space', () => {
134133
await editor.close(page)
135134

136135
// Then "Alice" should be on page "2"
137-
const currentPage = await ui.getCurrentPageNumber({
136+
await ui.userShouldBeOnPage({
138137
actorsEnvironment,
139138
stepUser: 'Alice',
140139
pageNumber: '2'
141140
})
142-
expect(currentPage).toBe('2')
143141

144142
// When "Alice" changes the items per page to "500"
145143
await ui.userChangesItemsPerPage({ actorsEnvironment, stepUser: 'Alice', itemsPerPage: '500' })
@@ -148,14 +146,10 @@ test.describe('check files pagination in project space', () => {
148146
await ui.userShouldNotSeePagination({ actorsEnvironment, stepUser: 'Alice' })
149147

150148
// When "Alice" enables flat list
151-
await ui.userTogglesFlatList({ actorsEnvironment, stepUser: 'Alice' })
149+
await ui.userEnablesFlatList({ actorsEnvironment, stepUser: 'Alice' })
152150

153151
// Then "Alice" should see files being sorted in alphabetic order
154-
const allFiles = await ui.getFilesList({ actorsEnvironment, stepUser: 'Alice' })
155-
const sortedFiles = [...allFiles].sort((a, b) =>
156-
a.localeCompare(b, 'en-us', { numeric: true, ignorePunctuation: true })
157-
)
158-
expect(allFiles).toEqual(sortedFiles)
152+
await ui.userShouldSeeFilesSortedAlphabetically({ actorsEnvironment, stepUser: 'Alice' })
159153

160154
// And "Alice" logs out
161155
await ui.userLogsOut({ actorsEnvironment, stepUser: 'Alice' })

tests/e2e-playwright/specs/user-settings/languageChange.spec.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
32
import { config } from '../../../e2e/config.js'
43
import {
@@ -81,12 +80,18 @@ test.describe('language settings', { tag: '@predefined-users' }, () => {
8180
language: 'Deutsch - German'
8281
})
8382
// Then "Brian" should see the following account page title "Mein Konto"
84-
const actualTitle = await ui.getAccountPageTitle({ actorsEnvironment, stepUser: 'Brian' })
85-
expect(actualTitle).toEqual('Mein Konto')
83+
await ui.userShouldSeeAccountPageTitle({
84+
actorsEnvironment,
85+
stepUser: 'Brian',
86+
expectedTitle: 'Mein Konto'
87+
})
8688
// And "Brian" should see the following notifications
8789
// | Alice hat check_message mit Ihnen geteilt |
88-
const messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
89-
expect(messages).toContain('Alice Hansen hat check_message mit Ihnen geteilt')
90+
await ui.userShouldSeeNotifications({
91+
actorsEnvironment,
92+
stepUser: 'Brian',
93+
expectedMessages: ['Alice Hansen hat check_message mit Ihnen geteilt']
94+
})
9095
// And "Brian" logs out
9196
await ui.userLogsOut({ actorsEnvironment, stepUser: 'Brian' })
9297
})
@@ -142,7 +147,10 @@ test.describe('language settings', { tag: '@predefined-users' }, () => {
142147
language: 'Deutsch - German'
143148
})
144149
// Then "Anonymous" should see the following account page title "Mein Konto"
145-
const actualTitle = await ui.getAccountPageTitle({ actorsEnvironment, stepUser: 'Anonymous' })
146-
expect(actualTitle).toEqual('Mein Konto')
150+
await ui.userShouldSeeAccountPageTitle({
151+
actorsEnvironment,
152+
stepUser: 'Anonymous',
153+
expectedTitle: 'Mein Konto'
154+
})
147155
})
148156
})

tests/e2e-playwright/specs/user-settings/notifications.spec.ts

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
32
import { config } from './../../../e2e/config.js'
43
import {
@@ -140,16 +139,17 @@ test.describe('Notifications', () => {
140139
// | message |
141140
// | %user_alice_displayName% shared folder_to_shared with you |
142141
// | %user_alice_displayName% shared share_to_group with you |
143-
let messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
144-
expect(messages).toContain(
145-
substitute('%user_alice_displayName% shared folder_to_shared with you')
146-
)
147-
expect(messages).toContain(
148-
substitute('%user_alice_displayName% shared share_to_group with you')
149-
)
142+
await ui.userShouldSeeNotifications({
143+
actorsEnvironment,
144+
stepUser: 'Brian',
145+
expectedMessages: [
146+
substitute('%user_alice_displayName% shared folder_to_shared with you'),
147+
substitute('%user_alice_displayName% shared share_to_group with you')
148+
]
149+
})
150150

151151
// And "Brian" marks all notifications as read
152-
await ui.userMarksNotificationsAsRead({
152+
await ui.userMarksAllNotificationsAsRead({
153153
actorsEnvironment,
154154
stepUser: 'Brian'
155155
})
@@ -183,21 +183,23 @@ test.describe('Notifications', () => {
183183
})
184184

185185
// Then "Alice" should see no notifications
186-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Alice' })
187-
expect(messages).toHaveLength(0)
186+
await ui.userShouldSeeNoNotifications({ actorsEnvironment, stepUser: 'Alice' })
188187

189188
// And "Brian" should see the following notifications
190189
// | message |
191190
// | %user_alice_displayName% unshared folder_to_shared with you |
192191
// | %user_alice_displayName% added you to Space team |
193-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
194-
expect(messages).toContain(
195-
substitute('%user_alice_displayName% unshared folder_to_shared with you')
196-
)
197-
expect(messages).toContain(substitute('%user_alice_displayName% added you to Space team'))
192+
await ui.userShouldSeeNotifications({
193+
actorsEnvironment,
194+
stepUser: 'Brian',
195+
expectedMessages: [
196+
substitute('%user_alice_displayName% unshared folder_to_shared with you'),
197+
substitute('%user_alice_displayName% added you to Space team')
198+
]
199+
})
198200

199201
// And "Brian" marks all notifications as read
200-
await ui.userMarksNotificationsAsRead({
202+
await ui.userMarksAllNotificationsAsRead({
201203
actorsEnvironment,
202204
stepUser: 'Brian'
203205
})
@@ -220,9 +222,14 @@ test.describe('Notifications', () => {
220222
// | message |
221223
// | %user_alice_displayName% added you to Space team |
222224
// | %user_alice_displayName% removed you from Space team |
223-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Carol' })
224-
expect(messages).toContain(substitute('%user_alice_displayName% added you to Space team'))
225-
expect(messages).toContain(substitute('%user_alice_displayName% removed you from Space team'))
225+
await ui.userShouldSeeNotifications({
226+
actorsEnvironment,
227+
stepUser: 'Carol',
228+
expectedMessages: [
229+
substitute('%user_alice_displayName% added you to Space team'),
230+
substitute('%user_alice_displayName% removed you from Space team')
231+
]
232+
})
226233

227234
// When "Alice" opens the "admin-settings" app
228235
await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' })
@@ -241,8 +248,11 @@ test.describe('Notifications', () => {
241248
// Then "Brian" should see the following notifications
242249
// | message |
243250
// | %user_alice_displayName% disabled Space team |
244-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
245-
expect(messages).toContain(substitute('%user_alice_displayName% disabled Space team'))
251+
await ui.userShouldSeeNotifications({
252+
actorsEnvironment,
253+
stepUser: 'Brian',
254+
expectedMessages: [substitute('%user_alice_displayName% disabled Space team')]
255+
})
246256

247257
// When "Alice" deletes the space "team.1" using the context-menu
248258
await ui.userManagesSpaceUsingContexMenu({
@@ -255,8 +265,11 @@ test.describe('Notifications', () => {
255265
// Then "Brian" should see the following notifications
256266
// | message |
257267
// | %user_alice_displayName% deleted Space team |
258-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
259-
expect(messages).toContain(substitute('%user_alice_displayName% deleted Space team'))
268+
await ui.userShouldSeeNotifications({
269+
actorsEnvironment,
270+
stepUser: 'Brian',
271+
expectedMessages: [substitute('%user_alice_displayName% deleted Space team')]
272+
})
260273

261274
await api.userHasDeletedGroup({ usersEnvironment, stepUser: 'Admin', name: 'sales' })
262275
})
@@ -384,8 +397,7 @@ test.describe('Notifications', () => {
384397
})
385398

386399
// Then "Alice" should see no notifications
387-
let messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
388-
expect(messages).toHaveLength(0)
400+
await ui.userShouldSeeNoNotifications({ actorsEnvironment, stepUser: 'Brian' })
389401

390402
// When "Alice" opens the "admin-settings" app
391403
await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' })
@@ -410,7 +422,6 @@ test.describe('Notifications', () => {
410422
})
411423

412424
// Then "Carol" should see no notifications
413-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Carol' })
414-
expect(messages).toHaveLength(0)
425+
await ui.userShouldSeeNoNotifications({ actorsEnvironment, stepUser: 'Carol' })
415426
})
416427
})

tests/e2e-playwright/steps/ui/account.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect } from '@playwright/test'
12
import { objects } from '../../../e2e/support'
23
import { ActorsEnvironment } from '../../../e2e/support/environment'
34

@@ -16,16 +17,19 @@ export async function userChangesLanguage({
1617
await accountObject.changeLanguage(language, isAnonymousUser)
1718
}
1819

19-
export async function getAccountPageTitle({
20+
export async function userShouldSeeAccountPageTitle({
2021
actorsEnvironment,
21-
stepUser
22+
stepUser,
23+
expectedTitle
2224
}: {
2325
actorsEnvironment: ActorsEnvironment
2426
stepUser: string
25-
}): Promise<string> {
27+
expectedTitle: string
28+
}): Promise<void> {
2629
const { page } = actorsEnvironment.getActor({ key: stepUser })
2730
const accountObject = new objects.account.Account({ page })
28-
return await accountObject.getTitle()
31+
const actualTitle = await accountObject.getTitle()
32+
expect(actualTitle).toEqual(expectedTitle)
2933
}
3034

3135
export async function userRequestsGdprExport({
@@ -52,7 +56,7 @@ export async function userDownloadsGdprExport({
5256
await accountObject.downloadGdprExport()
5357
}
5458

55-
export async function userMarksNotificationsAsRead({
59+
export async function userMarksAllNotificationsAsRead({
5660
actorsEnvironment,
5761
stepUser
5862
}: {

0 commit comments

Comments
 (0)