8000 tests analysis: removes duplicates by agnlez · Pull Request #922 · Vizzuality/landgriffon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tests analysis: removes duplicates #922

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

Merged
merged 1 commit into from
Mar 23, 2023
Merged
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
162 changes: 0 additions & 162 deletions client/cypress/e2e/analysis.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,52 +364,6 @@ describe('Analysis table', () => {
});
});

describe('Analysis contextual layers', () => {
beforeEach(() => {
cy.visit('/analysis/map');
});

it('requests should not include the params indicatorId and should be in resolution 4', () => {
cy.wait(['@fetchIndicators', '@fetchContextualLayerCategories']);

cy.get('[data-testid="contextual-layer-modal-toggle"]').click();
cy.get('[data-testid="category-header-Environmental datasets"]').click();
cy.get('[data-testid="layer-settings-item-Agriculture blue water footprint"]')
.find('[data-testid="switch-button"]')
.click();
cy.get('[data-testid="contextual-layer-apply-button"').click();

cy.wait('@fetchContextualLayerH3Data').then((interception) => {
expect(interception.request.url).not.to.contain('indicatorId');
expect(interception.request.url).contain('year');
expect(interception.request.url).contain('resolution=4');
});
});

it('materials requests should not include the params indicatorId and should be in resolution 4', () => {
cy.wait(['@fetchIndicators', '@fetchContextualLayerCategories']);

cy.get('[data-testid="contextual-layer-modal-toggle"]').click();
cy.get('[data-testid="contextual-material-header"]')
.click()
.find('[data-testid="switch-button"]')
.click();
cy.wait(100);
cy.get('[data-testid="contextual-material-content"]')
.find('[data-testid="tree-select-material"]')
.find('input[type="search"]')
.type('Cotton');
cy.get('[data-testid="tree-select-search-results"]').find('button').click();
cy.get('[data-testid="contextual-layer-apply-button"').click();

cy.wait('@fetchMaterialLayerH3Data').then((interception) => {
expect(interception.request.url).not.to.contain('indicatorId');
expect(interception.request.url).contain('year');
expect(interception.request.url).contain('resolution=4');
});
});
});

describe('Analysis charts', () => {
beforeEach(() => {
cy.visit('/analysis/chart');
Expand All @@ -424,18 +378,6 @@ describe('Analysis charts', () => {
});
});

describe('Analysis table', () => {
beforeEach(() => {
cy.visit('/analysis/table');
});

it('should load the table', () => {
cy.wait(['@fetchIndicators', '@fetchImpactTable']).then(() => {
cy.get('[data-testid="analysis-table"]').should('be.visible');
});
});
});

describe('Analysis scenarios', () => {
it('users with "canCreateScenario" permission should be able to click add new scenario button', () => {
cy.intercept('/api/v1/users/me', { fixture: '/profiles/all-permissions.json' }).as('profile');
Expand All @@ -461,108 +403,4 @@ describe('Analysis scenarios', () => {
expect(scenarioIds).to.be.null;
});
});

it('should be able to select a scenario vs actual data in the comparison select', () => {
cy.visit('/analysis/table');
cy.wait('@scenariosNoPaginated');

cy.intercept(
'GET',
'/api/v1/**/trees?withSourcingLocations=true&scenarioIds[]=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7',
).as('treesSelectorsWithScenarioId');

cy.get('[data-testid="scenario-item-null"]') // actual data
.find('[data-testid="select-comparison"]')
.click()
.find('input:visible')
.focus()
.type('Test{enter}');

cy.url().should('contain', 'compareScenarioId=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7');

// checking comparison cell is there
cy.wait('@scenarioVsActual')
.its('request.url')
.should('contain', 'comparedScenarioId=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7');
cy.get('[data-testid="comparison-cell"]').should('have.length.above', 1);

// checking tree selectors on more filers
cy.wait('@treesSelectorsWithScenarioId')
.its('request.url')
.should('contain', 'scenarioIds[]=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7');
});

it('should be able to select a scenario vs scenario in the comparison select', () => {
cy.intercept(
'GET',
'/api/v1/impact/table?*scenarioId=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7*',
).as('fetchImpactTableData');

// ? locations filtered by comparison of a scenario
cy.intercept({
path: '/api/v1/sourcing-locations/location-types?sort=DESC&scenarioIds[]=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7',
}).as('locationTypesWithSingleScenario');

// ? locations filtered by comparison of two scenarios
cy.intercept({
path: '/api/v1/sourcing-locations/location-types?sort=DESC&scenarioIds[]=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7&scenarioIds[]=7646039e-b2e0-4bd5-90fd-925e5868f9af',
}).as('locationTypesWithScenarioComparison');

cy.visit('/analysis/table');
cy.wait('@scenariosNoPaginated');
cy.wait('@scenariosList');

cy.get('[data-testid="scenario-item-8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7"]')
.find('[data-testid="scenario-item-radio"]')
.click();

cy.wait('@fetchImpactTableData')
.its('request.url')
.should('contain', 'scenarioId=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7');

cy.url().should('contain', 'scenarioId=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7');

cy.intercept({
path: '/api/v1/**/trees?*scenarioIds[]=7646039e-b2e0-4bd5-90fd-925e5868f9af',
}).as('treesSelectorsWithBothScenarioIds');

cy.get('[data-testid="scenario-item-8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7"]')
.find('[data-testid="select-comparison"]')
.click()
.find('input:visible')
.focus()
.type('Example{enter}');

cy.wait('@locationTypesWithSingleScenario').its('response.statusCode').should('eq', 200);

cy.url().should('contain', 'compareScenarioId=7646039e-b2e0-4bd5-90fd-925e5868f9af');

// checking tree selectors on more filers
cy.wait('@treesSelectorsWithBothScenarioIds')
.its('request.url')
.should('contain', 'scenarioIds[]=8dfd0ce0-67b7-4f1d-be9c-41bc3ceafde7')
.and('contain', 'scenarioIds[]=7646039e-b2e0-4bd5-90fd-925e5868f9af');

cy.wait('@locationTypesWithScenarioComparison').its('response.statusCode').should('eq', 200);

// checking comparison cell is there
cy.wait('@scenarioVsScenario')
.its('request.url')
.should('contain', 'comparedScenarioId=7646039e-b2e0-4bd5-90fd-925e5868f9af');
cy.get('[data-testid="comparison-cell"]').should('have.length.above', 1);
});
});

describe('Analysis charts', () => {
beforeEach(() => {
cy.visit('/analysis/chart');
});

it('should load one chart per indicator', () => {
cy.wait(['@fetchIndicators', '@fetchChartRanking']).then(() => {
cy.get('[data-testid="analysis-chart"]').as('chart');
cy.get('@chart').should('be.visible');
cy.get('@chart').find('.recharts-responsive-container').and('have.length', 5);
});
});
});
0