@open-xchange/appsuite-codeceptjs 0.4.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,3 @@
1
1
  # Open-Xchange App Suite: CodeceptJS
2
2
 
3
- This module contains appsuite specific configuration, helpers, page objects and actors for Open-Xchange App Suite.
4
-
5
- ## Configuration
6
-
7
3
  TBD
@@ -0,0 +1 @@
1
+ FROM registry.gitlab.open-xchange.com/appsuite/web-foundation/base-images/playwright:v1.48.1-jammy
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @copyright Copyright (c) Open-Xchange GmbH, Germany <info@open-xchange.com>
3
+ * @license AGPL-3.0
4
+ *
5
+ * This code is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with OX App Suite. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
17
+ *
18
+ * Any use of the work other than as authorized under this license or copyright law is prohibited.
19
+ */
20
+ import config from '@open-xchange/lint'
21
+ import mocha from 'eslint-plugin-mocha'
22
+ import { FlatCompat } from '@eslint/eslintrc'
23
+
24
+ import path from 'node:path'
25
+ import url from 'node:url'
26
+
27
+ const __filename = url.fileURLToPath(import.meta.url)
28
+ const __dirname = path.dirname(__filename)
29
+
30
+ const codeceptjs = new FlatCompat({
31
+ baseDirectory: __dirname
32
+ }).extends('plugin:codeceptjs/recommended')
33
+
34
+ export default [
35
+ ...config,
36
+ {
37
+ files: ['**/*.js'],
38
+ plugins: {
39
+ ...codeceptjs[1].plugins
40
+ },
41
+ rules: {
42
+ ...codeceptjs[1].rules,
43
+ 'no-unused-expressions': 0,
44
+ 'import/no-absolute-path': 0,
45
+ 'codeceptjs/no-skipped-tests': 'off',
46
+ 'codeceptjs/no-pause-in-scenario': 'off'
47
+ },
48
+ languageOptions: {
49
+ globals: {
50
+ ...codeceptjs[0].languageOptions.globals,
51
+ ...mocha.configs.flat.recommended.languageOptions.globals,
52
+ Feature: true,
53
+ Scenario: true,
54
+ Before: true,
55
+ After: true,
56
+ within: true,
57
+ assert: true,
58
+ locate: true,
59
+ session: true,
60
+ inject: true,
61
+ codecept_dir: true,
62
+ output_dir: true,
63
+ DataTable: true,
64
+ Data: true,
65
+ BeforeSuite: true,
66
+ AfterSuite: true,
67
+ actor: true,
68
+ expect: true,
69
+ require: true
70
+ }
71
+ }
72
+ }
73
+ ]
package/index.js CHANGED
@@ -18,7 +18,7 @@
18
18
  * Any use of the work other than as authorized under this license or copyright law is prohibited.
19
19
  */
20
20
 
21
- require('@open-xchange/appsuite-codeceptjs/src/chai')
21
+ require('./src/chai')
22
22
  const dotenv = require('dotenv')
23
23
  dotenv.config({ path: '.env' })
24
24
  dotenv.config({ path: '.env.defaults' })
