automation test: create account positive case.
This commit is contained in:
40
cypress/e2e/accountAdmin/createAccoint.cy.js
Normal file
40
cypress/e2e/accountAdmin/createAccoint.cy.js
Normal file
@@ -0,0 +1,40 @@
|
||||
describe('Create an Account', ()=>{
|
||||
beforeEach(() => {
|
||||
cy.visit('https://REDACTED-HOST/account/account-admin');
|
||||
const username = 'cindy';
|
||||
const password = 'REDACTED-PWD';
|
||||
|
||||
cy.visit('https://REDACTED-HOST/account/account-admin');
|
||||
|
||||
cy.get('input[id="account"]').type(username);
|
||||
cy.get('input[id="password"]').type(password);
|
||||
cy.get('button[type="submit"]').click();
|
||||
});
|
||||
|
||||
it('Create a new account; role is admin; should appear Saved message', () => {
|
||||
cy.contains('button', 'Create New').should('be.visible');
|
||||
cy.contains('button', 'Create New').click();
|
||||
|
||||
const randomNumber = Math.floor(Math.random() * 1001);
|
||||
|
||||
// 將整數轉換為四位數字串,並補零
|
||||
const fourDigitString = randomNumber.toString().padStart(4, '0');
|
||||
|
||||
// 將 'unit-test-' 和生成的四位數字串組合
|
||||
const inputValue = `unit-test-${fourDigitString}`;
|
||||
|
||||
// 在 id 為 input_account_field 的 input 元素內填入值
|
||||
cy.get('#input_account_field').type(inputValue);
|
||||
cy.get('#input_name_field').type(inputValue);
|
||||
cy.get('#input_first_pwd').type('aaaaaa');
|
||||
cy.get('#input_second_pwd').type('aaaaaa');
|
||||
cy.get('.checkbox-and-text').first().find('div').first().click();
|
||||
// 確保 Confirm 按鈕存在並可點擊
|
||||
cy.contains('button', 'Confirm')
|
||||
.should('be.visible')
|
||||
.and('be.enabled')
|
||||
.click();
|
||||
cy.contains('Account added').should('be.visible'); //表示帳號創建成功
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
{{ i18next.t("AcctMgmt.FullName") }}
|
||||
</span>
|
||||
</div>
|
||||
<input class="w-[454px] rounded p-1 border border-[1px] border-[#64748B] flex items-center h-[40px] outline-none"
|
||||
<input id="input_name_field"
|
||||
class="w-[454px] rounded p-1 border border-[1px] border-[#64748B] flex items-center h-[40px] outline-none"
|
||||
v-model="inputName" :readonly="!isEditable" @dblclick="onInputDoubleClick" @focus="onInputNameFocus"
|
||||
/>
|
||||
</div>
|
||||
@@ -53,7 +54,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="w-[454px] rounded border-[1px] border-[#64748B] flex items-center h-[40px] relative">
|
||||
<input class="outline-none p-1 w-[352px]" :type="isPwdEyeOn ? 'text' : 'password'"
|
||||
<input id="input_first_pwd" class="outline-none p-1 w-[352px]" :type="isPwdEyeOn ? 'text' : 'password'"
|
||||
v-model="inputPwd" :readonly="!isEditable" @dblclick="onInputDoubleClick"/>
|
||||
<img v-if="isPwdEyeOn" src='@/assets/icon-eye-open.svg' class="absolute right-[8px] cursor-pointer"
|
||||
@click="togglePwdEyeBtn"/>
|
||||
@@ -76,7 +77,7 @@
|
||||
'border-[#000000]': isPwdMatched,
|
||||
'border-[#FF3366]': !isPwdMatched,
|
||||
}">
|
||||
<input class="outline-none p-1 w-[352px]" :type="isPwdConfirmEyeOn ? 'text' : 'password'"
|
||||
<input id="input_second_pwd" class="outline-none p-1 w-[352px]" :type="isPwdConfirmEyeOn ? 'text' : 'password'"
|
||||
v-model="inputConfirmPwd" :readonly="!isEditable" @dblclick="onInputDoubleClick"
|
||||
:class="{
|
||||
'text-[#000000]': isPwdMatched,
|
||||
|
||||
Reference in New Issue
Block a user