@open-xchange/appsuite-codeceptjs 0.1.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/.env.defaults +47 -0
- package/README.md +40 -0
- package/chai.d.ts +5 -0
- package/customRerun.js +135 -0
- package/global.d.ts +5 -0
- package/index.js +187 -0
- package/package.json +39 -0
- package/src/actor.js +174 -0
- package/src/appsuiteHttpClient.js +155 -0
- package/src/chai.d.ts +6 -0
- package/src/chai.js +58 -0
- package/src/contexts/contexts.js +172 -0
- package/src/contexts/reseller.js +248 -0
- package/src/contexts.js +29 -0
- package/src/event.js +54 -0
- package/src/helper.js +817 -0
- package/src/pageobjects/calendar.js +226 -0
- package/src/pageobjects/contacts.js +148 -0
- package/src/pageobjects/drive.js +96 -0
- package/src/pageobjects/fragments/contact-autocomplete.js +45 -0
- package/src/pageobjects/fragments/contact-picker.js +50 -0
- package/src/pageobjects/fragments/dialogs.js +41 -0
- package/src/pageobjects/fragments/search.js +54 -0
- package/src/pageobjects/fragments/settings-mailfilter.js +90 -0
- package/src/pageobjects/fragments/settings.js +71 -0
- package/src/pageobjects/fragments/tinymce.js +41 -0
- package/src/pageobjects/fragments/topbar.js +43 -0
- package/src/pageobjects/fragments/viewer.js +67 -0
- package/src/pageobjects/mail.js +67 -0
- package/src/pageobjects/mobile/mobileCalendar.js +41 -0
- package/src/pageobjects/mobile/mobileContacts.js +40 -0
- package/src/pageobjects/mobile/mobileMail.js +51 -0
- package/src/pageobjects/tasks.js +58 -0
- package/src/plugins/emptyModule/index.js +21 -0
- package/src/plugins/settingsInit/index.js +35 -0
- package/src/plugins/testmetrics/index.js +135 -0
- package/src/soap/services/context.js +147 -0
- package/src/soap/services/oxaas.js +36 -0
- package/src/soap/services/resellerContext.js +65 -0
- package/src/soap/services/resellerUser.js +100 -0
- package/src/soap/services/user.js +114 -0
- package/src/soap/services/util.js +39 -0
- package/src/soap/soap.js +172 -0
- package/src/users/reseller.js +233 -0
- package/src/users/users.js +183 -0
- package/src/users.js +29 -0
- package/src/util.js +104 -0
- package/steps.d.ts +16 -0
package/src/util.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
|
|
21
|
+
const codecept = require('codeceptjs')
|
|
22
|
+
const url = require('node:url')
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
|
|
26
|
+
getLoginTimeout () {
|
|
27
|
+
const { helpers: { AppSuite, Playwright } } = codecept.config.get()
|
|
28
|
+
return AppSuite?.loginTimeout || Playwright?.waitForTimeout / 500 || 20
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
getURLRoot () {
|
|
32
|
+
const config = codecept.config.get()
|
|
33
|
+
const driver = config.helpers.Playwright
|
|
34
|
+
const url = driver.url
|
|
35
|
+
const pathArray = url.split('/')
|
|
36
|
+
const protocol = pathArray[0]
|
|
37
|
+
const host = pathArray[2]
|
|
38
|
+
const appRoot = pathArray[3] ? `/${pathArray[3]}` : ''
|
|
39
|
+
return `${protocol}//${host}${appRoot}`
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
getServerURL () {
|
|
43
|
+
const config = codecept.config.get()
|
|
44
|
+
const driver = config.helpers.Playwright
|
|
45
|
+
const ox = config.helpers.AppSuite
|
|
46
|
+
const url = ox.serverURL || driver.url
|
|
47
|
+
const pathArray = url.split('/')
|
|
48
|
+
const protocol = pathArray[0]
|
|
49
|
+
const host = pathArray[2]
|
|
50
|
+
return `${protocol}//${host}`
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
getJavascriptRoot () {
|
|
54
|
+
const config = codecept.config.get()
|
|
55
|
+
return new url.URL(config.helpers.Playwright.url).pathname
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
userContextId () {
|
|
59
|
+
const ox = codecept.config.get().helpers.AppSuite
|
|
60
|
+
return typeof ox.contextId === 'undefined' ? 10 : ox.contextId
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
admin () {
|
|
64
|
+
return codecept.config.get().helpers.AppSuite.admin
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
mxDomain () {
|
|
68
|
+
const ox = codecept.config.get().helpers.AppSuite
|
|
69
|
+
return ox.mxDomain || 'example.com'
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
smtpServer () {
|
|
73
|
+
const ox = codecept.config.get().helpers.AppSuite
|
|
74
|
+
return ox.smtpServer || 'localhost'
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
imapServer () {
|
|
78
|
+
const ox = codecept.config.get().helpers.AppSuite
|
|
79
|
+
return ox.imapServer || 'localhost'
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
getDefaultUserPassword () {
|
|
83
|
+
const ox = codecept.config.get().helpers.AppSuite
|
|
84
|
+
return ox.defaultUserPassword || 'secret'
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
PropagatedError: class PropagatedError extends Error {
|
|
88
|
+
constructor (error) {
|
|
89
|
+
super(error.message)
|
|
90
|
+
this.name = this.constructor.name
|
|
91
|
+
if (!error) throw new Error('PropagateError needs an error')
|
|
92
|
+
this.original_error = error
|
|
93
|
+
this.stack_before_rethrow = this.stack
|
|
94
|
+
const messageLines = (this.message.match(/\n/g) || []).length + 1
|
|
95
|
+
this.stack = this.stack.split('\n').slice(0, messageLines + 1).join('\n') + '\n' + error.stack
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
addJitter (id) {
|
|
100
|
+
const [JITTER_MIN, JITTER_MAX] = [1000, 2000]
|
|
101
|
+
return Math.trunc(id) + Math.floor(Math.random() * (JITTER_MAX - JITTER_MIN + 1) + JITTER_MIN)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}
|
package/steps.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types='codeceptjs' />
|
|
2
|
+
type steps_file = typeof import('@codeceptjs/configure/test/integration/steps_file.js');
|
|
3
|
+
type users = typeof import('./src/users.js');
|
|
4
|
+
type contexts = typeof import('./src/contexts.js');
|
|
5
|
+
type ResellerContext = typeof import('./src/reseller/context.js');
|
|
6
|
+
type ResellerUser = typeof import('./src/reseller/user.js');
|
|
7
|
+
type AppSuite = import('./src/helper.js');
|
|
8
|
+
|
|
9
|
+
declare namespace CodeceptJS {
|
|
10
|
+
interface SupportObject { I: I, current: any, users: users, contexts: contexts, ResellerContext: ResellerContext, ResellerUser: ResellerUser }
|
|
11
|
+
interface Methods extends Playwright, AppSuite {}
|
|
12
|
+
interface I extends ReturnType<steps_file>, WithTranslation<AppSuite> {}
|
|
13
|
+
namespace Translation {
|
|
14
|
+
interface Actions {}
|
|
15
|
+
}
|
|
16
|
+
}
|