@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.
Files changed (48) hide show
  1. package/.env.defaults +47 -0
  2. package/README.md +40 -0
  3. package/chai.d.ts +5 -0
  4. package/customRerun.js +135 -0
  5. package/global.d.ts +5 -0
  6. package/index.js +187 -0
  7. package/package.json +39 -0
  8. package/src/actor.js +174 -0
  9. package/src/appsuiteHttpClient.js +155 -0
  10. package/src/chai.d.ts +6 -0
  11. package/src/chai.js +58 -0
  12. package/src/contexts/contexts.js +172 -0
  13. package/src/contexts/reseller.js +248 -0
  14. package/src/contexts.js +29 -0
  15. package/src/event.js +54 -0
  16. package/src/helper.js +817 -0
  17. package/src/pageobjects/calendar.js +226 -0
  18. package/src/pageobjects/contacts.js +148 -0
  19. package/src/pageobjects/drive.js +96 -0
  20. package/src/pageobjects/fragments/contact-autocomplete.js +45 -0
  21. package/src/pageobjects/fragments/contact-picker.js +50 -0
  22. package/src/pageobjects/fragments/dialogs.js +41 -0
  23. package/src/pageobjects/fragments/search.js +54 -0
  24. package/src/pageobjects/fragments/settings-mailfilter.js +90 -0
  25. package/src/pageobjects/fragments/settings.js +71 -0
  26. package/src/pageobjects/fragments/tinymce.js +41 -0
  27. package/src/pageobjects/fragments/topbar.js +43 -0
  28. package/src/pageobjects/fragments/viewer.js +67 -0
  29. package/src/pageobjects/mail.js +67 -0
  30. package/src/pageobjects/mobile/mobileCalendar.js +41 -0
  31. package/src/pageobjects/mobile/mobileContacts.js +40 -0
  32. package/src/pageobjects/mobile/mobileMail.js +51 -0
  33. package/src/pageobjects/tasks.js +58 -0
  34. package/src/plugins/emptyModule/index.js +21 -0
  35. package/src/plugins/settingsInit/index.js +35 -0
  36. package/src/plugins/testmetrics/index.js +135 -0
  37. package/src/soap/services/context.js +147 -0
  38. package/src/soap/services/oxaas.js +36 -0
  39. package/src/soap/services/resellerContext.js +65 -0
  40. package/src/soap/services/resellerUser.js +100 -0
  41. package/src/soap/services/user.js +114 -0
  42. package/src/soap/services/util.js +39 -0
  43. package/src/soap/soap.js +172 -0
  44. package/src/users/reseller.js +233 -0
  45. package/src/users/users.js +183 -0
  46. package/src/users.js +29 -0
  47. package/src/util.js +104 -0
  48. package/steps.d.ts +16 -0
