Skip to content

Commit

Permalink
Cypress: Tests in relevant spec category (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifarzana authored Nov 14, 2023
1 parent 23e2b13 commit 82de792
Show file tree
Hide file tree
Showing 37 changed files with 132 additions and 132 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,23 @@ describe('Users', function() {
cy.get('.modal input#password')
.type('cypress');

// Error checking - for incorrect email format
cy.get('.modal input#email').type('cypress');

cy.get('.select2-container--bootstrap').eq(1).click();
cy.log('Before waiting for Icon Dashboard element');
cy.wait('@loadHomepageAfterSearch');
cy.get('.select2-results__option')
.should('contain', 'Icon Dashboard')
.click();

// Add first by clicking next
// Try saving
cy.get('.modal .save-button').click();

cy.contains('Please enter a valid email address.');
cy.get('.modal input#email').clear().type('[email protected]');

// Save
cy.get('.modal .save-button').click();

// Check if user is added in toast message
Expand Down Expand Up @@ -94,6 +103,17 @@ describe('Users', function() {
cy.get('.modal input#userName').clear()
.type('CypressTestUserEdited' + testRun);

cy.get('.modal input#newPassword').clear().type('newPassword');
cy.get('.modal input#retypeNewPassword').clear().type('wrongPassword');

// edit test user
cy.get('.bootbox .save-button').click();
cy.wait('@putRequest')

// Error checking - for password mismatch
cy.contains('Passwords do not match');
cy.get('.modal input#retypeNewPassword').clear().type('newPassword');

// edit test user
cy.get('.bootbox .save-button').click();

Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions cypress/e2e/Display/displaygroups.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,24 @@ describe('Display Groups', function() {
cy.get('.modal-body').contains(': Success');
});
});

// ---------
// Tests - Error handling
it('should not add a displaygroup without dynamic criteria', function() {
cy.visit('/displaygroup/view');

// Click on the Add Displaygroup button
cy.contains('Add Display Group').click();

cy.get('.modal input#displayGroup')
.type('Cypress Test Displaygroup ' + testRun + '_1');

cy.get('.modal input#isDynamic').check();

// Add first by clicking next
cy.get('.modal .save-button').click();

// Check toast message
cy.contains('Dynamic Display Groups must have at least one Criteria specified.');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Displays', function() {
});

// Display: disp3
it.only('searches and authorise an unauthorised display', function() {
it('searches and authorise an unauthorised display', function() {
// search for a display disp1 and edit
cy.intercept({
url: '/display?*',
Expand Down Expand Up @@ -275,4 +275,52 @@ describe('Displays', function() {

cy.get('#displays_wrapper.dataTables_wrapper').should('be.visible');
});

// ---------
// Tests - Error handling
it.only('should not be able to save while editing existing display with incorrect latitude/longitude', function() {
// search for a display disp1 and edit
cy.intercept({
url: '/display?*',
query: {display: 'dis_disp1'},
}).as('loadGridAfterSearch');

// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/display/*',
}).as('putRequest');

cy.visit('/display/view');

// Filter for the created display
cy.get('#Filter input[name="display"]')
.type('dis_disp1');

// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displays tbody tr').should('have.length', 1);

// Click on the first row element to open the delete modal
cy.get('#displays tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displays tr:first-child .display_button_edit').click({force: true});
cy.contains('Details').click();

cy.get('.modal input#latitude').type('1234');

// edit test display
cy.get('.bootbox .save-button').click();

// Check error message
cy.contains('The latitude entered is not valid.');

cy.get('.modal input#latitude').clear();
cy.get('.modal input#longitude').type('1234');

// edit test display
cy.get('.bootbox .save-button').click();

// Check error message
cy.contains('The longitude entered is not valid.');
});
});
File renamed without changes.
25 changes: 22 additions & 3 deletions cypress/e2e/Display/syncgroups.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ describe('Sync Groups', function() {
cy.contains('Add Sync Group').click();

cy.get('.modal input#name')
.type('Cypress Test Sync Group ' + testRun + '_1');
.type('Cypress Test Sync Group ' + testRun);

// Add first by clicking next
cy.get('.modal .save-button').click();

// Check if syncgroup is added in toast message
cy.contains('Added Cypress Test Sync Group ' + testRun + '_1');
cy.contains('Added Cypress Test Sync Group ' + testRun);
});


it('searches and delete existing syncgroup', function() {
// Create a new syncgroup and then search for it and delete it
cy.createSyncGroup('Cypress Test Sync Group ' + testRun).then((res) => {
Expand Down Expand Up @@ -75,4 +74,24 @@ describe('Sync Groups', function() {
cy.get('.toast').contains('Deleted Cypress Test Sync Group');
});
});

// ---------
// Tests - Error handling
it.only('should not add a syncgroup without publisher port', function() {
cy.visit('/syncgroup/view');

// Click on the Add Sync Group button
cy.contains('Add Sync Group').click();

cy.get('.modal input#name')
.type('Cypress Test Sync Group ' + testRun);

cy.get('#syncPublisherPort').clear();

// Add first by clicking next
cy.get('.modal .save-button').click();

// Check if syncgroup is added in toast message
cy.contains('Sync Publisher Port cannot be empty');
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ describe('Datasets', function() {
});
});


it('copy an existing dataset', function() {
// Create a new dataset and then search for it and copy it
cy.createDataset('Cypress Test Dataset ' + testRun).then((res) => {
Expand Down Expand Up @@ -283,4 +282,24 @@ describe('Datasets', function() {
cy.get('.modal-body').contains(': Success');
});
});

// ---------
// Tests - Error handling
it('should not add a remote dataset without URI', function() {
cy.visit('/dataset/view');

// Click on the Add Dataset button
cy.contains('Add DataSet').click();

cy.get('.modal input#dataSet')
.type('Cypress Test Dataset ' + testRun);

cy.get('.modal input#isRemote').check();

// Add first by clicking next
cy.get('.modal .save-button').click();

// Check error message
cy.contains('A remote DataSet must have a URI.');
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
125 changes: 0 additions & 125 deletions cypress/e2e/displaygroups.cy.js

This file was deleted.

1 change: 0 additions & 1 deletion modules/templates/article-static.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<id>article_custom_html</id>
<type>static</type>
<dataType>article</dataType>
<showIn>none</showIn>
<title>Articles shown with custom HTML</title>
<properties>
<property id="customTemplate" type="hidden">
Expand Down

0 comments on commit 82de792

Please sign in to comment.