refs #5472 test(changePassword): e2e
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
64abf4bf14
commit
5d6eaca6b8
|
@ -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),
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue