Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to filter time of Interface Datastream data #448

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- For server-owned interfaces, display a form to send data to the device, ([#417](https://github.com/astarte-platform/astarte-dashboard/issues/417)).
- Add a "keep me logged in" during login, ([#451](https://github.com/astarte-platform/astarte-dashboard/issues/451)).
- Allow unsetting property endpoints, ([#450](https://github.com/astarte-platform/astarte-dashboard/issues/450)).
- Allow to filter time of Interface DataStream data, ([#441](https://github.com/astarte-platform/astarte-dashboard/issues/441)).
### Fixed
- Avoid querying Astarte for trigger delivery policies when Astarte does not support them ([#459](https://github.com/astarte-platform/astarte-dashboard/issues/459)).

Expand Down
43 changes: 25 additions & 18 deletions cypress/e2e/interface_value_page.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe('Interface values page tests', () => {
});

it('correctly loads the page', () => {
cy.visit('/devices/deviceId/interfaces/interfaceName');
cy.location('pathname').should('eq', '/devices/deviceId/interfaces/interfaceName');
cy.visit('/devices/deviceId/interfaces/interfaceName/interfaceMajor');
cy.location('pathname').should('eq', '/devices/deviceId/interfaces/interfaceName/interfaceMajor');
cy.get('.main-content').within(() => {
cy.get('h2').contains('Interface Data');
cy.get('.card-header').contains('deviceId /interfaceName');
Expand All @@ -31,8 +31,9 @@ describe('Interface values page tests', () => {

const deviceId = '0ma4SioESHKk28VhYGcW1w';
const interfaceName = 'test.astarte.IndividualObjectInterface';
const interfaceMajor = 0;

cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('[aria-label="Back"]').click();
cy.location('pathname').should('eq', `/devices/${deviceId}/edit`);
});
Expand All @@ -47,17 +48,18 @@ describe('Interface values page tests', () => {
.then((device) => {
const interfaceName = iface.data.interface_name;
const deviceId = device.data.id;
const interfaceMajor = iface.data.interfaceMajor;
cy.intercept('GET', `/appengine/v1/*/devices/${deviceId}`, device);
cy.intercept(
'GET',
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}`,
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`,
{ fixture: 'test_aggregated_object_interface_values' },
);
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/*`, {
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/${interfaceMajor}/*`, {
statusCode: 418,
body: '',
});
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content .card-body').contains("Couldn't load interface data");
});
});
Expand All @@ -73,17 +75,18 @@ describe('Interface values page tests', () => {
.then((device) => {
const interfaceName = iface.data.interface_name;
const deviceId = device.data.id;
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/*`, iface);
const interfaceMajor = iface.data.interfaceMajor;
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/${interfaceMajor}/*`, iface);
cy.intercept(
'GET',
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}`,
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`,
{ fixture: 'test_aggregated_object_interface_values' },
);
cy.intercept('GET', `/appengine/v1/*/devices/${deviceId}`, {
statusCode: 418,
body: '',
});
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content .card-body').contains("Couldn't load interface data");
});
});
Expand All @@ -99,17 +102,18 @@ describe('Interface values page tests', () => {
.then((device) => {
const interfaceName = iface.data.interface_name;
const deviceId = device.data.id;
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/*`, iface);
const interfaceMajor = iface.data.interfaceMajor;
cy.intercept('GET', `/realmmanagement/v1/*/interfaces/${interfaceName}/${interfaceMajor}/*`, iface);
cy.intercept('GET', `/appengine/v1/*/devices/${deviceId}`, device);
cy.intercept(
'GET',
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}`,
`/appengine/v1/*/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`,
{
statusCode: 418,
body: '',
},
);
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content .card-body').contains("Couldn't load interface data");
});
});
Expand All @@ -132,8 +136,9 @@ describe('Interface values page tests', () => {
it('shows correct aggregated datastream data', function () {
const deviceId = this.device.data.id;
const interfaceName = this.interface.data.interface_name;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}`);
const interfaceMajor = this.interface.data.interfaceMajor;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content').within(() => {
cy.get('.card-header').contains(`${deviceId} /${interfaceName}`);
Object.keys(this.interface_data.data.sensors).forEach((sensorId) => {
Expand Down Expand Up @@ -172,8 +177,9 @@ describe('Interface values page tests', () => {
it('shows correct individual datastream data', function () {
const deviceId = this.device.data.id;
const interfaceName = this.interface.data.interface_name;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}`);
const interfaceMajor = this.interface.data.interfaceMajor;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content').within(() => {
cy.get('.card-header').contains(`${deviceId} /${interfaceName}`);
cy.get('.card-body table').within(() => {
Expand Down Expand Up @@ -204,8 +210,9 @@ describe('Interface values page tests', () => {
it('shows correct properties data', function () {
const deviceId = this.device.data.id;
const interfaceName = this.interface.data.interface_name;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}`);
const interfaceMajor = this.interface.data.interfaceMajor;
cy.visit(`/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.location('pathname').should('eq', `/devices/${deviceId}/interfaces/${interfaceName}/${interfaceMajor}`);
cy.get('.main-content').within(() => {
cy.get('.card-header').contains(`${deviceId} /${interfaceName}`);
Object.keys(this.interface_data.data).forEach((key) => {
Expand Down
Loading
Loading