Skip to content

Commit 0ac444b

Browse files
Merge pull request #13543 from owncloud/ci/detect-invalid-suite
[tests-only][full-ci] ci: fail ci if there are any invalid suite config
2 parents a96fe69 + fbc4ebd commit 0ac444b

12 files changed

Lines changed: 60 additions & 28 deletions

.drone.star

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ config = {
205205
},
206206
"oidc-iframe": {
207207
"skip": False,
208-
"feature": [
208+
"features": [
209209
"specs/oidc/iframeTokenRenewal.spec.ts",
210210
],
211211
"extraServerEnvironment": {
@@ -642,7 +642,20 @@ def e2eTestsOnPlaywright(ctx):
642642
steps += filterTestSuitesToRun(ctx, params["features"])
643643
else:
644644
print("Error: No suites or features defined for e2e test suite '%s'" % suite)
645-
return []
645+
pipelines.append({
646+
"kind": "pipeline",
647+
"type": "docker",
648+
"name": "invalid-suite-%s" % suite,
649+
"steps": [{
650+
"name": "invalid-suite",
651+
"image": OC_CI_ALPINE_IMAGE,
652+
"commands": [
653+
"echo \"Error: No suites or features defined for e2e test suite '%s'\"" % suite,
654+
"exit 1",
655+
],
656+
}],
657+
"trigger": base_trigger,
658+
})
646659

647660
steps += restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + \
648661
installPnpm() + \
@@ -657,10 +670,10 @@ def e2eTestsOnPlaywright(ctx):
657670
if "keycloak" in suite:
658671
environment["KEYCLOAK"] = "true"
659672
environment["KEYCLOAK_HOST"] = "keycloak:8443"
660-
e2e_volumes += [{
673+
e2e_volumes.append({
661674
"name": "certs",
662675
"temp": {},
663-
}]
676+
})
664677
steps += keycloakService()
665678
services += postgresService()
666679

@@ -683,7 +696,7 @@ def e2eTestsOnPlaywright(ctx):
683696
steps += (tikaService() if params["tikaNeeded"] else []) + \
684697
ocisService(params["extraServerEnvironment"])
685698

686-
steps += [{
699+
steps.append({
687700
"name": "e2e-tests",
688701
"image": OC_CI_NODEJS_IMAGE,
689702
"environment": environment,
@@ -692,7 +705,7 @@ def e2eTestsOnPlaywright(ctx):
692705
"cd tests/e2e",
693706
"bash run-e2e.sh --type playwright",
694707
],
695-
}]
708+
})
696709

697710
if not "skip-a11y" in ctx.build.title.lower():
698711
steps += uploadA11yResult(ctx) + logA11yReport()
@@ -705,6 +718,7 @@ def e2eTestsOnPlaywright(ctx):
705718
"type": "docker",
706719
"name": "e2e-pw-%s" % suite,
707720
"workspace": web_workspace,
721+
"environment": environment,
708722
"steps": steps,
709723
"depends_on": ["cache-ocis"],
710724
"trigger": base_trigger,
@@ -774,7 +788,20 @@ def e2eTests(ctx):
774788
steps += filterTestSuitesToRun(ctx, params["features"])
775789
else:
776790
print("Error: No suites or features defined for e2e test suite '%s'" % suite)
777-
return []
791+
pipelines.append({
792+
"kind": "pipeline",
793+
"type": "docker",
794+
"name": "invalid-suite-%s" % suite,
795+
"steps": [{
796+
"name": "invalid-suite",
797+
"image": OC_CI_ALPINE_IMAGE,
798+
"commands": [
799+
"echo \"Error: No suites or features defined for e2e test suite '%s'\"" % suite,
800+
"exit 1",
801+
],
802+
}],
803+
"trigger": base_trigger,
804+
})
778805

779806
steps += restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + \
780807
installPnpm() + \
@@ -789,10 +816,10 @@ def e2eTests(ctx):
789816
if "keycloak" in suite:
790817
environment["KEYCLOAK"] = "true"
791818
environment["KEYCLOAK_HOST"] = "keycloak:8443"
792-
e2e_volumes += [{
819+
e2e_volumes.append({
793820
"name": "certs",
794821
"temp": {},
795-
}]
822+
})
796823
steps += keycloakService()
797824
services += postgresService()
798825

tests/e2e-playwright/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineConfig({
2525
retries: config.retry,
2626

2727
// Opt out of parallel tests on CI.
28-
workers: process.env.CI ? 1 : undefined,
28+
workers: 1,
2929

3030
// Reporter to use
3131
reporter: [

tests/e2e-playwright/specs/navigation/personalSpacePagination.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,20 @@ test.describe('Personal space pagination', { tag: '@predefined-users' }, () => {
4040
await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' })
4141

4242
// And "Alice" creates 15 folders in personal space using API
43-
for (let i = 0; i < 15; i++) {
43+
for (let i = 1; i <= 15; i++) {
4444
await api.userHasCreatedFolder({
4545
usersEnvironment,
4646
stepUser: 'Alice',
4747
folderName: `folder${i}`
4848
})
4949
}
5050
// And "Alice" creates 10 files in personal space using API
51-
for (let i = 0; i < 15; i++) {
51+
for (let i = 1; i <= 10; i++) {
5252
await api.userHasCreatedFile({
5353
usersEnvironment,
5454
stepUser: 'Alice',
55-
filename: `file${i}`
55+
filename: `file${i}`,
56+
content: `This is a test file${i}`
5657
})
5758
}
5859
// And "Alice" creates the following files into personal space using API
@@ -91,7 +92,7 @@ test.describe('Personal space pagination', { tag: '@predefined-users' }, () => {
9192
expectedNumberOfResources: 6
9293
})
9394
// When "Alice" changes the items per page to "500"
94-
await ui.changeItemsPerPage({ actorsEnvironment, stepUser: 'Alice', itemsPerPage: '20' })
95+
await ui.changeItemsPerPage({ actorsEnvironment, stepUser: 'Alice', itemsPerPage: '500' })
9596

9697
// Then "Alice" should not see the pagination in the personal space files view
9798
await ui.expectPageNumberNotToBeVisible({ actorsEnvironment, stepUser: 'Alice' })

tests/e2e-playwright/specs/oidc/iframeTokenRenewal.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from '@playwright/test'
1+
import { test, expect } from '@playwright/test'
22
import { config } from './../../../e2e/config.js'
33
import { ActorsEnvironment, UsersEnvironment } from '../../../e2e/support/environment'
44
import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken'

tests/e2e-playwright/specs/oidc/refreshToken.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ test.describe('details', () => {
2727
})
2828

2929
test.afterEach(async () => {
30+
await setAccessAndRefreshToken(usersEnvironment)
3031
await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Alice' })
3132
})
3233

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from '@playwright/test'
1+
import { test, expect } from '@playwright/test'
22
import { config } from './../../../e2e/config.js'
33
import {
44
ActorsEnvironment,
@@ -84,7 +84,7 @@ test.describe('create Space shortcut', () => {
8484
actorsEnvironment,
8585
filesEnvironment,
8686
stepUser: 'Alice',
87-
resource: 'lorem.zip',
87+
resource: 'lorem.txt',
8888
to: 'spaceFolder'
8989
})
9090

@@ -141,19 +141,19 @@ test.describe('create Space shortcut', () => {
141141
// And "Alice" uploads the following resources
142142
// | resource | to |
143143
// | data.zip | resourceFolder |
144-
// | lorem.txt | spaceFolder |
144+
// | lorem.txt | |
145145
await ui.uploadResource({
146146
actorsEnvironment,
147147
filesEnvironment,
148148
stepUser: 'Alice',
149149
resource: 'data.zip',
150-
to: 'spaceFolder'
150+
to: 'resourceFolder'
151151
})
152152
await ui.uploadResource({
153153
actorsEnvironment,
154154
filesEnvironment,
155155
stepUser: 'Alice',
156-
resource: 'lorem.zip',
156+
resource: 'lorem.txt',
157157
to: ''
158158
})
159159

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from '@playwright/test'
1+
import { test, expect } from '@playwright/test'
22
import { config } from './../../../e2e/config.js'
33
import {
44
ActorsEnvironment,
@@ -91,7 +91,7 @@ test.describe('deny space access', () => {
9191
await api.userHasAddedMembersToSpace({
9292
usersEnvironment,
9393
stepUser: 'Alice',
94-
space: 'team',
94+
space: 'sales',
9595
shareType: 'user',
9696
sharee: 'Brian',
9797
role: 'Can edit'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test.describe('download space', () => {
102102
actorsEnvironment,
103103
usersEnvironment,
104104
stepUser: 'Alice',
105-
sharee: 'team.1',
105+
sharee: 'Brian',
106106
role: 'Can edit',
107107
kind: 'user'
108108
})

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ test.describe('Notifications', () => {
271271
// | message |
272272
// | %user_alice_displayName% deleted Space team |
273273
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Brian' })
274-
expect(messages).toContain(substitute('%user_alice_displayName% delete Space team'))
274+
expect(messages).toContain(substitute('%user_alice_displayName% deleted Space team'))
275275

276276
await api.userHasDeletedGroup({ usersEnvironment, stepUser: 'Admin', name: 'sales' })
277277
})
@@ -298,7 +298,7 @@ test.describe('Notifications', () => {
298298
})
299299

300300
// And "Brian" logs in
301-
await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' })
301+
await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Brian' })
302302

303303
// And "Brian" opens the user menu
304304
await ui.userOpensAccountPage({ actorsEnvironment, stepUser: 'Brian' })
@@ -444,7 +444,7 @@ test.describe('Notifications', () => {
444444
})
445445

446446
// Then "Carol" should see no notifications
447-
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Coral' })
447+
messages = await ui.getNotificationMessages({ actorsEnvironment, stepUser: 'Carol' })
448448
expect(messages).toHaveLength(0)
449449
})
450450
})

tests/e2e-playwright/steps/api/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { ResourceType } from '../../../e2e/support/api/share/share'
99
import { Group, Space, User } from '../../../e2e/support/types'
1010
import fs from 'fs'
1111
import { integer } from 'vscode-languageserver-types'
12-
import join from 'join-path'
12+
1313
import { checkResponseStatus, request } from '../../../e2e/support/api/http'
14+
import { join } from 'path'
1415

1516
export async function userHasBeenCreated({
1617
usersEnvironment,
@@ -360,6 +361,7 @@ export async function userHasDeletedProjectSpace({
360361
}) {
361362
const user = usersEnvironment.getUser({ key: stepUser })
362363
await api.graph.deleteSpace({ user, space: { id, name } as unknown as Space })
364+
store.createdSpaceStore.clear()
363365
}
364366

365367
export async function userHasAddedMembersToSpace({

0 commit comments

Comments
 (0)