diff --git a/.drone.env b/.drone.env index 3ddb27f70c6..d0e98d09a25 100644 --- a/.drone.env +++ b/.drone.env @@ -1,3 +1,3 @@ # The version of OCIS to use in pipelines that test against OCIS -OCIS_COMMITID=01f660418296efe4018409f8887e33ec068a70ac +OCIS_COMMITID=33d9be383249a9e2db2c0c1207797227186d6649 OCIS_BRANCH=master diff --git a/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature index 4795d30da5c..749f4da2ec5 100644 --- a/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature +++ b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature @@ -58,10 +58,10 @@ Feature: Sharing files and folders with internal groups | entry_name | | simple-folder | | testimage.jpg | - And these resources should be listed in the folder "/Shares%2Fsimple-folder" on the webUI + And these resources should be listed in the folder "/Shares/simple-folder" on the webUI | entry_name | | lorem.txt | - But these resources should not be listed in the folder "/Shares%2Fsimple-folder" on the webUI + But these resources should not be listed in the folder "/Shares/simple-folder" on the webUI | entry_name | | simple-folder | When the user browses to the shared-with-me page diff --git a/tests/acceptance/pageObjects/FilesPageElement/filesList.js b/tests/acceptance/pageObjects/FilesPageElement/filesList.js index 1084e9382da..46909b5b00a 100644 --- a/tests/acceptance/pageObjects/FilesPageElement/filesList.js +++ b/tests/acceptance/pageObjects/FilesPageElement/filesList.js @@ -210,13 +210,21 @@ module.exports = { * @param {string} folder */ navigateToFolder: async function (folder) { - await this.waitForFileVisible(folder) + const paths = folder.split('/') + for (const folderName of paths) { + if (folderName === '') { + continue + } - await this.useXpath().click(this.getFileLinkSelectorByFileName(folder, 'folder')).useCss() + await this.waitForFileVisible(folderName) - // wait until loading is finished - await this.waitForLoadingFinished() + await this.useXpath() + .click(this.getFileLinkSelectorByFileName(folderName, 'folder')) + .useCss() + // wait until loading is finished + await this.waitForLoadingFinished() + } return this }, diff --git a/tests/acceptance/pageObjects/FilesPageElement/publicLinksDialog.js b/tests/acceptance/pageObjects/FilesPageElement/publicLinksDialog.js index aa3a09611eb..1dacf2b6492 100644 --- a/tests/acceptance/pageObjects/FilesPageElement/publicLinksDialog.js +++ b/tests/acceptance/pageObjects/FilesPageElement/publicLinksDialog.js @@ -315,6 +315,7 @@ module.exports = { return this.waitForElementVisible('@publicLinkCreateButton') .initAjaxCounters() .click('@publicLinkCreateButton') + .waitForElementNotPresent('@popupNotificationMessage') .waitForOutstandingAjaxCalls() }, /** @@ -545,6 +546,11 @@ module.exports = { } }, elements: { + popupNotificationMessage: { + selector: + '//*[contains(@class, "oc-notification-message")]//div[contains(@class, "oc-notification-message-title")]', + locateStrategy: 'xpath' + }, latestLinkName: { selector: '//div[@id="oc-files-file-link"]//ul/li[1]//h4', locateStrategy: 'xpath' diff --git a/tests/acceptance/pageObjects/personalPage.js b/tests/acceptance/pageObjects/personalPage.js index 3b9dd698246..40ef936a35b 100644 --- a/tests/acceptance/pageObjects/personalPage.js +++ b/tests/acceptance/pageObjects/personalPage.js @@ -22,11 +22,9 @@ module.exports = { * * @param {string} folder */ - navigateToFolder: function (folder) { - return this.page.FilesPageElement.filesList() - .navigateToFolder(folder) - .waitForElementVisible('@breadcrumb') - .assert.containsText('@breadcrumb', folder) + navigateToFolder: async function (folder) { + await this.page.FilesPageElement.filesList().navigateToFolder(folder) + return this }, /** * diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index 392848b0c43..b681ac028e3 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -797,7 +797,8 @@ Then('these files/folders/resources should be listed on the webUI', function (en Then( 'these files/folders/resources should be listed in the folder {string} on the webUI', async function (folder, entryList) { - await client.page.personalPage().navigateAndWaitTillLoaded(folder) + await client.page.personalPage().navigateAndWaitTillLoaded() + await client.page.personalPage().navigateToFolder(folder) return theseResourcesShouldBeListed(entryList) } ) diff --git a/tests/e2e/cucumber/features/smoke/admin-settings/users.ocis.feature b/tests/e2e/cucumber/features/smoke/admin-settings/users.ocis.feature index 57d5dbc46b4..f8639935f80 100644 --- a/tests/e2e/cucumber/features/smoke/admin-settings/users.ocis.feature +++ b/tests/e2e/cucumber/features/smoke/admin-settings/users.ocis.feature @@ -91,10 +91,10 @@ Feature: users management And "Admin" opens the "admin-settings" app And "Admin" navigates to the users management page When "Admin" changes userName to "anna" for user "Alice" using the sidebar panel - And "Admin" changes displayName to "Anna Murphy" for user "Alice" using the sidebar panel - And "Admin" changes email to "anna@example.org" for user "Alice" using the sidebar panel - And "Admin" changes password to "password" for user "Alice" using the sidebar panel - And "Admin" changes role to "Space Admin" for user "Alice" using the sidebar panel + And "Admin" changes displayName to "Anna Murphy" for user "anna" using the sidebar panel + And "Admin" changes email to "anna@example.org" for user "anna" using the sidebar panel + And "Admin" changes password to "password" for user "anna" using the sidebar panel + And "Admin" changes role to "Space Admin" for user "anna" using the sidebar panel And "Admin" logs out When "anna" logs in Then "anna" should have self info: diff --git a/tests/e2e/cucumber/steps/ui/public.ts b/tests/e2e/cucumber/steps/ui/public.ts index 45bb300d015..cc4403d3974 100644 --- a/tests/e2e/cucumber/steps/ui/public.ts +++ b/tests/e2e/cucumber/steps/ui/public.ts @@ -15,18 +15,6 @@ When( user = this.usersEnvironment.getUser({ key: stepUser }) } catch (e) {} - if (!user) { - user = this.usersEnvironment.createUser({ - key: stepUser, - user: { - id: stepUser, - displayName: stepUser, - password: '', - email: '' - } - }) - } - let actor try { actor = this.actorsEnvironment.getActor(user) diff --git a/tests/e2e/support/api/graph/userManagement.ts b/tests/e2e/support/api/graph/userManagement.ts index 5747d6ba0e6..863321dfc7f 100644 --- a/tests/e2e/support/api/graph/userManagement.ts +++ b/tests/e2e/support/api/graph/userManagement.ts @@ -4,6 +4,7 @@ import join from 'join-path' import { config } from '../../../config' import { getApplicationEntity } from './utils' import { userRoleStore } from '../../store' +import { UsersEnvironment } from '../../environment' export const me = async ({ user }: { user: User }): Promise => { const response = await request({ @@ -32,9 +33,8 @@ export const createUser = async ({ user, admin }: { user: User; admin: User }): checkResponseStatus(response, 'Failed while creating user') - const responseData = await response.json() - user.uuid = responseData.id - + const usersEnvironment = new UsersEnvironment() + usersEnvironment.storeCreatedUser({ user: { ...user, uuid: (await response.json()).id } }) return user } @@ -44,7 +44,10 @@ export const deleteUser = async ({ user, admin }: { user: User; admin: User }): path: join('graph', 'v1.0', 'users', user.id), user: admin }) - + try { + const usersEnvironment = new UsersEnvironment() + usersEnvironment.removeCreatedUser({ key: user.id }) + } catch (e) {} return user } diff --git a/tests/e2e/support/api/userManagement.ts b/tests/e2e/support/api/userManagement.ts index 6b919c9c06a..49a169f3e07 100644 --- a/tests/e2e/support/api/userManagement.ts +++ b/tests/e2e/support/api/userManagement.ts @@ -2,6 +2,7 @@ import { checkResponseStatus, checkOCJsonStatus, request } from './http' import { Group, User } from '../types' import { URLSearchParams } from 'url' import join from 'join-path' +import { UsersEnvironment } from '../environment' export const createUser = async ({ user, admin }: { user: User; admin: User }): Promise => { const promChain = [] @@ -21,8 +22,11 @@ export const createUser = async ({ user, admin }: { user: User; admin: User }): }) checkResponseStatus(response, 'Failed while creating user') - const json = await response.json() - checkOCJsonStatus(json, 'Failed while creating user') + const jsonResponse = await response.json() + checkOCJsonStatus(jsonResponse, 'Failed while creating user') + + const usersEnvironment = new UsersEnvironment() + usersEnvironment.storeCreatedUser({ user: { ...user, uuid: jsonResponse.id } }) } ;[ @@ -55,7 +59,10 @@ export const deleteUser = async ({ user, admin }: { user: User; admin: User }): path: join('ocs', 'v2.php', 'cloud', 'users', encodeURIComponent(user.id)), user: admin }) - + try { + const usersEnvironment = new UsersEnvironment() + usersEnvironment.removeCreatedUser({ key: user.id }) + } catch (e) {} return user } diff --git a/tests/e2e/support/environment/userManagement.ts b/tests/e2e/support/environment/userManagement.ts index 7b392c241f8..48c93e1c78f 100644 --- a/tests/e2e/support/environment/userManagement.ts +++ b/tests/e2e/support/environment/userManagement.ts @@ -1,29 +1,69 @@ import { Group, User } from '../types' import { dummyUserStore, dummyGroupStore } from '../store' +import { createdUserStore } from '../store/user' export class UsersEnvironment { getUser({ key }: { key: string }): User { - const uniqueKey = key.toLowerCase() + const userKey = key.toLowerCase() - if (!dummyUserStore.has(uniqueKey)) { - throw new Error(`user with key '${uniqueKey}' not found`) + if (!dummyUserStore.has(userKey)) { + throw new Error(`user with key '${userKey}' not found`) } - return dummyUserStore.get(uniqueKey) + return dummyUserStore.get(userKey) } createUser({ key, user }: { key: string; user: User }): User { - const uniqueKey = key.toLowerCase() + const userKey = key.toLowerCase() - if (dummyUserStore.has(uniqueKey)) { - throw new Error(`user with key '${uniqueKey}' already exists`) + if (dummyUserStore.has(userKey)) { + throw new Error(`user with key '${userKey}' already exists`) + } + + dummyUserStore.set(userKey, user) + + return user + } + + storeCreatedUser({ user }: { user: User }): User { + if (createdUserStore.has(user.id)) { + throw new Error(`user '${user.id}' already exists`) + } + createdUserStore.set(user.id, user) + + return user + } + + getCreatedUser({ key }: { key: string }): User { + const userKey = key.toLowerCase() + if (!createdUserStore.has(userKey)) { + throw new Error(`user with key '${userKey}' not found`) } - dummyUserStore.set(uniqueKey, user) + return createdUserStore.get(userKey) + } + + updateCreatedUser({ key, user }: { key: string; user: User }): User { + const userKey = key.toLowerCase() + if (!createdUserStore.has(userKey)) { + throw new Error(`user '${userKey}' not found`) + } + createdUserStore.delete(userKey) + createdUserStore.set(user.id, user) return user } + removeCreatedUser({ key }: { key: string }): boolean { + const userKey = key.toLowerCase() + + if (!createdUserStore.has(userKey)) { + throw new Error(`user '${userKey}' not found`) + } + + return createdUserStore.delete(userKey) + } + getGroup({ key }: { key: string }): Group { const uniqueKey = key.toLowerCase() diff --git a/tests/e2e/support/objects/app-admin-settings/users/actions.ts b/tests/e2e/support/objects/app-admin-settings/users/actions.ts index 16c6062e4f9..245d2ac9d16 100644 --- a/tests/e2e/support/objects/app-admin-settings/users/actions.ts +++ b/tests/e2e/support/objects/app-admin-settings/users/actions.ts @@ -35,13 +35,23 @@ const displayNameInput = '#create-user-input-display-name' const emailInput = '#create-user-input-email' const passwordInput = '#create-user-input-password' +export interface UserInterface { + displayName: string + givenName: string + id: string + mail: string + onPremisesSamAccountName: string + surname: string + userType: string +} + export const createUser = async (args: { page: Page name: string displayname: string email: string password: string -}): Promise => { +}): Promise => { const { page, name, displayname, email, password } = args await page.locator(createUserButton).click() await page.locator(userNameInput).fill(name) @@ -49,13 +59,15 @@ export const createUser = async (args: { await page.locator(emailInput).fill(email) await page.locator(passwordInput).fill(password) - await Promise.all([ + const [response] = await Promise.all([ page.waitForResponse( (resp) => resp.url().endsWith('users') && resp.status() === 200 && resp.request().method() === 'POST' ), - await page.locator(actionConfirmButton).click() + page.locator(actionConfirmButton).click() ]) + + return await response.json() } export const changeAccountEnabled = async (args: { page: Page diff --git a/tests/e2e/support/objects/app-admin-settings/users/index.ts b/tests/e2e/support/objects/app-admin-settings/users/index.ts index 3c7f0e1fbbc..af2ba977f06 100644 --- a/tests/e2e/support/objects/app-admin-settings/users/index.ts +++ b/tests/e2e/support/objects/app-admin-settings/users/index.ts @@ -27,7 +27,7 @@ export class Users { this.#page = page } getUUID({ key }: { key: string }): string { - return this.#usersEnvironment.getUser({ key }).uuid + return this.#usersEnvironment.getCreatedUser({ key }).uuid } async allowLogin({ key, action }: { key: string; action: string }): Promise { @@ -104,9 +104,19 @@ export class Users { action: string }): Promise { const uuid = this.getUUID({ key }) + await openEditPanel({ page: this.#page, uuid, action }) await changeUser({ uuid, attribute: attribute, value: value, page: this.#page }) + const currentUser = this.#usersEnvironment.getCreatedUser({ key }) + + if (attribute !== 'role') { + this.#usersEnvironment.updateCreatedUser({ + key: key, + user: { ...currentUser, [attribute === 'userName' ? 'id' : attribute]: value } + }) + } } + async addToGroups({ key, groups, @@ -139,6 +149,7 @@ export class Users { async deleteUserUsingBatchAction({ userIds }: { userIds: string[] }): Promise { await deleteUserUsingBatchAction({ page: this.#page, userIds }) } + async createUser({ name, displayname, @@ -150,7 +161,17 @@ export class Users { email: string password: string }): Promise { - await createUser({ page: this.#page, name, displayname, email, password }) + const response = await createUser({ page: this.#page, name, displayname, email, password }) + + this.#usersEnvironment.storeCreatedUser({ + user: { + id: response.onPremisesSamAccountName, + displayName: response.displayName, + password: password, + email: response.mail, + uuid: response.id + } + }) } async openEditPanel({ key, action }: { key: string; action: string }): Promise {