Skip to content

Commit

Permalink
Merge branch '154-add-barchart' of https://github.com/IT2901-SINTEF01…
Browse files Browse the repository at this point in the history
…/frontend into 154-add-barchart
  • Loading branch information
emilom committed Apr 30, 2021
2 parents 7a1b967 + d1eecbf commit e794122
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion cypress/integration/website.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Dashboard', () => {
},
});
} else if (req.body.query.includes('forecast')) {
req.alias = 'WEATHER_MET_API';
req.alias = 'getData';
req.reply({
data: {
forecast: {
Expand All @@ -23,6 +23,26 @@ describe('Dashboard', () => {
},
},
});
} else if (req.body.query.includes('populationsInNorway')) {
req.alias = 'getData';
req.reply({
data: {
populationsInNorway: {
dataset: {
value: [
{
populationForYear: [
{
population: 69,
year: '1999',
},
],
},
],
},
},
},
});
}
});
});
Expand All @@ -38,6 +58,19 @@ describe('Dashboard', () => {
cy.contains('Legg til i dashboard').click();
cy.get('.dashboardItem').should('be.visible');
});
it('show multiple visualisations on dashboard', () => {
cy.visit('/');
cy.contains('Legg til nytt komponent').click();
cy.wait('@METADATA');
cy.get('.dataResultItems').first().click();
cy.contains('Legg til i dashboard').click();
cy.get('.dashboardItem').should('be.visible');

cy.contains('Legg til nytt komponent').click();
cy.get('.dataResultItems').eq(1).click();
cy.contains('Legg til i dashboard').click();
cy.get('.dashboardItem').should('have.length', '2');
});
it('removes component', () => {
cy.visit('/');
cy.contains('Legg til nytt komponent').click();
Expand All @@ -47,6 +80,26 @@ describe('Dashboard', () => {
cy.get('[data-icon=trash]').click();
cy.get('.dashboardItem').should('not.exist');
});
it('keeps dashboard items after refresh', () => {
cy.visit('/');
cy.contains('Legg til nytt komponent').click();
cy.wait('@METADATA');
cy.get('.dataResultItems').first().click();
cy.contains('Legg til i dashboard').click();

cy.reload();

cy.get('.dashboardItem').should('be.visible');
});
it('filters through components', () => {
cy.visit('/');
cy.contains('Legg til nytt komponent').click();
cy.wait('@METADATA');
cy.get('input[type="text"]').click();
cy.get('#downshift-0-item-0').click();
// This works since we are guaranteed that atleast one of the components do not have a tag
cy.get('.dataResultItems').should('not.have.length', '10');
});
it('goes to 404 if page does not exist', () => {
cy.visit('/emilom');
cy.contains('404').should('be.visible');
Expand Down

0 comments on commit e794122

Please sign in to comment.