X Tutup
Skip to content

Commit af5bb04

Browse files
committed
Add UI acceptance test for Username on Personal General Settings page
1 parent bec1f91 commit af5bb04

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

tests/acceptance/features/bootstrap/WebUIPersonalGeneralSettingsContext.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,22 @@ public function groupShouldBeDisplayedOnThePersonalGeneralSettingsPageOnTheWebui
286286
);
287287
}
288288

289+
/**
290+
* @Then username :userName should be displayed on the personal general settings page on the webUI
291+
*
292+
* @param string $userName
293+
*
294+
* @return void
295+
*/
296+
public function usernameShouldBeDisplayedOnThePersonalGeneralSettingsPageOnTheWebui(string $userName):void {
297+
Assert::assertEquals(
298+
$userName,
299+
$this->personalGeneralSettingsPage->getUsername(),
300+
__METHOD__
301+
. " Username '$userName' is not displayed on the personal general settings page on the webUI."
302+
);
303+
}
304+
289305
/**
290306
* @When the user follows the email change confirmation link received by :emailAddress using the webUI
291307
* @Given the user has followed the email change confirmation link received by :emailAddress using the webUI

tests/acceptance/features/lib/PersonalGeneralSettingsPage.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class PersonalGeneralSettingsPage extends OwncloudPage {
5050

5151
protected $versionSectionXpath = "//div[@id='OC\\Settings\\Panels\\Personal\\Version']";
5252
protected $federatedCloudIDXpath = "//*[@id='fileSharingSettings']/p/strong";
53+
protected $usernameXpath = "//div[@id='OC\\Settings\\Panels\\Personal\\Profile']/div[@id='username']";
5354
protected $groupListXpath = "//div[@id='OC\\Settings\\Panels\\Personal\\Profile']/div[@id='groups']";
5455

5556
protected $setProfilePicFromFilesBtnXpath = "//*[@id='selectavatar']";
@@ -200,6 +201,18 @@ public function getFederatedCloudID(): string {
200201
return $this->find("xpath", $this->federatedCloudIDXpath)->getText();
201202
}
202203

204+
/**
205+
* get username displayed in the UI
206+
*
207+
* @return string
208+
*/
209+
public function getUsername(): string {
210+
$this->waitTillElementIsNotNull($this->usernameXpath);
211+
// The text is like "Username Alice"
212+
$text = $this->find("xpath", $this->usernameXpath)->getText();
213+
return \substr($text, \strlen("Username "));
214+
}
215+
203216
/**
204217
* check if a group with given name is displayed in the UI
205218
*

tests/acceptance/features/webUIPersonalSettings/personalGeneralSettings.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ Feature: personal general settings
3535
And group "new-group" should be displayed on the personal general settings page on the webUI
3636
And group "another-group" should be displayed on the personal general settings page on the webUI
3737

38+
@skipOnOcV10.11 @skipOnOcV10.10
39+
Scenario: user sees their username displayed on the personal general settings page
40+
Given the administrator has changed the display name of user "Alice" to "New display name"
41+
And the user has reloaded the current page of the webUI
42+
Then "New display name" should be shown as the name of the current user on the webUI
43+
And username "Alice" should be displayed on the personal general settings page on the webUI
44+
3845

3946
Scenario: User sets profile picture from their existing cloud file
4047
Given user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "/testimage.jpg"

0 commit comments

Comments
 (0)
X Tutup