Skip to content

Commit c337b62

Browse files
Merge pull request #11 from microting/master
Master changes
2 parents 046e1f4 + acb624e commit c337b62

32 files changed

+490
-517
lines changed

eFormAPI/eFormAPI.Web.Integration.Tests/eFormAPI.Web.Integration.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1111
<PackageReference Include="NUnit" Version="4.4.0" />
12-
<PackageReference Include="NUnit.Analyzers" Version="4.11.1">
12+
<PackageReference Include="NUnit.Analyzers" Version="4.11.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>

eFormAPI/eFormAPI.Web.Tests/eFormAPI.Web.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1111
<PackageReference Include="NUnit" Version="4.4.0" />
12-
<PackageReference Include="NUnit.Analyzers" Version="4.11.1">
12+
<PackageReference Include="NUnit.Analyzers" Version="4.11.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>

eFormAPI/eFormAPI.Web/Services/CasesService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ public async Task<OperationDataResult<LatestCaseActivity>> GetLatestActivity()
376376
{
377377
var latestActivity = await sdkDbContext.Cases
378378
.Where(x => x.WorkflowState != Constants.WorkflowStates.Removed)
379+
.Where(x => x.Status == 100)
379380
.OrderByDescending(x => x.UpdatedAt)
380381
.Select(x => new { x.Id, x.UpdatedAt, x.CheckListId })
381382
.FirstOrDefaultAsync();

eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.10" />
5656
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.10" />
5757
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
58-
<PackageReference Include="Microting.eForm" Version="9.0.69" />
59-
<PackageReference Include="Microting.EformAngularFrontendBase" Version="9.0.57" />
60-
<PackageReference Include="Microting.eFormApi.BasePn" Version="9.0.61" />
58+
<PackageReference Include="Microting.eForm" Version="9.0.70" />
59+
<PackageReference Include="Microting.EformAngularFrontendBase" Version="9.0.58" />
60+
<PackageReference Include="Microting.eFormApi.BasePn" Version="9.0.62" />
6161
<PackageReference Include="PureOtp" Version="1.0.0.1" />
6262
<PackageReference Include="Sentry" Version="5.16.2" />
6363
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />

eform-client/angular.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
],
2828
"tsConfig": "src/tsconfig.app.json",
2929
"allowedCommonJsDependencies": [
30-
"dragula",
3130
"file-saver"
3231
],
3332
"assets": [

eform-client/cypress/e2e/MyEforms.page.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,20 @@ class MyEformsPage extends PageWithNavbarPage {
159159

160160
public clearEFormTable() {
161161
cy.wait(500);
162-
const rowCount = this.rowNum();
163-
let indexForDelete = 1;
164-
for (let i = 1; i <= rowCount; i++) {
165-
const eformsRowObject = this.getEformRowObj(i, false);
166-
if (
167-
eformsRowObject &&
168-
eformsRowObject.deleteBtn &&
169-
(eformsRowObject.deleteBtn.should('be.visible'))
170-
) {
171-
eformsRowObject.deleteEForm();
172-
} else {
173-
indexForDelete += 1;
162+
// Check if table has any rows before trying to delete
163+
cy.get('body').then($body => {
164+
if ($body.find('.eform-id').length > 0) {
165+
// Table has rows, delete them
166+
cy.get('.eform-id').its('length').then((rowCount) => {
167+
for (let i = 1; i <= rowCount; i++) {
168+
cy.get('#delete-eform-btn-0').click();
169+
cy.intercept('DELETE' , '**/api/templates/delete/*').as('deleteEform');
170+
cy.get('#eFormDeleteDeleteBtn').should('be.visible').click();
171+
cy.wait('@deleteEform', {timeout: 50000});
172+
}
173+
});
174174
}
175-
}
175+
});
176176
}
177177

178178
createNewEform(
@@ -293,7 +293,7 @@ class MyEformsRowObject {
293293

294294
getRow(rowNum) {
295295
const currentPosition = rowNum - 1;
296-
this.element = cy.get('#mainPageEFormsTableBody tr.mat-row').eq(currentPosition);
296+
this.element = cy.get('#mainPageEFormsTableBody tbody tr').eq(currentPosition);
297297
cy.get(`#eform-id-${currentPosition}`)
298298
.eq(0)
299299
.invoke('text')

eform-client/cypress/e2e/Navbar.page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ export class Navbar {
195195
}
196196

197197
public goToMyEForms() {
198+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
199+
cy.intercept('GET', '**/api/tags/index').as('getTags');
198200
this.myEformsBtn().click();
201+
cy.wait('@getTemplates', { timeout: 60000 });
202+
cy.wait('@getTags', { timeout: 60000 });
199203
// Note: Tests should intercept appropriate API calls after navigation
200204
}
201205

eform-client/cypress/e2e/d/device-users.add.spec.cy.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ describe('Device users page - Should not add new device user', function () {
6767
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
6868
cy.wait(500);
6969
cy.get('#firstName').should('be.visible').type(name);
70-
cy.get('#lastName').should('be.visible').type('');
71-
70+
cy.get('#lastName').should('be.visible').clear();
7271
// Verify save button is disabled
7372
cy.get('#saveCreateBtn').should('be.disabled');
7473

@@ -81,7 +80,7 @@ describe('Device users page - Should not add new device user', function () {
8180

8281
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
8382
cy.wait(500);
84-
cy.get('#firstName').should('be.visible').type('');
83+
cy.get('#firstName').should('be.visible').clear();
8584
cy.get('#lastName').should('be.visible').type(lastName);
8685

8786
// Verify save button is disabled
@@ -94,8 +93,8 @@ describe('Device users page - Should not add new device user', function () {
9493
it('should NOT add device user without first and last names', () => {
9594
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
9695
cy.wait(500);
97-
cy.get('#firstName').should('be.visible').type('');
98-
cy.get('#lastName').should('be.visible').type('');
96+
cy.get('#firstName').should('be.visible').clear();
97+
cy.get('#lastName').should('be.visible').clear();
9998

10099
// Verify save button is disabled
101100
cy.get('#saveCreateBtn').should('be.disabled');

eform-client/cypress/e2e/d/device-users.delete.spec.cy.ts

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,37 @@ import { Guid } from 'guid-typescript';
44
import { expect } from 'chai';
55

66
describe('Device users page - Delete device user', function () {
7-
before(() => {
7+
beforeEach(() => {
88
cy.visit('http://localhost:4200');
99
loginPage.login();
1010
cy.intercept('POST', '**/api/device-users/index').as('loadDeviceUsers');
1111
deviceUsersPage.Navbar.goToDeviceUsersPage();
1212
cy.wait('@loadDeviceUsers', { timeout: 30000 });
13+
});
14+
15+
it('should not delete device user if cancel was clicked', () => {
1316

1417
// Create a test user to delete
1518
const firstName = Guid.create().toString();
1619
const lastName = Guid.create().toString();
1720
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible').click();
1821
cy.get('#firstName').should('be.visible').type(firstName);
1922
cy.get('#lastName').should('be.visible').type(lastName);
20-
21-
cy.intercept('POST', '**/api/device-users/create').as('createUser');
23+
24+
cy.intercept('PUT', '**/api/device-users/create').as('createUser');
2225
cy.get('#saveCreateBtn').should('be.visible').click();
2326
cy.wait('@createUser', { timeout: 30000 });
2427
cy.get('#newDeviceUserBtn').should('be.visible');
25-
});
26-
27-
it('should not delete device user if cancel was clicked', () => {
2828
// Ensure table is visible before counting rows
2929
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
30-
30+
3131
deviceUsersPage.rowNum().then((rowNumBeforeDelete) => {
3232
cy.get('#deviceUserId').should('be.visible');
3333

3434
// Click delete button on last row
3535
cy.get('#deleteDeviceUserBtn').last().should('be.visible').click();
3636
cy.get('#cancelDeleteBtn').should('be.visible').click();
3737

38-
// Navigate back to device users page
39-
cy.intercept('POST', '**/api/device-users/index').as('reloadList');
40-
deviceUsersPage.Navbar.goToDeviceUsersPage();
41-
cy.wait('@reloadList', { timeout: 30000 });
42-
4338
// Ensure table is visible before counting rows
4439
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
4540

@@ -51,38 +46,21 @@ describe('Device users page - Delete device user', function () {
5146
});
5247

5348
it('should delete device user successfully', () => {
54-
cy.intercept('POST', '**/api/device-users/index').as('loadDeviceUsers1');
55-
deviceUsersPage.Navbar.goToDeviceUsersPage();
56-
cy.wait('@loadDeviceUsers1', { timeout: 30000 });
57-
58-
// Ensure table is visible before counting rows
5949
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
6050

6151
deviceUsersPage.rowNum().then((rowNumBeforeDelete) => {
6252
cy.get('#deviceUserId').should('be.visible');
6353

6454
// Click delete button on last row
65-
cy.intercept('POST', '**/api/device-users/delete').as('deleteUser');
55+
cy.intercept('DELETE', '**/api/device-users/delete/*').as('deleteUser');
6656
cy.intercept('POST', '**/api/device-users/index').as('reloadAfterDelete');
6757
cy.get('#deleteDeviceUserBtn').last().should('be.visible').click();
6858
cy.get('#saveDeleteBtn').should('be.visible').click();
6959
cy.wait('@deleteUser', { timeout: 30000 });
7060
cy.wait('@reloadAfterDelete', { timeout: 30000 });
7161

72-
// Navigate back to device users page
73-
cy.intercept('POST', '**/api/device-users/index').as('loadDeviceUsers2');
74-
deviceUsersPage.Navbar.goToDeviceUsersPage();
75-
cy.wait('@loadDeviceUsers2', { timeout: 30000 });
76-
77-
// Ensure table is visible before counting rows
78-
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
62+
cy.get('tbody > tr', { timeout: 10000 }).should('have.length', 0);
7963

80-
// Verify count decreased
81-
deviceUsersPage.rowNum().then((rowNumAfterDelete) => {
82-
expect(rowNumBeforeDelete, 'User deleted incorrectly').to.equal(
83-
rowNumAfterDelete + 1
84-
);
85-
});
8664
});
8765
});
8866
});

eform-client/cypress/e2e/d/device-users.edit.spec.cy.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ import { Guid } from 'guid-typescript';
44
import { expect } from 'chai';
55

66
describe('Device users page - Edit device user', function () {
7-
before(() => {
7+
beforeEach(() => {
88
cy.visit('http://localhost:4200');
99
loginPage.login();
1010
cy.intercept('POST', '**/api/device-users/index').as('loadDeviceUsers');
1111
deviceUsersPage.Navbar.goToDeviceUsersPage();
1212
cy.wait('@loadDeviceUsers', { timeout: 30000 });
13+
});
14+
15+
it('should edit device user\'s first name', () => {
1316

1417
// Create a test user
1518
const firstName = Guid.create().toString();
1619
const lastName = Guid.create().toString();
1720
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible').click();
1821
cy.get('#firstName').should('be.visible').type(firstName);
1922
cy.get('#lastName').should('be.visible').type(lastName);
20-
21-
cy.intercept('POST', '**/api/device-users/create').as('createUser');
23+
24+
cy.intercept('PUT', '**/api/device-users/create').as('createUser');
2225
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
2326
cy.get('#saveCreateBtn').should('be.visible').click();
2427
cy.wait('@createUser', { timeout: 30000 });
2528
cy.wait('@reloadDeviceUsers', { timeout: 30000 });
2629
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible');
27-
});
28-
29-
it('should edit device user\'s first name', () => {
3030
const newName = Guid.create().toString();
3131

3232
cy.get('#deviceUserFirstName').should('be.visible');
@@ -37,11 +37,12 @@ describe('Device users page - Edit device user', function () {
3737

3838
// Click edit button on last row
3939
cy.get('#editDeviceUserBtn').last().should('be.visible').click();
40+
cy.wait(500);
4041
cy.get('#firstName').should('be.visible');
4142

4243
// Edit first name
4344
cy.get('#firstName').clear().type(newName);
44-
45+
4546
cy.intercept('POST', '**/api/device-users/update').as('updateUser');
4647
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
4748
cy.get('#saveEditBtn').should('be.visible').click();
@@ -66,11 +67,12 @@ describe('Device users page - Edit device user', function () {
6667

6768
// Click edit button on last row
6869
cy.get('#editDeviceUserBtn').last().should('be.visible').click();
70+
cy.wait(500);
6971
cy.get('#firstName').should('be.visible');
7072

7173
// Edit last name
72-
cy.get('#lastName').clear().type(newSurname);
73-
74+
cy.get('#lastName').should('be.visible').clear().type(newSurname);
75+
7476
cy.intercept('POST', '**/api/device-users/update').as('updateUser');
7577
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
7678
cy.get('#saveEditBtn').should('be.visible').click();
@@ -92,12 +94,13 @@ describe('Device users page - Edit device user', function () {
9294

9395
// Click edit button on last row
9496
cy.get('#editDeviceUserBtn').last().should('be.visible').click();
97+
cy.wait(500);
9598
cy.get('#firstName').should('be.visible');
9699

97100
// Edit both fields
98101
cy.get('#firstName').clear().type(newName);
99102
cy.get('#lastName').clear().type(newSurname);
100-
103+
101104
cy.intercept('POST', '**/api/device-users/update').as('updateUser');
102105
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
103106
cy.get('#saveEditBtn').should('be.visible').click();
@@ -116,14 +119,15 @@ describe('Device users page - Edit device user', function () {
116119

117120
// Ensure table is visible before counting rows
118121
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
119-
122+
120123
// Get count and data before edit
121124
deviceUsersPage.rowNum().then((rowNumBeforeEdit) => {
122125
cy.get('#deviceUserFirstName').last().invoke('text').then((oldFirstName) => {
123126
cy.get('#deviceUserLastName').last().invoke('text').then((oldLastName) => {
124127

125128
// Click edit button on last row
126129
cy.get('#editDeviceUserBtn').last().should('be.visible').click();
130+
cy.wait(500);
127131
cy.get('#firstName').should('be.visible');
128132

129133
// Try to edit both fields

0 commit comments

Comments
 (0)