@open-xchange/appsuite-codeceptjs 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/appsuite-codeceptjs",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "OX App Suite CodeceptJS Configuration and Helpers",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -14,7 +14,7 @@
14
14
  "@codeceptjs/helper": "^2.0.3",
15
15
  "@influxdata/influxdb-client": "^1.33.2",
16
16
  "@open-xchange/codecept-horizontal-scaler": "^0.1.7",
17
- "@playwright/test": "^1.42.0",
17
+ "@playwright/test": "1.44.0",
18
18
  "allure-codeceptjs": "^2.13.0",
19
19
  "chai": "^5.1.0",
20
20
  "chai-subset": "^1.6.0",
@@ -42,13 +42,27 @@ async function remove (id) {
42
42
  /**
43
43
  * This function creates a new context.
44
44
  * @param {Object} ctx The context to create.
45
+ * @param {Object} adminUser The admin user of the context.
46
+ * Defaults to:
47
+ * ```JSON
48
+ * {
49
+ name: 'oxadmin',
50
+ password: 'secret',
51
+ display_name: 'context admin',
52
+ sur_name: 'admin',
53
+ given_name: 'context',
54
+ email1: `oxadmin@${process.env.MX_DOMAIN}`,
55
+ primaryEmail: `oxadmin@${process.env.MX_DOMAIN}`
56
+ }
57
+ All properties are needed and will be inserted if not provided.
58
+ ```
45
59
  * @returns {Promise<Object>} The created context.
46
60
  */
47
- async function create (ctx = {}) {
61
+ async function create (ctx = {}, adminUser = {}) {
48
62
  return await (await OXContextService)
49
63
  .createAsync({
50
64
  ctx,
51
- admin_user: {
65
+ admin_user: Object.assign({
52
66
  name: 'oxadmin',
53
67
  password: 'secret',
54
68
  display_name: 'context admin',
@@ -56,7 +70,7 @@ async function create (ctx = {}) {
56
70
  given_name: 'context',
57
71
  email1: `oxadmin@${process.env.MX_DOMAIN}`,
58
72
  primaryEmail: `oxadmin@${process.env.MX_DOMAIN}`
59
- }
73
+ }, adminUser)
60
74
  })
61
75
  .then(async context => {
62
76
  await changeModuleAccessByName(context.id, 'all')
@@ -113,6 +127,17 @@ async function changeModuleAccess (id, moduleAccess) {
113
127
  return await (await OXContextService).changeModuleAccessAsync({ ctx: { id }, access: { ...currentAccess, ...moduleAccess } })
114
128
  }
115
129
 
130
+ /**
131
+ * Search for contexts.
132
+ * @param {String} searchPattern The pattern to search for
133
+ * @param {Object} options Additional options
134
+ * @param {Boolean} options.excludeDisabled Exclude disabled contexts from the search results (default: true)
135
+ * @returns {Promise<Array<Object>>} The list of contexts that match the search pattern.
136
+ */
137
+ async function list (searchPattern, { excludeDisabled = true }) {
138
+ return await (await OXContextService).listAsync({ search_pattern: searchPattern, exclude_disabled: excludeDisabled })
139
+ }
140
+
116
141
  /**
117
142
  * This function retrieves the context with the specified ID.
118
143
  * @param {number} id The ID of the context to retrieve.
@@ -140,5 +165,6 @@ module.exports = {
140
165
  getModuleAccess,
141
166
  changeModuleAccess,
142
167
  get,
168
+ list,
143
169
  change
144
170
  }
package/src/soap/soap.js CHANGED
@@ -86,7 +86,8 @@ function shouldAbortRetry (error) {
86
86
  /Shared Domain already exists/,
87
87
  /Shared Domain already in use/,
88
88
  /No such user/,
89
- /Mandatory fields in context not set/
89
+ /Mandatory fields in context not set/,
90
+ /A mapping with login info .* already exists/
90
91
  ]
91
92
  const blockedExceptions = [
92
93
  'ContextExistsException',