Skip to content
Snippets Groups Projects
Commit 74c067dd authored by heikkkk's avatar heikkkk
Browse files

test: add e2e test for updating email

parent 499818ef
No related branches found
No related tags found
1 merge request!70Test/e2e
describe('SettingsAccount Test', () => {
beforeEach(() => {
cy.visit('/login');
cy.get('#emailInput input').type('user@example.com');
cy.get('#passwordInput input').type('John1');
cy.get('form').submit();
cy.wait(1000);
cy.visit('/settings/account')
cy.wait(1000)
});
it('update email of user', () => {
cy.get('[data-cy="email-input"]').find('[data-cy="bi-input"]')
.should('have.value','user@example.com')
cy.get('[data-cy="email-input"]').find('[data-cy="bi-input"]').clear()
cy.get('[data-cy="email-input"]').find('[data-cy="bi-input"]').type('NewEmailforUser@NewExample.com')
cy.get('[data-cy="change-email-btn"]').click()
cy.wait(1000)
cy.get('[data-cy="change-email-msg-confirm"]').should('include.text', 'Email updated successfully!')
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-testid="logout"]').click();
cy.get('#emailInput input').type('NewEmailforUser@NewExample.com');
cy.get('#passwordInput input').type('John1');
cy.get('form').submit();
cy.wait(1000);
cy.visit('/settings/account')
cy.wait(1000)
cy.get('[data-cy="email-input"]').find('[data-cy="bi-input"]').clear()
cy.get('[data-cy="email-input"]').find('[data-cy="bi-input"]').type('user@example.com')
cy.get('[data-cy="change-email-btn"]').click()
})
})
\ No newline at end of file
......@@ -55,14 +55,16 @@ onMounted(() => {
<hr>
<form @submit.prevent="handleSubmit">
<div class="form-group">
<BaseInput :model-value="emailRef" @input-change-event="handleEmailInputEvent" id="emailInput-change"
<BaseInput data-cy="email-input" :model-value="emailRef"
@input-change-event="handleEmailInputEvent" id="emailInput-change"
input-id="email-new" type="email" label="E-post" placeholder="Skriv inn din e-post"
invalid-message="Ugyldig e-post"/>
</div>
<p class="text-danger">{{ errorMsg }}</p>
<p class="text-success">{{ confirmationMsg }}</p>
<p data-cy="change-email-msg-error" class="text-danger">{{ errorMsg }}</p>
<p data-cy="change-email-msg-confirm" class="text-success">{{ confirmationMsg }}</p>
<br>
<button type="submit" class="btn btn-primary">Endre Informasjon</button>
<button data-cy="change-email-btn" type="submit" class="btn btn-primary">Endre
Informasjon</button>
<hr>
<div class="form-group">
<label class="d-block text-danger">Slett Bruker</label>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment