@open-xchange/appsuite-codeceptjs 0.6.11 → 0.6.12

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/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
 
21
21
  require('./src/chai')
22
22
  const { recorder, event: codeceptEvents } = require('codeceptjs')
23
+ const pageobjects = require('@open-xchange/appsuite-codeceptjs-pageobjects')
23
24
 
24
25
  const dotenv = require('dotenv')
25
26
  dotenv.config({ path: ['.env', '.env.defaults'], quiet: true })
@@ -87,25 +88,7 @@ module.exports = {
87
88
  I: '@open-xchange/appsuite-codeceptjs/src/actor',
88
89
  users: '@open-xchange/appsuite-codeceptjs/src/users',
89
90
  contexts: '@open-xchange/appsuite-codeceptjs/src/contexts',
90
- // pageobjects
91
- contacts: '@open-xchange/appsuite-codeceptjs/src/pageobjects/contacts',
92
- calendar: '@open-xchange/appsuite-codeceptjs/src/pageobjects/calendar',
93
- mail: '@open-xchange/appsuite-codeceptjs/src/pageobjects/mail',
94
- drive: '@open-xchange/appsuite-codeceptjs/src/pageobjects/drive',
95
- tasks: '@open-xchange/appsuite-codeceptjs/src/pageobjects/tasks',
96
- // fragments
97
- dialogs: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/dialogs',
98
- autocomplete: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/contact-autocomplete',
99
- contactpicker: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/contact-picker',
100
- mailfilter: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/settings-mailfilter',
101
- search: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/search',
102
- tinymce: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/tinymce',
103
- topbar: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/topbar',
104
- settings: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/settings',
105
- viewer: '@open-xchange/appsuite-codeceptjs/src/pageobjects/fragments/viewer',
106
- mobileCalendar: '@open-xchange/appsuite-codeceptjs/src/pageobjects/mobile/mobileCalendar',
107
- mobileMail: '@open-xchange/appsuite-codeceptjs/src/pageobjects/mobile/mobileMail',
108
- mobileContacts: '@open-xchange/appsuite-codeceptjs/src/pageobjects/mobile/mobileContacts'
91
+ ...pageobjects
109
92
  },
