refs #5472 test(changePassword): e2e
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-06-05 15:20:07 +02:00
parent 64abf4bf14
commit 5d6eaca6b8
5 changed files with 93 additions and 2 deletions

View File

@ -113,6 +113,10 @@ INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `bcryptPassword`, `password
(1111, 'Missing', 'Missing', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en', NULL),
(1112, 'Trash', 'Trash', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en', NULL);
UPDATE account.`user`
SET passExpired = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR)
WHERE name = 'maintenance';
INSERT INTO `account`.`mailAlias`(`id`, `alias`, `description`, `isPublic`)
VALUES
(1, 'general', 'General mailing list', FALSE),

View File

@ -0,0 +1,80 @@
import getBrowser from '../../helpers/puppeteer';
const $ = {
form: 'vn-out-layout form'
};
fdescribe('ChangePassword path', async() => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
});
afterAll(async() => {
await browser.close();
});
const toExpects = [];
async function saveExpets(message, expectMessage, expectState) {
console.log(message);
if (!message) message = await page.waitForSnackbar();
if (expectState)
toExpects.push({value: await page.getState(), expected: toExpects.length + expectState});
if (expectMessage)
toExpects.push({value: message.text, expected: toExpects.length + expectMessage});
}
function expects() {
for (let toExpect of toExpects)
expect(toExpect.expected).toContain(toExpect.value); // eslint-disable-line
}
const oldPassword = 'nightmare';
const newPassword = 'newPass.1234';
describe('Bad login', async() => {
it('should receive an error when the password is expired', async() => {
// 0 Expired login
await saveExpets(await page.doLogin(
'maintenance',
oldPassword
), 'The password has expired, change it from Salix', 'change-password');
// 1 Bad attempt: incorrect current password
await saveExpets(await page.sendForm($.form, {
oldPassword: newPassword,
newPassword: oldPassword,
repeatPassword: oldPassword
}), 'Invalid current password');
// 2 Bad attempt: password not meet requirements
await saveExpets(await page.sendForm($.form, {
oldPassword: oldPassword,
newPassword: oldPassword,
repeatPassword: oldPassword
}), 'Password does not meet requirements');
// 3 Correct attempt: change password
await saveExpets(await page.sendForm($.form, {
oldPassword: oldPassword,
newPassword: newPassword,
repeatPassword: newPassword
}), 'Password updated!', 'login');
// 4 Bad login, old password
await saveExpets(await page.doLogin(
'maintenance',
oldPassword
), 'The password has expired, change it from Salix');
// 5 Correct login, new password
await saveExpets(await page.doLogin(
'maintenance',
newPassword
), null, 'change-password');
expects();
});
});
});

View File

@ -49,7 +49,11 @@ describe('Claim summary path', () => {
});
it(`should click on the first sale ID making the item descriptor visible`, async() => {
await page.waitToClick(selectors.claimSummary.firstSaleItemId);
const firstItem = selectors.claimSummary.firstSaleItemId;
await page.evaluate(selectors => {
document.querySelector(selectors).scrollIntoView();
}, firstItem);
await page.waitToClick(firstItem, true);
await page.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage);
const visible = await page.isVisible(selectors.claimSummary.itemDescriptorPopover);

View File

@ -2,12 +2,14 @@
<vn-textfield
label="Old password"
ng-model="$ctrl.oldPassword"
vn-name="oldPassword"
type="password"
vn-focus>
</vn-textfield>
<vn-textfield
label="New password"
ng-model="$ctrl.newPassword"
vn-name="newPassword"
type="password"
info="{{'Password requirements' | translate:$ctrl.passRequirements}}"
autocomplete="false">
@ -15,6 +17,7 @@
<vn-textfield
label="Repeat password"
ng-model="$ctrl.repeatPassword"
vn-name="repeatPassword"
type="password"
autocomplete="false">
</vn-textfield>

View File

@ -172,7 +172,7 @@
"Comment added to client": "Comment added to client",
"This ticket is already a refund": "This ticket is already a refund",
"A claim with that sale already exists": "A claim with that sale already exists",
"Pass expired": "The password has expired, change it from Salix",
"Pass expired": "The password has expired, change it from Salix",
"Can't transfer claimed sales": "Can't transfer claimed sales",
"Invalid quantity": "Invalid quantity"
}