Skip to content

Commit

Permalink
#3101: fixed ability to sort by error column and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed Jan 21, 2025
1 parent 1f894aa commit 76e0970
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dashboard/src/components/projects/ProjectErrors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const isFlex = computed(() => responsive.md.value)
v-model:sort-field="sortBy"
v-model:sort-order="sortOrder"
:rowsPerPageOptions="possiblePageSizes">
<Column header="Error" field="typeAndError" sortable :class="{'flex': isFlex }">
<Column header="Error" field="errorType" sortable :class="{'flex': isFlex }">
<template #body="slotProps">
<div class="pl-3">
<div class="mb-2">
Expand Down
67 changes: 67 additions & 0 deletions e2e-tests/cypress/e2e/project_errors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,73 @@ describe('Project Errors Tests', () => {
.contains('2');
});

it('ability to sort by each column', () => {
cy.intercept('GET', '/admin/projects/proj1/errors**').as('getErrors');

cy.reportSkill(1, 42, '[email protected]', '2021-02-24 10:00', false);
cy.wait(1000)
cy.reportSkill(1, 75, '[email protected]', '2021-02-24 10:00', false);
cy.reportSkill(1, 75, '[email protected]', '2021-02-24 10:00', false);
cy.wait(1000)
cy.reportSkill(1, 13, '[email protected]', '2021-02-24 10:00', false);
cy.reportSkill(1, 13, '[email protected]', '2021-02-24 10:00', false);
cy.reportSkill(1, 13, '[email protected]', '2021-02-24 10:00', false);
cy.wait(1000)

cy.visit('/administrator/projects/proj1/issues')

const tableSelector = '[data-cy="projectErrorsTable"]';

// last seen is the default
cy.get(`${tableSelector} [data-cy="skillsBTableTotalRows"]`).should('have.text', '3')
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill13]'}],
[{colIndex: 0, value: '[skill75]'}],
[{colIndex: 0, value: '[skill42]'}],
]);
cy.get(`${tableSelector} th`).contains('Last Seen').click();
cy.wait('@getErrors');
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill42]'}],
[{colIndex: 0, value: '[skill75]'}],
[{colIndex: 0, value: '[skill13]'}],
]);

// just make sure it doesn't fail when sorting by error
cy.get(`${tableSelector} th`).contains('Error').click();
cy.wait('@getErrors');

cy.get(`${tableSelector} th`).contains('First Seen').click();
cy.wait('@getErrors');
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill42]'}],
[{colIndex: 0, value: '[skill75]'}],
[{colIndex: 0, value: '[skill13]'}],
]);
cy.get(`${tableSelector} th`).contains('First Seen').click();
cy.wait('@getErrors');
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill13]'}],
[{colIndex: 0, value: '[skill75]'}],
[{colIndex: 0, value: '[skill42]'}],
]);

cy.get(`${tableSelector} th`).contains('Times Seen').click();
cy.wait('@getErrors');
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill42]'}, {colIndex: 3, value: '1'}],
[{colIndex: 0, value: '[skill75]'}, {colIndex: 3, value: '2'}],
[{colIndex: 0, value: '[skill13]'}, {colIndex: 3, value: '3'}],
]);
cy.get(`${tableSelector} th`).contains('Times Seen').click();
cy.wait('@getErrors');
cy.validateTable(tableSelector, [
[{colIndex: 0, value: '[skill13]'}, {colIndex: 3, value: '3'}],
[{colIndex: 0, value: '[skill75]'}, {colIndex: 3, value: '2'}],
[{colIndex: 0, value: '[skill42]'}, {colIndex: 3, value: '1'}],
]);
});

it('issues count on administrator home page is correct', () => {
cy.intercept('GET', '/admin/projects')
.as('getProjects');
Expand Down

0 comments on commit 76e0970

Please sign in to comment.