110
93
  async bootstrap () {
111
94
  // set moment defaults
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/appsuite-codeceptjs",
3
- "version": "0.6.11",
3
+ "version": "0.6.12",
4
4
  "description": "OX App Suite CodeceptJS Configuration and Helpers",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  "@axe-core/playwright": "^4.10.2",
18
18
  "@codeceptjs/helper": "^2.0.4",
19
19
  "@influxdata/influxdb-client": "^1.35.0",
20
+ "@open-xchange/appsuite-codeceptjs-pageobjects": "^1.0.0",
20
21
  "@playwright/test": "1.55.1",
21
22
  "allure-codeceptjs": "2.15.1",
22
23
  "chai": "^6.0.0",
@@ -1,229 +0,0 @@
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 { I, contactpicker, autocomplete, dialogs } = inject()
22
- const { getMonday } = require('./util')
23
-
24
- module.exports = {
25
-
26
- editWindow: '.io-ox-calendar-edit-window',
27
- miniCalendar: '.window-sidepanel .date-picker',
28
- title: '[data-extension-point="io.ox/calendar/edit/section"] input[name="summary"]',
29
- location: '[data-extension-point="io.ox/calendar/edit/section"] input[name="location"]',
30
- description: '[data-extension-point="io.ox/calendar/edit/section"] textarea[name="description"]',
31
-
32
- async newAppointment () {
33
- I.wait(1)
34
- I.clickPrimary('New appointment')
35
- I.waitForVisible(this.editWindow)
36
- return I.waitForFocus('.io-ox-calendar-edit-window input[type="text"][name="summary"]')
37
- },
38
-
39
- clickAppointment (title, position = 1) {
40
- I.wait(0.5) // wait for rendering
41
- const appointment = locate('.page.current .appointment .title').withText(title).at(position).as('Appointment')
42
- I.waitForElement(appointment)
43
- I.scrollTo(appointment)
44
- I.click(appointment)
45
- },
46
-
47
- getNextMonday () {
48
- return getMonday().add(1, 'week').set('hour', 8)
49
- },
50
-
51
- startNextMonday () {
52
- // use next monday to avoid problems when tests run over the weekend
53
- const date = this.getNextMonday()
54
- I.fillField('Starts on', date.format('L'))
55
- I.clearField('~Start time')
56
- I.fillField('~Start time', '8:00')
57
- return date
58
- },
59
-
60
- moveCalendarViewToNextWeek () {
61
- I.waitForText('Today', undefined, '.calendar-header')
62
- I.click('Today')
63
- I.waitForElement('~Next week')
64
- I.click('~Next week')
65
- // look for proper aria-label
66
- I.waitForElement('~' + this.getNextMonday().format('ddd D') + ', create all-day appointment')
67
- },
68
-
69
- openScheduling () {
70
- I.waitForElement(locate('button').withText('New appointment').as('New appointment'))
71
- I.click('.primary-action button[aria-label="More actions"]')
72
- I.waitForElement('.primary-action .dropdown-menu')
73
- I.click('Scheduling', '.primary-action .dropdown-menu')
74
- },
75
-
76
- recurAppointment (date) {
77
- I.checkOption('Repeat')
78
- if (date) I.see(`Every ${date.format('dddd')}.`)
79
- I.click('.recurrence-view button.summary')
80
- I.waitForElement('.recurrence-view-dialog')
81
- },
82
-
83
- deleteAppointment () {
84
- I.waitForElement('~Delete')
85
- I.click('~Delete', '.detail-popup')
86
- dialogs.waitForVisible()
87
- dialogs.clickButton('Delete')
88
- I.waitForDetached('.modal-dialog')
89
- },
90
-
91
- // attr: [startDate, endDate, until]
92
- setDate (attr, value) {
93
- I.click('~Date (M/D/YYYY)', locate(`[data-attribute="${attr}"]`).as('Date input'))
94
- I.waitForElement('.date-picker.open')
95
- I.click(`.dateinput[data-attribute="${attr}"] .datepicker-day-field`)
96
- I.fillField(`.dateinput[data-attribute="${attr}"] .datepicker-day-field`, value.format('L'))
97
- I.pressKey('Enter')
98
- I.waitForDetached('.date-picker.open')
99
- },
100
-
101
- getDate (attr) {
102
- return I.executeScript(function (attr) {
103
- // fillfield works only for puppeteer, pressKey(11/10....) only for webdriver
104
- // @ts-ignore
105
- return document.querySelector(`.dateinput[data-attribute="${attr}"] .datepicker-day-field`).value
106
- }, attr)
107
- },
108
-
109
- addParticipant (name, exists = true, context) {
110
- if (!context) context = '*'
111
-
112
- // does suggestion exists (for contact, user, ...)
113
- const addParticipantsLocator = locate('.add-participant.tt-input').inside(context).as('Add participant field')
114
- // input field
115
- I.waitForVisible(addParticipantsLocator)
116
- // I.waitForEnabled(addParticipantsLocator)
117
- I.fillField(addParticipantsLocator, name)
118
- I.seeInField(addParticipantsLocator, name)
119
- // tokenfield/typeahead
120
- if (exists) {
121
- autocomplete.select(name, context.replace('.', ''))
122
- } else {
123
- I.pressKey('Enter')
124
- }
125
-
126
- I.waitForInvisible(autocomplete.suggestions)
127
- // note: might be more than one that get's added (group)
128
- },
129
-
130
- async addParticipantByPicker (name) {
131
- I.click('~Select contacts')
132
- await contactpicker.add(name)
133
- contactpicker.close()
134
- I.waitForText(name, undefined, '.attendee-container')
135
- },
136
-
137
- switchView (view) {
138
- const viewMap = {
139
- Day: 'week:day',
140
- Week: 'week:week',
141
- Workweek: 'week:workweek',
142
- Month: 'month',
143
- List: 'list'
144
- }
145
- I.waitForElement('.page.current .calendar-header > .dropdown button')
146
- I.click('.page.current .calendar-header > .dropdown button')
147
- I.waitForText(view, undefined, '.open .dropdown-menu')
148
- I.click(locate('.dropdown.open a').withText(view).as('Switch to ' + view))
149
- I.waitForVisible(`.io-ox-pagecontroller.page.current[data-page-id="io.ox/calendar/${viewMap[view]}"]`)
150
- },
151
-
152
- getFullname (user) {
153
- return `${user.get('sur_name')}, ${user.get('given_name')}`
154
- },
155
-
156
- async createAppointment ({ subject, location, folder, startDate, startTime, endDate, endTime }) {
157
- // select calendar
158
- if (folder) {
159
- I.selectFolder(folder)
160
- I.waitForElement('li.selected[aria-label^="' + folder + '"] .color-label')
161
- }
162
-
163
- I.clickPrimary('New appointment')
164
- I.waitForVisible(locate('.io-ox-calendar-edit-window').as('Edit Dialog'))
165
- await I.waitForFocus('.io-ox-calendar-edit-window input[type="text"][name="summary"]')
166
-
167
- if (folder) {
168
- I.see(folder, '.io-ox-calendar-edit-window .folder-selection')
169
- }
170
- await within('.io-ox-calendar-edit-window', async () => {
171
- I.fillField('Title', subject)
172
-
173
- if (location) I.fillField('Location', location)
174
-
175
- if (startDate) {
176
- I.click('~Date (M/D/YYYY)')
177
- I.pressKey(['CommandOrControl', 'a'])
178
- I.type(startDate)
179
- I.pressKey('Enter')
180
- }
181
-
182
- if (startTime) {
183
- I.click('~Start time')
184
- I.click(startTime)
185
- }
186
-
187
- if (endDate) {
188
- I.click('~Date (M/D/YYYY)', '.dateinput[data-attribute="endDate"]')
189
- I.pressKey(['CommandOrControl', 'a'])
190
- I.type(endDate)
191
- I.pressKey('Enter')
192
- }
193
-
194
- if (endTime) {
195
- I.click('~End time')
196
- I.click(endTime)
197
- }
198
-
199
- // save
200
- I.click('Create')
201
- })
202
- I.waitForDetached('.io-ox-calendar-edit-window')
203
- },
204
-
205
- // remove previously created appointments by appointment title
206
- async removeAllAppointments (title) {
207
- const { skipRefresh } = await I.executeScript(async function (title) {
208
- const appointments = [...document.querySelectorAll('.appointment')]
209
- .map(el => {
210
- const folder = el.getAttribute('data-folder')
211
- return { folder, id: el.getAttribute('data-cid').replace(folder + '.', '') }
212
- })
213
- if (appointments.length === 0) return { skipRefresh: true }
214
- const { default: api } = await import(String(new URL('io.ox/calendar/api.js', location.href)))
215
- return await api.remove(appointments, {})
216
- }, title)
217
- if (skipRefresh === true) return
218
- I.click('#io-ox-refresh-icon')
219
- I.waitForDetached('#io-ox-refresh-icon .animate-spin')
220
- },
221
-
222
- async setDateTo (dateString) {
223
- await I.executeScript(async function (dateStr) {
224
- const { default: apps } = await import(String(new URL('io.ox/core/api/apps.js', location.href)))
225
- const { moment } = await import(String(new URL('e2e.js', location.href)))
226
- apps.get('io.ox/calendar').setDate(moment(dateStr))
227
- }, dateString)
228
- }
229
- }
@@ -1,149 +0,0 @@
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 { I, dialogs } = inject()
22
-
23
- module.exports = {
24
-
25
- editWindow: '.io-ox-contacts-edit-window',
26
- title: '.io-ox-contacts-edit-window input[name="title"]',
27
- note: '.io-ox-contacts-edit-window textarea[name="note"]',
28
-
29
- selectContact (text) {
30
- I.waitForElement(`.vgrid [aria-label="${text}"]`)
31
- I.click(`.vgrid [aria-label="${text}"]`)
32
- I.waitForElement('.contact-header')
33
- I.waitForText(text, undefined, '.contact-header .fullname')
34
- },
35
-
36
- selectListItem (text, selector = '.last_name') {
37
- I.waitForElement(locate(`.vgrid-cell ${selector}`).withText(text).as(text))
38
- I.click(locate(`.vgrid-cell ${selector}`).withText(text).as(text))
39
- I.waitForElement(locate(`.contact-detail h2 ${selector}`).withText(text).as(text))
40
- I.wait(0.5)
41
- },
42
-
43
- newAddressbook (name) {
44
- I.click('button.contextmenu-control', '~My address books')
45
- I.clickDropdown('Add new address book')
46
- dialogs.waitForVisible()
47
- I.fillField('[placeholder="New address book"][type="text"]', name)
48
- dialogs.clickButton('Add')
49
- I.waitForDetached('.modal-dialog')
50
- },
51
-
52
- newContact () {
53
- I.waitForDetached('.dropdown-toggle.disabled')
54
- I.clickPrimary('New contact')
55
- I.waitForText('Add personal info')
56
- },
57
-
58
- newDistributionlist () {
59
- I.waitForDetached('.dropdown-toggle.disabled')
60
- const button = locate('.primary-action .btn-group').withText('New contact').as('Primary Dropdown Button: New contact')
61
- I.waitForVisible(button)
62
- I.click(locate('.dropdown-toggle').inside(button).as('Dropdown Toggle'))
63
- I.click('New distribution list', '.primary-action .btn-group > .dropdown-menu')
64
- I.waitForText('Participants')
65
- },
66
-
67
- addField (fieldType, field) {
68
- I.click(`.dropdown[data-add="${fieldType}"] button`, '.contact-edit')
69
- I.waitForVisible('.dropdown.open .dropdown-menu')
70
- I.click(field)
71
- I.waitForText(field, 30, '.contact-edit')
72
- },
73
-
74
- editMyAccount () {
75
- I.waitForVisible('.dropdown-toggle[aria-label="My account"]')
76
- I.waitForVisible('.contact-picture')
77
- I.click('.contact-picture')
78
- I.waitForText('Edit personal data', 30, '.dropdown.open .dropdown-menu')
79
- I.click('Edit personal data', '.dropdown.open .dropdown-menu')
80
- I.waitForVisible(this.editWindow)
81
- },
82
-
83
- deleteSelected () {
84
- I.clickToolbar('Delete')
85
- dialogs.waitForVisible()
86
- dialogs.clickButton('Delete')
87
- I.waitForDetached('.modal-dialog')
88
- },
89
-
90
- async hasImage () {
91
- const rule = await I.grabCssPropertyFrom('.contact-header .contact-photo', 'background-image')
92
- expect(rule).to.match(/^url\(/)
93
- },
94
-
95
- importCSV (file, path = 'media/imports/contacts', folder = 'Contacts') {
96
- I.rightClick(`~${folder}`)
97
- I.clickDropdown('Import')
98
- dialogs.waitForVisible()
99
- I.selectOption('Format', 'CSV')
100
- I.attachFile('.file-input', `${path}/${file}.csv`)
101
- dialogs.clickButton('Import')
102
- I.waitForDetached('.modal-dialog')
103
- I.waitForText('Data imported successfully')
104
- },
105
-
106
- importVCF (file, path = 'media/imports/contacts', folder = 'Contacts') {
107
- I.rightClick(`~${folder}`)
108
- I.clickDropdown('Import')
109
- dialogs.waitForVisible()
110
- I.selectOption('Format', 'VCARD')
111
- I.attachFile('.file-input', `${path}/${file}.vcf`)
112
- dialogs.clickButton('Import')
113
- I.waitForDetached('.modal-dialog')
114
- I.waitForText('Data imported successfully')
115
- },
116
-
117
- async exportCSV (file) {
118
- I.clickToolbar('More actions')
119
- I.clickDropdown('Export')
120
- dialogs.waitForVisible()
121
- I.checkOption('CSV')
122
- I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.csv`)
123
- I.waitForDetached('.modal-dialog')
124
- },
125
- async exportVCF (file) {
126
- I.clickToolbar('More actions')
127
- I.clickDropdown('Export')
128
- dialogs.waitForVisible()
129
- I.checkOption('vCard')
130
- I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.vcf`)
131
- I.waitForDetached('.modal-dialog')
132
- },
133
- async exportAddressBookCSV (file) {
134
- I.rightClick('~Contacts')
135
- I.clickDropdown('Export')
136
- dialogs.waitForVisible()
137
- I.checkOption('CSV')
138
- I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.csv`)
139
- I.waitForDetached('.modal-dialog')
140
- },
141
- async exportAddressBookVCF (file) {
142
- I.rightClick('~Contacts')
143
- I.clickDropdown('Export')
144
- dialogs.waitForVisible()
145
- I.checkOption('vCard')
146
- I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.vcf`)
147
- I.waitForDetached('.modal-dialog')
148
- }
149
- }
@@ -1,96 +0,0 @@
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 { I, dialogs } = inject()
22
-
23
- module.exports = {
24
-
25
- openSecondary () {
26
- I.waitForElement('~New')
27
- I.click('.primary-action > .dropdown > button')
28
- I.waitForElement('.dropdown.open .dropdown-menu')
29
- },
30
- clickSecondary (name) {
31
- this.openSecondary()
32
- I.click(name, '.dropdown.open .dropdown-menu')
33
- },
34
- selectFile (title, { timeout = undefined } = {}) {
35
- I.waitForElement(`.filename[title="${title}"]`, timeout)
36
- I.click(`.filename[title="${title}"]`)
37
- I.wait(0.5) // wait for toolbar rendering
38
- },
39
- shareFolder (name, role) {
40
- I.clickToolbar('Share')
41
- dialogs.waitForVisible()
42
- I.waitForText('Share folder')
43
-
44
- if (role !== 'Viewer') {
45
- I.waitForVisible('.permission-pre-selection .btn')
46
- I.click('.permission-pre-selection .btn')
47
- I.clickDropdown(role)
48
- }
49
-
50
- I.waitForText(role, undefined, '.permission-pre-selection')
51
- I.click('~Select contacts')
52
-
53
- // dialog is open
54
- dialogs.waitForVisible()
55
- I.waitForElement('.modal-body .list-view.address-picker li.list-item') // check if list items are loaded
56
- I.fillField('Search', name)
57
- I.waitForText(name, undefined, '.modal-dialog .address-picker')
58
- I.waitForElement('.address-picker .list-item')
59
- I.click('.address-picker .list-item')
60
- dialogs.clickButton('Select')
61
-
62
- I.waitForText('Share folder', undefined, dialogs.header)
63
- I.waitForText('ADDED', undefined, '.permissions-view .permission.row:first-child .added')
64
- I.see('Owner', '.permissions-view .permission.row:last-child')
65
- I.see(role, '.permissions-view .permission.row:first-child')
66
- I.see('Internal user (' + name + ')', '.permissions-view .permission.row:first-child .description')
67
- dialogs.clickButton('Share')
68
- I.waitForDetached('.modal-dialog')
69
- },
70
- moveManuallyTo (destination) {
71
- I.clickToolbar('More actions')
72
- I.clickDropdown('Move')
73
-
74
- I.waitForElement('.folder-picker-dialog')
75
- I.waitForElement(`.folder-picker-dialog [data-id="${destination}"]`)
76
- I.click(`.folder-picker-dialog [data-id="${destination}"]`)
77
- I.waitForElement(`.folder-picker-dialog [data-id="${destination}"].selected`)
78
- I.click('Move', '.folder-picker-dialog')
79
- I.waitForDetached('.folder-picker-dialog')
80
- },
81
- seeListViewIcon (itemName, icon, title) {
82
- I.seeElement(`.list-item .filename[title="${itemName}"] ~ .icons span[title="${title}"] .${icon}`)
83
- },
84
- seeNumberOfListViewIcons (itemName, count) {
85
- I.seeNumberOfElements(`.list-item .filename[title="${itemName}"] ~ .icons span`, count)
86
- },
87
- seeInternalUserInShareSection (userName, email) {
88
- I.waitForText(`${userName}${email}`, undefined, '.viewer-shares-info')
89
- },
90
- seeGuestInShareSection (email) {
91
- I.waitForText(`${email}Guest`, undefined, '.viewer-shares-info')
92
- },
93
- seePublicLinkInShareSection () {
94
- I.waitForText('Public link', undefined, '.viewer-shares-info')
95
- }
96
- }
@@ -1,45 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- suggestion: locate('.tt-dropdown-menu .tt-suggestion:nth-of-type(1)').as('First suggestion'),
26
- suggestions: locate('.tt-dropdown-menu').as('Suggestion dropdown'),
27
-
28
- select (elementName, within) {
29
- const context = within === '*' ? '//span[@class="tt-dropdown-menu"]' : `//div[contains(@class, "${within}")]//span[@class="tt-dropdown-menu"]`
30
-
31
- I.waitForText(elementName, 10, context)
32
-
33
- // searched entry could be a resource or user where the DOM structure differs
34
- const searchEntry = locate(`${context}//div[@class="participant-name"]/strong[text()="${elementName}"]|//div[@class="participant-email"]/span/strong[text()="${elementName}"]`).as(elementName)
35
- I.waitForElement(searchEntry, 10)
36
- I.click(searchEntry)
37
- },
38
-
39
- selectFirst () {
40
- I.waitForVisible(this.suggestion)
41
- I.waitForEnabled(this.suggestion)
42
- I.click(this.suggestion)
43
- I.waitForInvisible(this.suggestions)
44
- }
45
- }
@@ -1,50 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- results: locate('.addressbook-popup').find('.list-item').as('Results'),
26
-
27
- ready () {
28
- I.waitForVisible('.addressbook-popup')
29
- },
30
-
31
- async add (query) {
32
- this.ready()
33
- await I.waitForFocus('.addressbook-popup .search-field')
34
- I.fillField('.addressbook-popup .search-field', query)
35
- I.waitForVisible(this.results)
36
- this.selectFirst()
37
- },
38
-
39
- selectFirst () {
40
- I.waitForEnabled(this.results)
41
- I.waitForEnabled(this.results.first().as('First list item'))
42
- I.click(this.results.first().as('First list item'))
43
- I.waitForVisible(locate('.list-item.selected').as('Selected list item'))
44
- },
45
-
46
- close () {
47
- I.click('Select')
48
- I.waitToHide('.addressbook-popup')
49
- }
50
- }
@@ -1,41 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- main: locate('.modal:not(.hidden):not(.modal-paused) .modal-dialog').as('Modal Main'),
26
- header: locate('.modal:not(.hidden):not(.modal-paused) .modal-header').as('Modal Header'),
27
- body: locate('.modal:not(.hidden):not(.modal-paused) .modal-body').as('Modal Body'),
28
- footer: locate('.modal:not(.hidden):not(.modal-paused) .modal-footer').as('Modal Footer'),
29
-
30
- clickButton (label) {
31
- const buttonLocator = locate('.modal:not(.hidden):not(.modal-paused) .modal-footer button').withText(label).as(label)
32
- I.waitForVisible(buttonLocator)
33
- I.click(label, this.footer)
34
- },
35
-
36
- waitForVisible () {
37
- // wait for modal dialog to be visible an ready
38
- I.waitForVisible(this.main)
39
- I.waitForInvisible(locate('.modal:not(.hidden):not(.modal-paused)').find('.io-ox-busy').as('Modal Busy'), 30)
40
- }
41
- }
@@ -1,54 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- searchField: locate('#io-ox-topsearch .search-field').as('Search field'),
26
- dropdownToggle: locate('#io-ox-topsearch .dropdown-toggle').as('Toggle'),
27
- dropdown: locate('#io-ox-topsearch .dropdown').as('Dropdown'),
28
- submitButton: locate('#io-ox-topsearch .dropdown [type="submit"]').as('Submit Button'),
29
-
30
- openDropdown () {
31
- I.waitForVisible(this.dropdownToggle)
32
- I.click(this.dropdownToggle)
33
- I.waitForVisible(this.dropdown)
34
- },
35
-
36
- // introducing methods
37
- doSearch (query) {
38
- I.waitForElement('#io-ox-topsearch .search-field')
39
- I.waitForVisible('#io-ox-topsearch .search-field')
40
- I.fillField('#io-ox-topsearch .search-field', query)
41
- I.fillField('#io-ox-topsearch .search-field', query)
42
- I.pressKey('Enter')
43
- I.waitForText('Search results')
44
- I.waitToHide('.list-view .busy-indicator.io-ox-busy')
45
- },
46
-
47
- cancel () {
48
- I.click(this.searchField)
49
- I.clearField(this.searchField)
50
- I.pressKey('Enter')
51
- I.waitForInvisible('Search results')
52
- I.wait(0.5)
53
- }
54
- }
@@ -1,90 +0,0 @@
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 { I, dialogs, settings } = inject()
22
-
23
- module.exports = {
24
-
25
- section: '.io-ox-mailfilter-settings .settings-explanation',
26
- dialog: locate('.modal[data-point="io.ox/settings/mailfilter/filter/settings/detail/dialog"]').as('Create/Edit dialog'),
27
- lastaction: locate('.io-ox-mailfilter-edit .actions > li:last-of-type').as('Last action'),
28
-
29
- // there are so many tests doing this (also slightly differently)
30
- async openRules () {
31
- await settings.open('Mail', 'Rules')
32
- I.waitForElement(this.section)
33
- },
34
-
35
- async newRule (name) {
36
- I.waitForText('Add new rule')
37
- I.click('Add new rule')
38
- I.waitForVisible(this.dialog)
39
- await I.waitForFocus('[name="rulename"]')
40
- I.see('Create new rule')
41
- I.see('This rule applies to all messages. Please add a condition to restrict this rule to specific messages.')
42
- I.see('Please define at least one action.')
43
- // set rulename
44
- I.fillField('rulename', name)
45
- },
46
-
47
- addCondition (condition, value, field = 'values') {
48
- I.click('Add condition')
49
- I.clickDropdown(condition)
50
- I.waitForDetached('.dropdown.open')
51
- I.fillField(field, value)
52
- },
53
-
54
- addSubjectCondition (value) {
55
- I.click('Add condition')
56
- I.clickDropdown('Subject')
57
- I.waitForDetached('.dropdown.open')
58
- I.fillField('values', value)
59
- },
60
-
61
- addSimpleAction (label) {
62
- I.click('Add action')
63
- I.clickDropdown(label)
64
- I.waitForDetached('.dropdown.open')
65
- },
66
-
67
- addAction (label, value) {
68
- I.click('Add action')
69
- I.clickDropdown(label)
70
- I.waitForDetached('.dropdown.open')
71
- I.fillField(this.lastaction.find('input[name]'), value)
72
- },
73
-
74
- setFlag (flag) {
75
- I.click('Add action')
76
- I.clickDropdown('Set color flag')
77
- I.waitForDetached('.dropdown.open')
78
- I.waitForVisible('~Set color')
79
- I.click('~Set color')
80
-
81
- I.waitForVisible('.flag-dropdown')
82
- I.click(flag, '.flag-dropdown')
83
- },
84
-
85
- save () {
86
- dialogs.clickButton('Save')
87
- I.waitForDetached(this.dialog)
88
- I.waitForVisible('.settings-detail-pane li.settings-list-item[data-id="0"]')
89
- }
90
- }
@@ -1,71 +0,0 @@
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 { I } = inject()
22
-
23
- function getPageTitle (page) {
24
- if (page === 'General') return 'core'
25
- if (page === 'Drive') return 'files'
26
- if (page === 'Download personal data') return 'personaldata'
27
- if (page === 'Accounts') return 'io.ox/settings/accounts'
28
- return page.toLocaleLowerCase()
29
- }
30
-
31
- module.exports = {
32
- /**
33
- * Opens a new settings page in the virtual settings editor.
34
- *
35
- * @async
36
- * @param {string} [page='general'] - The name of the settings page to open.
37
- * @param {string} [section=''] - The name of the settings section to open.
38
- */
39
- async open (page = '', section = '') {
40
- page = getPageTitle(page)
41
-
42
- I.executeScript(async (page) => {
43
- const { default: ox } = await import(String(new URL('ox.js', location.href)))
44
-
45
- if (!page) page = ox.ui.App.getCurrentApp().get('id')
46
- page = ox.ui.App.getByCid(`io.ox/${page}`) ? `io.ox/${page}` : page
47
- page = page === 'core' ? 'io.ox/core' : page
48
- const { default: openSettings } = await import(String(new URL('io.ox/settings/util.js', location.href)))
49
- await openSettings(`virtual/settings/${page}`)
50
- }, page)
51
- await I.waitForApp()
52
- if (section) return this.expandSection(section)
53
- },
54
-
55
- close () {
56
- I.waitForElement('.settings-detail-pane .close-settings')
57
- I.click('.settings-detail-pane .close-settings')
58
- I.waitForDetached('.settings-detail-pane')
59
- },
60
-
61
- expandSection (title) {
62
- const locator = locate('summary').withText(title).inside('.settings-detail-pane .expandable-section').as(`Expandable section "${title}"`)
63
- I.waitForText(title, undefined, '.settings-detail-pane')
64
- I.waitForElement(locator)
65
- I.click(locator)
66
-
67
- // wait for expanded section
68
- const expanded = locate('summary').withText(title).inside('.settings-detail-pane .expandable-section[open]').as(`Expandable section "${title}" (expanded)`)
69
- I.waitForElement(expanded)
70
- }
71
- }
@@ -1,41 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
- attachInlineImage (path) {
25
- const inputId = 'temp_input_for_tinymce'
26
- I.executeScript(function (id) {
27
- const el = document.createElement('input')
28
- el.setAttribute('type', 'file')
29
- el.setAttribute('id', id)
30
- document.getElementsByTagName('body')[0].appendChild(el)
31
- el.onchange = function () {
32
- // @ts-ignore
33
- window.tinyMCE.activeEditor.uploadBlob(el.files[0])
34
- el.remove()
35
- }
36
- }, inputId)
37
- // not sure why, but it takes a little to be able to attach files here.
38
- I.wait(0.5)
39
- I.attachFile(`#${inputId}`, path)
40
- }
41
- }
@@ -1,43 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- // new connect your device wizard, see OXUI-793
26
- connectDeviceWizard () {
27
- I.waitForElement('#io-ox-topbar-settings-dropdown-icon button', 30)
28
- I.wait(1)
29
- I.click('#io-ox-topbar-settings-dropdown-icon button')
30
- I.waitForVisible(locate('a').withText('Connect your device').inside('.dropdown.open').as('Connect your device'))
31
- I.click(locate('a').withText('Connect your device').inside('.dropdown.open').as('Connect your device'))
32
- I.waitForVisible('.wizard-step')
33
- },
34
-
35
- help () {
36
- I.waitForElement('#io-ox-topbar-help-dropdown-icon')
37
- I.click('#io-ox-topbar-help-dropdown-icon .dropdown-toggle')
38
- I.waitForElement('#topbar-help-dropdown .io-ox-context-help')
39
- I.click('#topbar-help-dropdown .io-ox-context-help')
40
- I.waitForElement('.io-ox-help-window')
41
- I.waitForVisible('.inline-help-iframe', 10)
42
- }
43
- }
@@ -1,67 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- async scrollTo (x = null, y = null) {
26
- await I.executeScript(({ x, y }) => {
27
- document.querySelector('.io-ox-pdf-container.scrollable').scrollTo(x, y)
28
- }, { x, y })
29
- },
30
-
31
- async grabTextAtPoint (x = null, y = null) {
32
- return await I.executeScript(({ x, y }) => {
33
- return document.elementFromPoint(x, y).textContent
34
- }, { x, y })
35
- },
36
-
37
- async grabScrollPosition () {
38
- return await I.executeScript(() => { return document.querySelector('.io-ox-pdf-container.scrollable').scrollTop })
39
- },
40
-
41
- async clickAtPosition (x = null, y = null) {
42
- return await I.executeScript(({ x, y }) => {
43
- return document.elementFromPoint(x, y).click()
44
- }, { x, y })
45
- },
46
-
47
- /**
48
- * Set a browser selection.
49
- * @param {string} startText - The 'innerText' of the node that starts the selection.
50
- * @param {string} endText - The 'innerText' of the node that ends the selection.
51
- * @param {string} wrapperClass - The selection is searched inside the wrapper. Provide a class name ('.className') for it.
52
- * *
53
- * Using the recommended workaround by pupeteer(v20.30) to select text.
54
- * "dragging and selecting text is not possible using page.mouse"
55
- * https://pptr.dev/api/puppeteer.mouse#example-1
56
- */
57
- async setBrowserSelection (startText, endText, wrapperClass) {
58
- await I.executeScript(({ startText, endText, wrapperClass }) => {
59
- const selection = window.getSelection()
60
- const range = document.createRange()
61
- range.setStartBefore([...document.querySelectorAll(`${wrapperClass} *`)].filter(node => node.innerText.includes(startText))[0])
62
- range.setEndAfter([...document.querySelectorAll(`${wrapperClass} *`)].filter(node => node.innerText.includes(endText))[0])
63
- selection.removeAllRanges()
64
- selection.addRange(range)
65
- }, { startText, endText, wrapperClass })
66
- }
67
- }
@@ -1,66 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- composeWindow: '.io-ox-mail-compose-window',
26
- editorIframe: '.io-ox-mail-compose-window .editor iframe',
27
- to: '.to .tt-input',
28
- subject: '.mail-input [name="subject"]',
29
- editorText: '.editor .plain-text',
30
-
31
- async selectMail (text, selector) {
32
- const titleSelector = `.list-item[aria-label*="${text}"]`
33
- const senderSelector = locate('.list-view .person').withText(text).as('Mail sender')
34
- const item = selector === 'Sender' ? senderSelector : titleSelector
35
- I.waitForElement(item, 60)
36
- I.wait(1)
37
- I.click(item)
38
- await I.waitForFocus('.list-view li.list-item.selected')
39
- },
40
- async selectMailByIndex (index) {
41
- const item = locate('.list-view li.list-item').withAttr({ 'data-index': index.toString() }).as('Mail item')
42
- I.waitForElement(item)
43
- I.wait(0.5)
44
- I.click(item)
45
- await I.waitForFocus('.list-view li.list-item.selected')
46
- },
47
- async newMail () {
48
- I.clickPrimary('New email')
49
- I.waitForVisible('.active .io-ox-mail-compose [placeholder="To"]', 30)
50
- await I.waitForFocus('.active .io-ox-mail-compose [placeholder="To"]')
51
- I.waitForInvisible('.active.io-ox-mail-compose-window .window-blocker', 30)
52
- },
53
- addAttachment (path) {
54
- I.click('~Attachments')
55
- const ext = path.match(/\.(.{3,4})$/)[1]
56
- I.attachFile({ css: 'input[type=file]' }, path)
57
- I.pressKey('Escape')
58
- I.waitForText(ext, 30, '.attachment-list.preview .fallback')
59
- },
60
- send () {
61
- I.click('Send')
62
- I.wait(0.5)
63
- I.waitToHide('.io-ox-mail-compose-window')
64
- I.waitToHide('.mail-send-progress', 45)
65
- }
66
- }
@@ -1,41 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- // attr: [startDate, endDate]
26
- async setDate (attr, value) {
27
- const date = value.toFormat("yyyy-MM-dd'T'HH:mm")
28
- await I.executeScript(async ({ attr, date }) => {
29
- const fieldset = document.querySelector(`fieldset[data-attribute="${attr}"]`)
30
- const input = fieldset.querySelector('input')
31
- input.value = date
32
- input.dispatchEvent(new Event('mouseout'))
33
- }, { attr, date })
34
- },
35
- async newAppointment () {
36
- I.wait(0.5) // prevent clicking a detached element caused by the bottom toolbar being re-rendered multiple times
37
- I.click('~Create appointment', '#io-ox-appcontrol')
38
- I.waitForVisible('.io-ox-calendar-edit-window.complete input[type="text"][name="summary"]')
39
- await I.waitForFocus('.io-ox-calendar-edit-window input[type="text"][name="summary"]')
40
- }
41
- }
@@ -1,39 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- newContact () {
26
- I.wait(0.5) // prevent clicking a detached element caused by the bottom toolbar being re-rendered multiple times
27
- I.waitForElement('~New contact')
28
- I.click({ css: '[data-action="io.ox/contacts/actions/create"]' })
29
- I.waitForVisible('.io-ox-contacts-edit-window input[name="first_name"]')
30
- I.waitForText('Add personal info')
31
- },
32
-
33
- addField (fieldType, field) {
34
- I.click(`.dropdown[data-add="${fieldType}"] button`, '.contact-edit')
35
- I.waitForVisible('.dropdown.open')
36
- I.click(field)
37
- I.waitForText(field, 30, '.contact-edit')
38
- }
39
- }
@@ -1,51 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
- newMail () {
25
- I.waitForVisible('~New email')
26
- I.wait(0.5)
27
- I.click('~New email')
28
- I.waitForVisible('.io-ox-mail-compose [placeholder="To"]', 30)
29
- I.waitForInvisible('.io-ox-mail-compose-window .window-blocker', 30)
30
- I.waitForElement('.io-ox-mail-compose-window.complete')
31
- I.wait(0.5) // Wait for tinyMCE to be ready
32
- },
33
-
34
- send () {
35
- I.wait(0.5)
36
- I.click('Send')
37
- I.waitForDetached('.io-ox-mail-compose-window')
38
- I.waitToHide('.mail-send-progress', 45)
39
- },
40
-
41
- selectMail (text, selector) {
42
- const titleSelector = locate(`.list-view .subject span[title*="${text}"]`).as('Mail title')
43
- const senderSelector = locate('.list-view .person').withText(text).as('Mail sender')
44
- const item = selector === 'Sender' ? senderSelector : titleSelector
45
- I.waitForElement(item, 60)
46
- I.wait(0.5)
47
- I.click(item)
48
- I.waitForVisible('.mail-detail-pane')
49
- I.waitForInvisible('.mail-detail-pane .mail-detail .io-ox-busy')
50
- }
51
- }
@@ -1,58 +0,0 @@
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 { I } = inject()
22
-
23
- module.exports = {
24
-
25
- editWindow: '.io-ox-tasks-edit-window',
26
-
27
- newTask () {
28
- I.clickPrimary('New task')
29
- I.waitForElement('.io-ox-tasks-edit')
30
- },
31
- editTask () {
32
- I.clickToolbar('Edit')
33
- I.waitForElement('.io-ox-tasks-edit')
34
- },
35
- async selectTask (id) {
36
- const item = locate('.vgrid-cell').withText(id).as(id)
37
- I.waitForElement(item)
38
- I.click(item)
39
- await I.waitForFocus('.vgrid-cell.selected')
40
- },
41
- create () {
42
- I.click('Create')
43
- I.waitForDetached('.io-ox-tasks-edit-window')
44
- I.waitForElement('.vgrid-cell.selected.tasks')
45
- I.waitForElement('.tasks-detailview')
46
- },
47
- save () {
48
- I.click('Save')
49
- I.waitForDetached('.io-ox-tasks-edit-window')
50
- I.waitForElement('.vgrid-cell.selected.tasks')
51
- I.waitForElement('.tasks-detailview')
52
- },
53
- selectAll () {
54
- I.waitForElement('.selectable.tasks')
55
- I.click('.dropdown', '~Tasks toolbar')
56
- I.clickDropdown('Select all')
57
- }
58
- }
@@ -1,34 +0,0 @@
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 moment = require('moment')
22
-
23
- module.exports = {
24
-
25
- // return the (standard) workweek start on the current week depending on the locale
26
- getMonday (date = moment()) {
27
- // robust approach that also works:
28
- // a) over the weekend (!)
29
- // b) if firstDayOfWeek is Sunday or Saturday
30
- const firstDayOfWeek = moment.localeData(date.locale()).firstDayOfWeek()
31
- const localeWeekday = (8 - firstDayOfWeek) % 7
32
- return date.startOf('week').weekday(localeWeekday)
33
- }
34
- }