diff --git a/src/pages/Account/AddressDetails.vue b/src/pages/Account/AddressDetails.vue
index 171c5b5f..e0707310 100644
--- a/src/pages/Account/AddressDetails.vue
+++ b/src/pages/Account/AddressDetails.vue
@@ -90,24 +90,39 @@ onMounted(() => getCountries());
@on-data-saved="goBack()"
>
-
-
-
+
+
+
diff --git a/src/pages/Account/AddressList.vue b/src/pages/Account/AddressList.vue
index ebfadb67..47c2b7dc 100644
--- a/src/pages/Account/AddressList.vue
+++ b/src/pages/Account/AddressList.vue
@@ -98,6 +98,7 @@ onMounted(async () => {
@click="goToAddressDetails()"
rounded
no-caps
+ data-testid="newAddressBtn"
>
{{ t('addAddress') }}
@@ -109,6 +110,7 @@ onMounted(async () => {
class="rounded-borders shadow-1 shadow-transition"
separator
:rows="addresses"
+ data-testid="addressCardList"
>
{
flat
rounded
@click.stop="goToAddressDetails(address.id)"
+ data-testid="editAddressBtn"
>
{{ t('editAddress') }}
diff --git a/src/test/cypress/integration/config/AddresList.spec.js b/src/test/cypress/integration/config/AddresList.spec.js
new file mode 100644
index 00000000..267b3d3e
--- /dev/null
+++ b/src/test/cypress/integration/config/AddresList.spec.js
@@ -0,0 +1,75 @@
+describe('PendingOrders', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.visit('/#/account/address-list');
+ });
+
+ const getRandomAddressFormData = () => {
+ const randomString = () => Math.random().toString(36).substring(2, 15);
+ return {
+ nickname: `Nickname-${randomString()}`,
+ street: `Street-${randomString()}`,
+ city: `City-${randomString()}`,
+ postcode: Math.floor(Math.random() * 90000) + 10000
+ };
+ };
+
+ const fillFormWithData = data => {
+ cy.dataCy('addressFormNickname').find('input').click();
+ cy.dataCy('addressFormNickname').find('input').type(data.nickname);
+ cy.dataCy('addressFormStreet').find('input').click();
+ cy.dataCy('addressFormStreet').find('input').type(data.street);
+ cy.dataCy('addressFormCity').find('input').click();
+ cy.dataCy('addressFormCity').find('input').type(data.city);
+ cy.dataCy('addressFormPostcode').find('input').click();
+ cy.dataCy('addressFormPostcode').find('input').type(data.postcode);
+ cy.selectOption('[data-testid="addressFormCountry"]', 'EspaƱa');
+ cy.selectOption('[data-testid="addressFormProvince"]', 'Province one');
+ };
+
+ const verifyAddressCardData = data => {
+ cy.dataCy('addressCardList')
+ .children()
+ .last()
+ .should('contain', data.nickname);
+ cy.dataCy('addressCardList')
+ .children()
+ .last()
+ .should('contain', data.street);
+ cy.dataCy('addressCardList')
+ .children()
+ .last()
+ .should('contain', data.city);
+ cy.dataCy('addressCardList')
+ .children()
+ .last()
+ .should('contain', data.postcode);
+ };
+
+ it('should create a new address', () => {
+ cy.dataCy('newAddressBtn').should('exist');
+ cy.dataCy('newAddressBtn').click();
+ cy.dataCy('formDefaultSaveButton').should('exist');
+ cy.dataCy('formDefaultSaveButton').should('be.disabled');
+ const addressFormData = getRandomAddressFormData();
+ fillFormWithData(addressFormData);
+ cy.dataCy('formDefaultSaveButton').should('not.be.disabled');
+ cy.dataCy('formDefaultSaveButton').click();
+ cy.checkNotify('positive', 'Datos guardados');
+ verifyAddressCardData(addressFormData);
+ });
+
+ it('should edit an existent address', () => {
+ cy.dataCy('addressCardList')
+ .children()
+ .last()
+ .find('[data-testid="editAddressBtn"]')
+ .click();
+ const addressFormData = getRandomAddressFormData();
+ fillFormWithData(addressFormData);
+ cy.dataCy('formDefaultSaveButton').should('not.be.disabled');
+ cy.dataCy('formDefaultSaveButton').click();
+ cy.checkNotify('positive', 'Datos guardados');
+ verifyAddressCardData(addressFormData);
+ });
+});