Skip to content

Commit a6ab3b9

Browse files
Merge pull request #9 from microting/master
master changes
2 parents 55483e5 + eb2b1f3 commit a6ab3b9

File tree

5 files changed

+31
-33
lines changed

5 files changed

+31
-33
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.10.0">
12+
<PackageReference Include="NUnit.Analyzers" Version="4.11.0">
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.10.0">
12+
<PackageReference Include="NUnit.Analyzers" Version="4.11.0">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>

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.67" />
59-
<PackageReference Include="Microting.EformAngularFrontendBase" Version="9.0.54" />
60-
<PackageReference Include="Microting.eFormApi.BasePn" Version="9.0.59" />
58+
<PackageReference Include="Microting.eForm" Version="9.0.68" />
59+
<PackageReference Include="Microting.EformAngularFrontendBase" Version="9.0.55" />
60+
<PackageReference Include="Microting.eFormApi.BasePn" Version="9.0.60" />
6161
<PackageReference Include="PureOtp" Version="1.0.0.1" />
6262
<PackageReference Include="Sentry" Version="5.16.1" />
6363
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ class DeviceUsersPage extends PageWithNavbarPage{
8686
// @ts-ignore
8787
public rowNum(): Cypress.Chainable<number> {
8888
// @ts-ignore
89-
return cy.get('tbody > tr').should('have.length.gt', 0).then($rows => $rows.length);
89+
return cy.wait(500).then(() => {
90+
return cy.get('tbody').then($tbody => {
91+
return $tbody.find('tr').length;
92+
});
93+
});
9094
}
9195

9296
public getDeviceUser(num: number): DeviceUsersRowObject {

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

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,20 @@ describe('Device users page - Add new device user', function () {
2121
it('should add new device user with first name and last name', () => {
2222
const surname = generateRandmString();
2323

24-
// Ensure table is visible before counting rows
25-
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
26-
2724
deviceUsersPage.rowNum().then((rowCountBeforeCreation) => {
2825
countDeviceUsersBeforeCreating = rowCountBeforeCreation;
2926

3027
// Create new device user
3128
cy.get('#newDeviceUserBtn').should('be.visible').click();
3229
cy.get('#firstName').should('be.visible').type(nameDeviceUser);
3330
cy.get('#lastName').should('be.visible').type(surname);
34-
35-
cy.intercept('POST', '**/api/device-users/create').as('createUser');
31+
32+
cy.intercept('PUT', '**/api/device-users/create').as('createUser');
3633
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
3734
cy.get('#saveCreateBtn').should('be.visible').should('be.enabled').click();
3835
cy.wait('@createUser', { timeout: 30000 });
3936
cy.wait('@reloadDeviceUsers', { timeout: 30000 });
40-
cy.get('#newDeviceUserBtn').should('be.visible');
37+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible');
4138

4239
// Verify the user was created
4340
deviceUsersPage.rowNum().then((rowCountAfterCreation) => {
@@ -55,7 +52,7 @@ describe('Device users page - Add new device user', function () {
5552
});
5653

5754
describe('Device users page - Should not add new device user', function () {
58-
before(() => {
55+
beforeEach(() => {
5956
cy.visit('http://localhost:4200');
6057
loginPage.login();
6158
cy.intercept('POST', '**/api/device-users/index').as('loadDeviceUsers');
@@ -67,8 +64,10 @@ describe('Device users page - Should not add new device user', function () {
6764
it('should NOT add device user with only first name', () => {
6865
const name = generateRandmString();
6966

70-
cy.get('#newDeviceUserBtn').should('be.visible').click();
67+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
68+
cy.wait(500);
7169
cy.get('#firstName').should('be.visible').type(name);
70+
cy.get('#lastName').should('be.visible').type('');
7271

7372
// Verify save button is disabled
7473
cy.get('#saveCreateBtn').should('be.disabled');
@@ -80,38 +79,38 @@ describe('Device users page - Should not add new device user', function () {
8079
it('should NOT add device user with only last name', () => {
8180
const lastName = generateRandmString();
8281

83-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible').click();
82+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
83+
cy.wait(500);
84+
cy.get('#firstName').should('be.visible').type('');
8485
cy.get('#lastName').should('be.visible').type(lastName);
8586

8687
// Verify save button is disabled
8788
cy.get('#saveCreateBtn').should('be.disabled');
8889

8990
cy.get('#cancelCreateBtn').should('be.visible').click();
90-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible');
91+
cy.wait(500);
9192
});
9293

9394
it('should NOT add device user without first and last names', () => {
94-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible').click();
95-
cy.get('#firstName').should('be.visible');
95+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
96+
cy.wait(500);
97+
cy.get('#firstName').should('be.visible').type('');
98+
cy.get('#lastName').should('be.visible').type('');
9699

97100
// Verify save button is disabled
98101
cy.get('#saveCreateBtn').should('be.disabled');
99102

100103
cy.get('#cancelCreateBtn').should('be.visible').click();
101-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible');
102104
cy.wait(500);
103105
});
104106

105107
it('should NOT create user if cancel was clicked', () => {
106-
// Ensure table is visible before counting rows
107-
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
108-
109108
deviceUsersPage.rowNum().then((rowCountBeforeCreation) => {
110-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible').click();
111-
cy.get('#firstName').should('be.visible');
109+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible').click();
112110
cy.wait(500);
111+
cy.get('#firstName').should('be.visible');
113112
cy.get('#cancelCreateBtn').should('be.visible').click();
114-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible');
113+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible');
115114
cy.wait(500);
116115

117116
deviceUsersPage.rowNum().then((rowCountAfterCreation) => {
@@ -124,26 +123,21 @@ describe('Device users page - Should not add new device user', function () {
124123
});
125124

126125
it('should clean up created test data', () => {
127-
// Ensure table is visible before finding user
128-
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
129-
130126
// Find and delete the test user
131127
cy.get('#deviceUserFirstName').each(($el, index) => {
132128
if ($el.text() === nameDeviceUser) {
133-
cy.intercept('POST', '**/api/device-users/delete').as('deleteUser');
129+
cy.intercept('DELETE', '**/api/device-users/delete/*').as('deleteUser');
134130
cy.intercept('POST', '**/api/device-users/index').as('reloadDeviceUsers');
135131
cy.get('#deleteDeviceUserBtn').eq(index).click();
132+
cy.wait(500);
136133
cy.get('#saveDeleteBtn').should('be.visible').click();
137134
cy.wait('@deleteUser', { timeout: 30000 });
138135
cy.wait('@reloadDeviceUsers', { timeout: 30000 });
139-
cy.get('#newDeviceUserBtn', { timeout: 10000 }).should('be.visible');
136+
cy.get('#newDeviceUserBtn', { timeout: 40000 }).should('be.visible');
140137
return false; // break the loop
141138
}
142139
});
143140

144-
// Ensure table is visible before counting rows
145-
cy.get('tbody > tr', { timeout: 10000 }).should('have.length.gt', 0);
146-
147141
// Verify count is back to original
148142
deviceUsersPage.rowNum().then((currentCount) => {
149143
expect(currentCount).to.equal(countDeviceUsersBeforeCreating);

0 commit comments

Comments
 (0)