Skip to content

Commit

Permalink
#208 not amused
Browse files Browse the repository at this point in the history
  • Loading branch information
wouter-adriaens committed Feb 7, 2024
1 parent 7ea11a2 commit 8399c6a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
43 changes: 35 additions & 8 deletions src/__tests__/OeAdres.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ describe('Adres', () => {

describe('form - default', () => {
beforeEach(() => {
cy.intercept({ method: 'GET', url: 'https://test-geo.onroerenderfgoed.be/adressenregister/landen' }).as(
'dataGetLanden'
);
mount(TestComponent);
cy.wait('@dataGetLanden');
});

it('has an input label land', () => {
Expand Down Expand Up @@ -629,32 +633,54 @@ const fillInOeAdresBelgium = () => {
// Country selection
getMultiSelect('land').select(1).find(':selected').should('have.text', 'België');

cy.intercept({ method: 'GET', url: 'https://test-geo.onroerenderfgoed.be/**' }).as('dataGet');
cy.wait('@dataGet');
cy.intercept({
method: 'GET',
url: 'https://test-geo.onroerenderfgoed.be/adressenregister/gewesten/**/gemeenten',
}).as('dataGetGemeenten');

cy.intercept({
method: 'GET',
url: 'https://test-geo.onroerenderfgoed.be/adressenregister/gemeenten/**/postinfo',
}).as('dataGetPostinfo');

cy.intercept({
method: 'GET',
url: 'https://test-geo.onroerenderfgoed.be/adressenregister/gemeenten/**/straten',
}).as('dataGetStraten');

cy.intercept({
method: 'GET',
url: 'https://test-geo.onroerenderfgoed.be/adressenregister/straten/**/adressen',
}).as('dataGetAdressen');

cy.intercept({
method: 'GET',
url: 'https://test-geo.onroerenderfgoed.be/adressenregister/straten/**/huisnummers/416',
}).as('dataGetHuisnummer');

// Gemeente selection
cy.wait('@dataGetGemeenten');
setMultiSelectValue('gemeente', 'Bertem');
getMultiSelect('gemeente').find('.multiselect__single').should('have.text', 'Bertem');

// Postcode selection
cy.wait('@dataGetPostinfo');

setMultiSelectValue('postcode', '3060');
getMultiSelect('postcode').find('.multiselect__single').should('have.text', '3060');

cy.wait('@dataGet');

// Straat selection
cy.wait('@dataGetStraten');
setMultiSelectValue('straat', 'Dorpstraat');
getMultiSelect('straat').find('.multiselect__single').should('have.text', 'Dorpstraat');

cy.wait('@dataGet');

// Huisnummer with multiple busnummers
cy.wait('@dataGetAdressen');
setAutocompleteValue('huisnummer', '416');
getAutocompleteInput('huisnummer').should('have.value', '416');

cy.wait('@dataGet');

// Busnummer selection
cy.wait('@dataGetHuisnummer');
setAutocompleteValue('busnummer', '010');
getAutocompleteInput('busnummer').should('have.value', '0101');
};
Expand All @@ -680,4 +706,5 @@ const setMultiSelectValue = (field: string, value: string) => {
const setAutocompleteValue = (field: string, value: string) => {
getAutocompleteInput(field).click();
getAutocompleteInput(field).type(value);
cy.wait(2000);
};
2 changes: 1 addition & 1 deletion src/components/smart/OeAdres.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="oe-adres">
<VlProperties>
<VlPropertiesTitle v-if="!hideTitle" data-cy="title-adres">Adres</VlPropertiesTitle>
<VlPropertiesTitle v-if="!props.hideTitle" data-cy="title-adres">Adres</VlPropertiesTitle>
<VlPropertiesList>
<!-- Land -->
<template v-if="!props.countryId">
Expand Down

0 comments on commit 8399c6a

Please sign in to comment.