@@ -0,0 +1,226 @@
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 moment = require('moment')
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
+
30
+ async newAppointment () {
31
+ I.wait(1)
32
+ I.clickPrimary('New appointment')
33
+ I.waitForVisible(this.editWindow)
34
+ await I.waitForFocus('.io-ox-calendar-edit-window input[type="text"][name="summary"]')
35
+ },
36
+
37
+ clickAppointment (title, position = 1) {
38
+ I.wait(0.5) // wait for rendering
39
+ const appointment = locate('.page.current .appointment .title').withText(title).at(position).as('Appointment')
40
+ I.waitForElement(appointment)
41
+ I.scrollTo(appointment)
42
+ I.click(appointment)
43
+ },
44
+
45
+ getNextMonday () {
46
+ // isoWeekday is Monday=1 ... Sunday=7
47
+ // 8 means next Monday; also over the weekend before
48
+ return moment().isoWeekday(8).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
+ async addParticipant (name, exists, context, addedParticipants) {
110
+ if (!context) context = '*'
111
+ if (!addedParticipants) addedParticipants = 1
112
+
113
+ // does suggestion exists (for contact, user, ...)
114
+ exists = typeof exists === 'boolean' ? exists : true
115
+ const number = await I.grabNumberOfVisibleElements(locate('.attendee').inside(context).as('Attendee')) + addedParticipants
116
+ const addParticipantsLocator = locate('.add-participant.tt-input').inside(context).as('Add participant field')
117
+ // input field
118
+ I.waitForVisible(addParticipantsLocator)
119
+ I.waitForEnabled(addParticipantsLocator)
120
+ I.fillField(addParticipantsLocator, name)
121
+ I.seeInField(addParticipantsLocator, name)
122
+ // tokenfield/typeahead
123
+ if (exists) {
124
+ autocomplete.select(name, context.replace('.', ''))
125
+ } else {
126
+ I.pressKey('Enter')
127
+ }
128
+
129
+ I.waitForInvisible(autocomplete.suggestions)
130
+ // note: might be more than one that get's added (group)
131
+ I.waitForElement(locate('.attendee').inside(context).at(number).as(`Attendee ${number}`))
132
+ },
133
+
134
+ async addParticipantByPicker (name) {
135
+ I.click('~Select contacts')
136
+ await contactpicker.add(name)
137
+ contactpicker.close()
138
+ I.waitForText(name, undefined, '.attendee-container')
139
+ },
140
+
141
+ switchView (view) {
142
+ I.waitForElement('.page.current .calendar-header > .dropdown button')
143
+ I.click('.page.current .calendar-header > .dropdown button')
144
+ I.waitForText(view, undefined, '.open .dropdown-menu')
145
+ I.click(locate('.dropdown.open a').withText(view).as('Switch to ' + view))
146
+ I.wait(2)
147
+ },
148
+
149
+ getFullname (user) {
150
+ return `${user.get('sur_name')}, ${user.get('given_name')}`
151
+ },
152
+
153
+ async createAppointment ({ subject, location, folder, startDate, startTime, endDate, endTime }) {
154
+ // select calendar
155
+ if (folder) {
156
+ I.selectFolder(folder)
157
+ I.waitForElement('li.selected[aria-label^="' + folder + '"] .color-label')
158
+ }
159
+
160
+ I.clickPrimary('New appointment')
161
+ I.waitForVisible(locate('.io-ox-calendar-edit-window').as('Edit Dialog'))
162
+ await I.waitForFocus('.io-ox-calendar-edit-window input[type="text"][name="summary"]')
163
+
164
+ if (folder) {
165
+ I.see(folder, '.io-ox-calendar-edit-window .folder-selection')
166
+ }
167
+ await within('.io-ox-calendar-edit-window', async () => {
168
+ I.fillField('Title', subject)
169
+
170
+ if (location) I.fillField('Location', location)
171
+
172
+ if (startDate) {
173
+ I.click('~Date (M/D/YYYY)')
174
+ I.pressKey(['Control', 'a'])
175
+ I.pressKey(startDate)
176
+ I.pressKey('Enter')
177
+ }
178
+
179
+ if (startTime) {
180
+ I.click('~Start time')
181
+ I.click(startTime)
182
+ }
183
+
184
+ if (endDate) {
185
+ I.click('~Date (M/D/YYYY)', '.dateinput[data-attribute="endDate"]')
186
+ I.pressKey(['Control', 'a'])
187
+ I.pressKey(startDate)
188
+ I.pressKey('Enter')
189
+ }
190
+
191
+ if (endTime) {
192
+ I.click('~End time')
193
+ I.click(endTime)
194
+ }
195
+
196
+ // save
197
+ I.click('Create')
198
+ })
199
+ I.waitForDetached('.io-ox-calendar-edit-window')
200
+ },
201
+
202
+ // remove previously created appointments by appointment title
203
+ async removeAllAppointments (title) {
204
+ const { skipRefresh } = await I.executeScript(async function (title) {
205
+ const appointments = [...document.querySelectorAll('.appointment')]
206
+ .map(el => {
207
+ const folder = el.getAttribute('data-folder')
208
+ return { folder, id: el.getAttribute('data-cid').replace(folder + '.', '') }
209
+ })
210
+ if (appointments.length === 0) return { skipRefresh: true }
211
+ const { default: api } = await import(String(new URL('io.ox/calendar/api.js', location.href)))
212
+ return await api.remove(appointments, {})
213
+ }, title)
214
+ if (skipRefresh === true) return
215
+ I.click('#io-ox-refresh-icon')
216
+ I.waitForDetached('#io-ox-refresh-icon .fa-spin')
217
+ },
218
+
219
+ async setDateTo (dateString) {
220
+ await I.executeScript(async function (dateStr) {
221
+ const { default: apps } = await import(String(new URL('io.ox/core/api/apps.js', location.href)))
222
+ const { moment } = await import(String(new URL('e2e.js', location.href)))
223
+ apps.get('io.ox/calendar').setDate(moment(dateStr))
224
+ }, dateString)
225
+ }
226
+ }
@@ -0,0 +1,148 @@
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
+
27
+ selectContact (text) {
28
+ I.waitForElement(`.vgrid [aria-label="${text}"]`)
29
+ I.click(`.vgrid [aria-label="${text}"]`)
30
+ I.waitForElement('.contact-header')
31
+ I.waitForText(text, undefined, '.contact-header .fullname')
32
+ },
33
+
34
+ selectListItem (text, selector = '.last_name') {
35
+ I.waitForElement(locate(`.vgrid-cell ${selector}`).withText(text).as(text))
36
+ I.click(locate(`.vgrid-cell ${selector}`).withText(text).as(text))
37
+ I.waitForElement(locate(`.contact-detail h1 ${selector}`).withText(text).as(text))
38
+ I.wait(0.5)
39
+ },
40
+
41
+ newAddressbook (name) {
42
+ I.click('button.contextmenu-control', '~My address books')
43
+ I.clickDropdown('Add new address book')
44
+ dialogs.waitForVisible()
45
+ I.fillField('[placeholder="New address book"][type="text"]', name)
46
+ dialogs.clickButton('Add')
47
+ I.waitForDetached('.modal-dialog')
48
+ },
49
+
50
+ newContact () {
51
+ I.waitForDetached('.dropdown-toggle.disabled')
52
+ I.clickPrimary('New contact')
53
+ I.waitForText('Add personal info')
54
+ },
55
+
56
+ newDistributionlist () {
57
+ I.waitForDetached('.dropdown-toggle.disabled')
58
+ const button = locate('.primary-action .btn-group').withText('New contact').as('Primary Dropdown Button: New contact')
59
+ I.waitForVisible(button)
60
+ I.click(locate('.dropdown-toggle').inside(button).as('Dropdown Toggle'))
61
+ I.click('New distribution list', '.primary-action .btn-group > .dropdown-menu')
62
+ I.waitForText('Participants')
63
+ },
64
+
65
+ addField (fieldType, field) {
66
+ I.click(`.dropdown[data-add="${fieldType}"] button`, '.contact-edit')
67
+ I.waitForVisible('.dropdown.open .dropdown-menu')
68
+ I.click(field)
69
+ I.waitForText(field, 30, '.contact-edit')
70
+ },
71
+
72
+ editMyAccount () {
73
+ I.waitForVisible('.dropdown-toggle[aria-label="My account"]')
74
+ I.waitForVisible('.contact-picture')
75
+ I.click('.contact-picture')
76
+ I.waitForText('Edit personal data', 30, '.dropdown.open .dropdown-menu')
77
+ I.click('Edit personal data', '.dropdown.open .dropdown-menu')
78
+ I.waitForVisible(this.editWindow)
79
+ },
80
+
81
+ deleteSelected () {
82
+ I.clickToolbar('Delete')
83
+ dialogs.waitForVisible()
84
+ dialogs.clickButton('Delete')
85
+ I.waitForDetached('.modal-dialog')
86
+ },
87
+
88
+ async hasImage () {
89
+ const rule = await I.grabCssPropertyFrom('.contact-header .contact-photo', 'background-image')
90
+ expect(rule).not.to.match(/fallback/)
91
+ expect(rule).to.match(/^url\(/)
92
+ },
93
+
94
+ importCSV (file, path = 'media/imports/contacts', folder = 'Contacts') {
95
+ I.rightClick(`~${folder}`)
96
+ I.clickDropdown('Import')
97
+ dialogs.waitForVisible()
98
+ I.selectOption('Format', 'CSV')
99
+ I.attachFile('.file-input', `${path}/${file}.csv`)
100
+ dialogs.clickButton('Import')
101
+ I.waitForDetached('.modal-dialog')
102
+ I.waitForText('Data imported successfully')
103
+ },
104
+
105
+ importVCF (file, path = 'media/imports/contacts', folder = 'Contacts') {
106
+ I.rightClick(`~${folder}`)
107
+ I.clickDropdown('Import')
108
+ dialogs.waitForVisible()
109
+ I.selectOption('Format', 'VCARD')
110
+ I.attachFile('.file-input', `${path}/${file}.vcf`)
111
+ dialogs.clickButton('Import')
112
+ I.waitForDetached('.modal-dialog')
113
+ I.waitForText('Data imported successfully')
114
+ },
115
+
116
+ async exportCSV (file) {
117
+ I.clickToolbar('More actions')
118
+ I.clickDropdown('Export')
119
+ dialogs.waitForVisible()
120
+ I.checkOption('CSV')
121
+ I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.csv`)
122
+ I.waitForDetached('.modal-dialog')
123
+ },
124
+ async exportVCF (file) {
125
+ I.clickToolbar('More actions')
126
+ I.clickDropdown('Export')
127
+ dialogs.waitForVisible()
128
+ I.checkOption('vCard')
129
+ I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.vcf`)
130
+ I.waitForDetached('.modal-dialog')
131
+ },
132
+ async exportAddressBookCSV (file) {
133
+ I.rightClick('~Contacts')
134
+ I.clickDropdown('Export')
135
+ dialogs.waitForVisible()
136
+ I.checkOption('CSV')
137
+ I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.csv`)
138
+ I.waitForDetached('.modal-dialog')
139
+ },
140
+ async exportAddressBookVCF (file) {
141
+ I.rightClick('~Contacts')
142
+ I.clickDropdown('Export')
143
+ dialogs.waitForVisible()
144
+ I.checkOption('vCard')
145
+ I.waitForDownload('.modal-dialog button:has-text("Export")', `${file}.vcf`)
146
+ I.waitForDetached('.modal-dialog')
147
+ }
148
+ }
@@ -0,0 +1,96 @@
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
+ }
@@ -0,0 +1,45 @@
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
+ }
@@ -0,0 +1,50 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,54 @@
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
+ }