Skip to content
Snippets Groups Projects
Commit 12c568c6 authored by heikkkk's avatar heikkkk
Browse files

test: add e2e tests for profile settings

parent 33d28769
No related branches found
No related tags found
1 merge request!70Test/e2e
......@@ -6,9 +6,19 @@ describe('SettingsProfile Test', () => {
cy.get('form').submit();
cy.wait(1000);
cy.visit('/settings/profile')
cy.wait(1000)
});
it('Does the before', () => {
it('updates first and last name', () => {
cy.get('[data-cy="first-name"]').find('[data-cy="bi-input"]').should('have.value','User')
cy.get('[data-cy="last-name"]').find('[data-cy="bi-input"]').should( 'have.value','User')
cy.get('[data-cy="first-name"]').find('[data-cy="bi-input"]').clear().type('NewFirstName')
cy.get('[data-cy="last-name"]').find('[data-cy="bi-input"]').clear().type('NewLastName')
cy.get('[data-cy="profile-submit-btn"]').click()
cy.get('[data-cy="menu"]').get('[data-cy="user"]').should('include.text', 'NewFirstName')
//update the user back to its original state
cy.get('[data-cy="first-name"]').find('[data-cy="bi-input"]').clear().type('User')
cy.get('[data-cy="last-name"]').find('[data-cy="bi-input"]').clear().type('User')
cy.get('[data-cy="profile-submit-btn"]').click()
})
})
\ No newline at end of file
......@@ -51,7 +51,7 @@ const onInputEvent = (event: any) => {
<template>
<div>
<label :for="inputId">{{ label }}</label>
<label :for="inputId" data-cy="bi-label">{{ label }}</label>
<input :value="modelValue"
@input="onInputEvent"
:type="type"
......@@ -61,9 +61,10 @@ const onInputEvent = (event: any) => {
:min="min"
:pattern="pattern"
:required="required"
data-cy="bi-input"
/>
<div class="valid-feedback">{{ validMessage }}</div>
<div class="invalid-feedback" id="invalid">{{ invalidMessage }}</div>
<div data-cy="bi-valid-msg" class="valid-feedback">{{ validMessage }}</div>
<div data-cy="bi-invalid-msg" class="invalid-feedback" id="invalid">{{ invalidMessage }}</div>
</div>
</template>
......
......@@ -129,7 +129,8 @@ onMounted(() => {
invalid-message="Vennligst skriv inn ditt etternavn" />
</div>
<br>
<button type="submit" class="btn btn-primary">Oppdater profil</button>
<button data-cy="profile-submit-btn" type="submit" class="btn btn-primary">Oppdater
profil</button>
</form>
</div>
</template>
......
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