Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Comptoir
Comptoir-srv
Commits
ae0ecd04
Commit
ae0ecd04
authored
Jun 08, 2020
by
Fabrice Gangler
🎨
Committed by
Matthieu FAURE
Jun 08, 2020
Browse files
TEST: improve tests for edit user account
Check if user can modify his account and use the buttons afterwards Refs:
#898
parent
540b2e2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/Acceptance/UserAdministrationCheckActionsCest.php
View file @
ae0ecd04
...
...
@@ -262,6 +262,41 @@ class UserAdministrationCheckActionsCest
$I
->
seeElement
(
'div.message.success'
);
}
/**
* Commun to edit a connected user account
* to modify information such as name, url, description, email and avatar.
*
* Here we add an url and a word as description.
* If the username is provided, it is also updated.
*
* @param AcceptanceTester $I
* @param string $username default: ''
*/
private
function
commonEditeUserAccount
(
AcceptanceTester
$I
,
string
$username
=
''
)
{
$updateData
=
[
'url'
=>
'http://localhost:8080/users/284'
,
'description'
=>
'administration'
,
];
$checkNewName
=
false
;
if
(
!
empty
(
$username
))
{
$updateData
[
'username'
]
=
$username
;
$checkNewName
=
true
;
}
$lang
=
$this
->
lang
;
$I
->
click
(
"a[href=
\"
/
$lang
/users/edit/284
\"
]"
);
// Edit user's button
$I
->
canSeeInCurrentUrl
(
'/users/edit/284'
);
$I
->
submitForm
(
'#editInformationAccountForm'
,
$updateData
);
$I
->
canSeeInCurrentUrl
(
'/users/284'
);
$I
->
seeElement
(
'div.message.success'
);
if
(
$checkNewName
===
true
)
{
$I
->
see
(
$username
,
[
'css'
=>
'#userPageFirstTitle'
]);
$I
->
see
(
$username
,
[
'css'
=>
'li a'
]);
}
}
/**
* Edit a connected user account to modify information such as name, url, description, email and avatar.
* Here we add an url and a word as description.
...
...
@@ -273,21 +308,65 @@ class UserAdministrationCheckActionsCest
* @return void
*/
public
function
editeUserAccount
(
AcceptanceTester
$I
)
{
$this
->
commonEditeUserAccount
(
$I
);
}
/**
* Edit a connected user account to modify name, url and description
* and then declare as user of software
*
* @group userAccount
* @group userAccount_edit
*
* @param AcceptanceTester $I codeception variable
* @return void
*/
public
function
editAccountAndDeclareUserOf
(
AcceptanceTester
$I
)
{
$lang
=
$this
->
lang
;
$I
->
click
(
"a[href=
\"
/
$lang
/users/edit/284
\"
]"
);
// Edit user's button
$I
->
canSeeInCurrentUrl
(
'/users/edit/284'
);
$I
->
submitForm
(
'#editInformationAccountForm'
,
[
'url'
=>
'http://localhost:8080/users/284'
,
'description'
=>
'administration'
,
]
);
$I
->
canSeeInCurrentUrl
(
'/users/284'
);
$oldName
=
'dev-collectivite'
;
$newName
=
'dev-coll4ectivite updated'
;
$softwareId
=
163
;
$softwareToAddAsUser
=
"//a[@href=
\"
/
$lang
/softwares/
$softwareId
\"
]"
;
// software Atom
// rename user
$this
->
commonEditeUserAccount
(
$I
,
$newName
);
// declare user of
$I
->
click
(
'//*[@id="softwaresPage"]'
);
// button 'Logiciels'
$I
->
click
(
$softwareToAddAsUser
);
$I
->
seeInCurrentUrl
(
"/
$lang
/softwares/
$softwareId
"
);
$I
->
dontSee
(
$oldName
,
[
'css'
=>
'ol li'
]);
$I
->
dontSee
(
$newName
,
[
'css'
=>
'ol li'
]);
$I
->
click
(
"//*[@id=
\"
btn_Softwares-usersSoftware-
$softwareId
\"
]"
);
// button : 'Se déclarer utilisateur'
$I
->
seeElement
(
'div.message.success'
);
$I
->
seeInCurrentUrl
(
"/
$lang
/mappingForm/
$softwareId
"
);
// Checks on software page
$I
->
click
(
'//*[@id="softwaresPage"]'
);
// button 'Logiciels'
$I
->
click
(
$softwareToAddAsUser
);
$I
->
seeInCurrentUrl
(
"/
$lang
/softwares/
$softwareId
"
);
$I
->
seeElement
(
"//*[@id=
\"
btn_Softwares-deleteUsersSoftware-
$softwareId
\"
]"
);
$I
->
dontSee
(
$oldName
,
[
'css'
=>
'ol li'
]);
$I
->
see
(
$newName
,
[
'css'
=>
'ol li'
]);
// rename the user and no longer be a user of the software
$this
->
commonEditeUserAccount
(
$I
,
$oldName
);
$I
->
click
(
'//*[@id="softwaresPage"]'
);
// button 'Logiciels'
$I
->
click
(
$softwareToAddAsUser
);
$I
->
seeInCurrentUrl
(
"/
$lang
/softwares/
$softwareId
"
);
$I
->
see
(
$oldName
,
[
'css'
=>
'ol li'
]);
$I
->
dontSee
(
$newName
,
[
'css'
=>
'ol li'
]);
$I
->
click
(
"//*[@id=
\"
btn_Softwares-deleteUsersSoftware-
$softwareId
\"
]"
);
// button : 'ne plus être utilisateur'
$I
->
seeElement
(
'div.message.success'
);
$I
->
dontSee
(
$oldName
,
[
'css'
=>
'ol li'
]);
$I
->
dontSee
(
$newName
,
[
'css'
=>
'ol li'
]);
}
/**
* When trying to modify another user's data (by changing the id in the url),
* verify that we can't even see the form
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment