regression error with wolist after update, added regression test (and testability change to datatable refresh button) before fixing

This commit is contained in:
2021-12-16 18:11:54 +00:00
parent 2498639867
commit 6d81364178
2 changed files with 85 additions and 26 deletions

View File

@@ -63,29 +63,29 @@ function confirmJobDone(jobId, authToken) {
}
before(() => {
cy.request({
url: `${Cypress.env("apiBaseUrl")}auth`,
method: "POST",
body: {
login: Cypress.env("adminusername"),
password: Cypress.env("adminpassword")
}
})
.its("body")
.then((res) => {
cy.request({
method: "POST",
url: `${Cypress.env("apiBaseUrl")}trial/seed/small/-7/true`,
auth: {
bearer: res.data.token
}
})
.its("body")
.then((resjob) => {
cy.log(`resjob is: ${resjob}`);
// expect(resjob.body).to.have.property('jobId');
confirmJobDone(resjob.jobId, res.data.token);
});
});
});
// before(() => {
// cy.request({
// url: `${Cypress.env("apiBaseUrl")}auth`,
// method: "POST",
// body: {
// login: Cypress.env("adminusername"),
// password: Cypress.env("adminpassword")
// }
// })
// .its("body")
// .then((res) => {
// cy.request({
// method: "POST",
// url: `${Cypress.env("apiBaseUrl")}trial/seed/small/-7/true`,
// auth: {
// bearer: res.data.token
// }
// })
// .its("body")
// .then((resjob) => {
// cy.log(`resjob is: ${resjob}`);
// // expect(resjob.body).to.have.property('jobId');
// confirmJobDone(resjob.jobId, res.data.token);
// });
// });
// });

View File

@@ -0,0 +1,59 @@
/// <reference types="cypress" />
/*
pre-beta release updated all backend server modules and now get an error "Internal server error" viewing the wolist
server log:
2021-12-16 09:33:44.5982|INFO|AyaNova.Api.Controllers.AuthController|User "AyaNova SuperUser" logged in from "::ffff:127.0.0.1" ok
2021-12-16 09:33:49.0623|ERROR|AyaNova.Api.Controllers.DataListController|DataListFetcher:GetResponseAsync unexpected failure. Data Query was:
2021-12-16 09:33:49.0623|ERROR|AyaNova.Api.Controllers.DataListController|SELECT viewworkorder.serial, viewworkorder.id, acustomer.name, acustomer.id, viewworkorder.servicedate, viewworkorder.completebydate, aworkorderstatus.name, viewworkorder.laststatusid, aworkorderstatus.color, aproject.name, aproject.id, expwoage from viewworkorder left join aworkorderstatus on (viewworkorder.laststatusid = aworkorderstatus.id) left join acustomer on (viewworkorder.customerid=acustomer.id) left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join aproject on (viewworkorder.projectid=aproject.id) left join acontract on (viewworkorder.contractid=acontract.id)left join apm on (viewworkorder.frompmid=apm.id)left join aquote on (viewworkorder.fromquoteid=aquote.id) ORDER BY viewworkorder.serial DESC LIMIT 10 OFFSET 0
2021-12-16 09:33:49.0623|ERROR|AyaNova.Api.Controllers.DataListController|Count Query was:
2021-12-16 09:33:49.0623|ERROR|AyaNova.Api.Controllers.DataListController|SELECT COUNT(*) from viewworkorder left join aworkorderstatus on (viewworkorder.laststatusid = aworkorderstatus.id) left join acustomer on (viewworkorder.customerid=acustomer.id) left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join aproject on (viewworkorder.projectid=aproject.id) left join acontract on (viewworkorder.contractid=acontract.id)left join apm on (viewworkorder.frompmid=apm.id)left join aquote on (viewworkorder.fromquoteid=aquote.id)
2021-12-16 09:33:49.0623|ERROR|AyaNova.Api.Controllers.DataListController|Exception=>System.InvalidCastException: Cannot convert interval value with non-zero months to TimeSpan
at NpgsqlTypes.NpgsqlTimeSpan.ToTimeSpan(NpgsqlTimeSpan& interval)
at Npgsql.Internal.TypeHandlers.DateTimeHandlers.IntervalHandler.Read(NpgsqlReadBuffer buf, Int32 len, FieldDescription fieldDescription)
at Npgsql.Internal.TypeHandling.NpgsqlTypeHandler.Read[TAny](NpgsqlReadBuffer buf, Int32 len, Boolean async, FieldDescription fieldDescription)
at Npgsql.Internal.TypeHandling.NpgsqlTypeHandler`1.ReadAsObject(NpgsqlReadBuffer buf, Int32 len, Boolean async, FieldDescription fieldDescription)
at Npgsql.NpgsqlDataReader.GetValue(Int32 ordinal)
at AyaNova.DataList.DataListFetcher.GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, Int64 userId) in C:\data\code\raven\server\AyaNova\DataList\DataListFetcher.cs:line 125
2021-12-16 09:33:49.1374|ERROR|SERVER|Error=>System.Exception: DataListFetcher:GetResponseAsync - unexpected failure see log
at AyaNova.DataList.DataListFetcher.GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, Int64 userId) in C:\data\code\raven\server\AyaNova\DataList\DataListFetcher.cs:line 201
at AyaNova.Api.Controllers.DataListController.List(DataListTableRequest tableRequest) in C:\data\code\raven\server\AyaNova\Controllers\DataListController.cs:line 106
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Test should check for this issue
*/
describe("When work order data table listed", () => {
it("should not show an error", () => {
cy.visit("/login");
cy.get("input[name=username]").clear().type(Cypress.env("serviceuser"));
// {enter} causes the form to submit
cy.get("input[name=password]")
.clear()
.type(`${Cypress.env("servicepassword")}{enter}`);
cy.url().should("include", "/ay-evaluate");
//WORKORDER
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=service]").click(); //only if not setting project above
cy.get("[data-cy='nav/svc-workorders']").click();
cy.url().should("include", "/svc-workorders");
cy.get("[data-cy=workordersTable]");
//wait for load, once it's done refresh button will appear and can then check for errors etc
cy.get("[data-cy=refresh]").should('exist');
cy.get("[data-cy=generalerror]").should('not.exist');
cy.contains('Internal server error', { matchCase: false }).should('not.exist')
//END OF TEST
//-----------------------------------------------------
});
});