@@ -124,7 +124,10 @@ module.exports = {
124
124
  async teardown () {
125
125
  const { contexts } = global.inject()
126
126
  // we need to run this sequentially, less stress on the MW
127
- for (const ctx of contexts.filter(ctx => /e2e-context-/.test(String(ctx.loginMappings)))) {
127
+ const filterFunction = process.env.PROVISIONING_API === 'reseller'
128
+ ? ctx => ctx.name.includes('e2e_context')
129
+ : ctx => /e2e-context-/.test(String(ctx.loginMappings))
130
+ for (const ctx of contexts.filter(filterFunction)) {
128
131
  await ctx.remove().catch(e => console.error(e.message))
129
132
  }
130
133
  },
@@ -170,6 +173,7 @@ module.exports = {
170
173
  require: '@open-xchange/appsuite-codeceptjs/src/plugins/settingsInit',
171
174
  enabled: true
172
175
  },
176
+
173
177
  customizePlugin: {
174
178
  require: process.env.CUSTOMIZE_PLUGIN || '@open-xchange/appsuite-codeceptjs/src/plugins/emptyModule',
175
179
  enabled: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/appsuite-codeceptjs",
3
- "version": "0.4.3",
3
+ "version": "0.6.0",
4
4
  "description": "OX App Suite CodeceptJS Configuration and Helpers",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -10,31 +10,36 @@
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "private": false,
12
12
  "dependencies": {
13
- "@axe-core/playwright": "^4.9.1",
13
+ "@axe-core/playwright": "^4.10.0",
14
14
  "@codeceptjs/helper": "^2.0.4",
15
- "@influxdata/influxdb-client": "^1.33.2",
15
+ "@influxdata/influxdb-client": "^1.35.0",
16
16
  "@open-xchange/codecept-horizontal-scaler": "^0.1.11",
17
- "@playwright/test": "1.46.1",
18
- "allure-codeceptjs": "^2.15.1",
17
+ "@playwright/test": "1.48.1",
18
+ "allure-codeceptjs": "^3.0.3",
19
+ "allure-js-commons": "^3.0.3",
19
20
  "chai": "^5.1.1",
20
21
  "chai-subset": "^1.6.0",
21
- "chalk": "^4.1.0",
22
+ "chalk": "^4.1.2",
22
23
  "chalk-table": "^1.0.2",
23
- "codeceptjs": "3.6.5",
24
+ "codeceptjs": "3.6.7",
24
25
  "dotenv": "^16.4.5",
25
- "mocha": "^10.4.0",
26
+ "mocha": "^10.7.3",
26
27
  "mocha-junit-reporter": "^2.2.1",
27
28
  "mocha-multi": "^1.1.7",
28
29
  "moment": "^2.30.1",
29
30
  "moment-timezone": "^0.5.45",
30
31
  "p-retry": "^6.2.0",
31
- "playwright-core": "1.46.1",
32
+ "playwright-core": "1.48.1",
32
33
  "short-uuid": "^5.2.0",
33
- "soap": "^1.0.3"
34
+ "soap": "^1.1.5"
34
35
  },
35
36
  "devDependencies": {
36
- "@types/node": "^22.4.1",
37
+ "@types/node": "^22.7.4",
37
38
  "ts-node": "^10.9.2",
38
- "typescript": "^5.4.5"
39
+ "typescript": "^5.6.2",
40
+ "@open-xchange/lint": "0.1.5"
41
+ },
42
+ "scripts": {
43
+ "lint": "eslint ."
39
44
  }
40
45
  }
@@ -159,13 +159,14 @@ class ResellerContext {
159
159
  }
160
160
 
161
161
  static async create (ctx = {}, adminUser = {}, auth = util.admin(), numberOfUsers = Number(process.env.PROVISIONING_USERS || 10)) {
162
- ctx = Object.assign({ id: util.userContextId(), maxQuota: -1 }, ctx)
162
+ const randomId = crypto.randomUUID()
163
+ ctx = Object.assign({ maxQuota: -1 }, ctx)
163
164
  adminUser = Object.assign({
164
- name: `${ctx.name || ctx.id}_admin`
165
+ name: `${ctx.name || randomId}_admin`
165
166
  }, this.defaultAdmin(), adminUser)
166
167
  let data; let neededPrefix = ctx._auto_prefix
167
168
  delete ctx._auto_prefix
168
- ctx.name = (process.env.CONTEXT_PREFIX || '') + (ctx.name || `${ctx.id}`)
169
+ ctx.name = (process.env.CONTEXT_PREFIX || '') + (ctx.name || `e2e_context_${randomId}`)
169
170
  event.emit(event.provisioning.context.create, ctx, adminUser, auth)
170
171
  try {
171
172
  data = await resellerContextService.create({
@@ -211,11 +212,6 @@ class ResellerContext {
211
212
  return remoteCtx
212
213
  }
213
214
 
214
- static async all () {
215
- if (contexts.length === 0) await this.fetchContexts()
216
- return created.concat(contexts)
217
- }
218
-
219
215
  static async fetchContexts () {
220
216
  const list = await resellerContextService.listAll()
221
217
  .catch((err) => { throw new util.PropagatedError(err) })
@@ -226,7 +222,6 @@ class ResellerContext {
226
222
 
227
223
  // can't return the class directly, because codecept tries to execute functions
228
224
  module.exports = function () {
229
- ResellerContext.fetchContexts()
230
225
  return new Proxy(created, {
231
226
  // act like an array if an index is being used
232
227
  get (target, prop) {
@@ -87,7 +87,6 @@ module.exports = {
87
87
 
88
88
  async hasImage () {
89
89
  const rule = await I.grabCssPropertyFrom('.contact-header .contact-photo', 'background-image')
90
- expect(rule).not.to.match(/fallback/)
91
90
  expect(rule).to.match(/^url\(/)
92
91
  },
93
92
 
@@ -20,8 +20,6 @@
20
20
 
21
21
  const { createClientAsync } = require('../soap.js')
22
22
 
23
- const OXUtilService = createClientAsync('OXUtilService').then(client => client)
24
-
25
23
  /**
26
24
  * This function retrieves the ID of the first filestorage.
27
25
  * @returns {Promise<number>} The ID of the first filestorage.
@@ -29,6 +27,8 @@ const OXUtilService = createClientAsync('OXUtilService').then(client => client)
29
27
  let fileStoreId
30
28
 
31
29
  async function getFilestorageId () {
30
+ const OXUtilService = createClientAsync('OXUtilService').then(client => client)
31
+
32
32
  if (fileStoreId) return fileStoreId
33
33
  fileStoreId = (await (await OXUtilService).listFilestoreAsync())[0]?.id
34
34
  return fileStoreId
package/src/soap/soap.js CHANGED
@@ -87,7 +87,9 @@ function shouldAbortRetry (error) {
87
87
  /Shared Domain already in use/,
88
88
  /No such user/,
89
89
  /Mandatory fields in context not set/,
90
- /A mapping with login info .* already exists/
90
+ /A mapping with login info .* already exists/,
91
+ /Id must not be set if pre-assembled context should be used/,
92
+ /Unmarshalling Error/
91
93
  ]
92
94
  const blockedExceptions = [
93
95
  'ContextExistsException',