@open-xchange/appsuite-codeceptjs 0.6.17 → 0.6.18

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.6.17",
3
+ "version": "0.6.18",
4
4
  "description": "OX App Suite CodeceptJS Configuration and Helpers",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -33,8 +33,8 @@
33
33
  "p-retry": "^7.1.1",
34
34
  "playwright-core": "1.58.2",
35
35
  "short-uuid": "^6.0.3",
36
- "@open-xchange/codecept-horizontal-scaler": "0.1.14",
37
- "@open-xchange/soap-client": "0.0.10"
36
+ "@open-xchange/soap-client": "0.0.10",
37
+ "@open-xchange/codecept-horizontal-scaler": "0.1.14"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^24.10.3",
package/src/actor.js CHANGED
@@ -32,9 +32,16 @@ module.exports = function (customSteps) {
32
32
  this.amOnPage(baseURL)
33
33
  },
34
34
 
35
- openApp (appName) {
35
+ waitForApp () {
36
+ this.waitForInvisible('#background-loader.busy', 30)
37
+ this.waitForVisible({ css: 'html.complete' }, 10)
38
+ },
39
+
40
+ openApp (appName, options) {
36
41
  this.click('~Navigate to:')
37
42
  this.click(appName, '.apps')
43
+ options = { wait: true, ...options }
44
+ if (options.wait) this.waitForApp()
38
45
  },
39
46
 
40
47
  /**
@@ -62,36 +69,33 @@ module.exports = function (customSteps) {
62
69
  * After successful login, the page will be navigated to the specified URL with the URL parameters.
63
70
  * If the 'isDeepLink' option is true, the URL will be constructed with a '#' prefix.
64
71
  * The login process also includes waiting for the page to load and checking for the presence of the app.
65
- * @param {string[]|object} urlParams - The URL parameters as an array or object.
72
+ * @param {string[]|string} urlParams - The URL parameters as an array or string.
66
73
  * @param {object} options - The login options.
67
- * @returns {Promise<void>} - A promise that resolves when the login process is complete.
68
74
  */
69
- async login (urlParams, options) {
75
+ login (urlParams, options) {
70
76
  if (urlParams && !urlParams.length) {
71
77
  // looks like an object, not string or array
72
78
  options = urlParams
73
- urlParams = []
79
+ urlParams = undefined
74
80
  }
81
+ options = { wait: true, ...options }
75
82
  urlParams = [].concat(urlParams || [])
76
- options = Object.assign({ wait: true }, options)
83
+ if (!options.isDeepLink) urlParams.unshift('!!')
77
84
  let user = util.resolveUser(options.user)
78
85
  if (user.toJSON) user = user.toJSON()
79
86
  const loginName = process.env.PROVISIONING_API === 'reseller' ? user.name : `${user.name}${user.context.id ? '@' + user.context.id : ''}`
80
- await this.makeApiRequest('POST', `${baseURL}/api/login`, {
87
+ this.makeApiRequest('POST', `${baseURL}/api/login`, {
81
88
  params: { action: 'login', client: 'open-xchange-appsuite' },
82
- form: {
83
- name: loginName,
84
- password: user.password
85
- }
89
+ form: { name: loginName, password: user.password }
86
90
  })
87
91
  this.wait(0.5)
88
- this.amOnPage(`${baseURL}/` + (options.isDeepLink ? '#' : '#!!') + (urlParams.length === 0 ? '' : '&' + urlParams.join('&')))
92
+ this.amOnPage(`${baseURL}/#${urlParams.join('&')}`)
89
93
  this.waitForInvisible('#background-loader.busy', util.getLoginTimeout())
90
- if (options.wait) await this.waitForApp()
94
+ if (options.wait) this.waitForVisible({ css: 'html.complete' }, 10)
91
95
  },
92
96
 
93
- async logout () {
94
- await this.makeApiRequest('POST', `${baseURL}/api/login`, { params: { action: 'logout' } })
97
+ logout () {
98
+ this.makeApiRequest('POST', `${baseURL}/api/login`, { params: { action: 'logout' } })
95
99
  this.amOnPage('about:blank')
96
100
  },
97
101
 
@@ -105,10 +109,9 @@ module.exports = function (customSteps) {
105
109
  *
106
110
  * @param {string} locator - The locator of the element. Only accepts css selectors.
107
111
  */
108
- async waitForFocus (locator) {
109
- this.waitForElement(locator)
112
+ waitForFocus (locator) {
110
113
  this.waitForVisible(locator)
111
- return this.usePlaywrightTo('wait for focus', async ({ page }) => {
114
+ this.usePlaywrightTo('wait for focus', async ({ page }) => {
112
115
  await expect(page.locator(locator)).toBeFocused()
113
116
  this.wait(0.5)
114
117
  })
@@ -131,7 +134,7 @@ module.exports = function (customSteps) {
131
134
  clickDropdown (text) {
132
135
  this.waitForVisible('.dropdown.open .dropdown-menu, .primary-action > .open .dropdown-menu')
133
136
  this.waitForText(text, 10, '.dropdown.open .dropdown-menu, .primary-action > .open .dropdown-menu')
134
- return this.click(text, '.dropdown.open .dropdown-menu, .primary-action > .open .dropdown-menu')
137
+ this.click(text, '.dropdown.open .dropdown-menu, .primary-action > .open .dropdown-menu')
135
138
  },
136
139
 
137
140
  clickToolbar (selector, timeout = 5) {
package/src/helper.js CHANGED
@@ -919,13 +919,6 @@ class AppSuiteHelper extends Helper {
919
919
  )
920
920
  }
921
921
 
922
- async waitForApp () {
923
- const { Playwright } = this.helpers
924
-
925
- await Playwright.waitForInvisible('#background-loader.busy', 30)
926
- await Playwright.waitForVisible({ css: 'html.complete' }, 10)
927
- }
928
-
929
922
  async copyToClipboard () {
930
923
  const helper = this.helpers.Playwright
931
924
  const { page } = helper