Initial Upload

This commit is contained in:
Matt Batchelder
2025-12-02 10:32:59 -05:00
commit 05ce0da296
2240 changed files with 467811 additions and 0 deletions

View File

@@ -0,0 +1,318 @@
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-len */
describe('Display Groups', function() {
let testRun = '';
beforeEach(function() {
cy.login();
testRun = Cypress._.random(0, 1e9);
});
it('should add one empty and one filled display groups', 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');
// Add first by clicking next
cy.get('.modal').contains('Next').click();
// Check if displaygroup is added in toast message
cy.contains('Added Cypress Test Displaygroup ' + testRun + '_1');
cy.get('.modal input#displayGroup')
.type('Cypress Test Displaygroup ' + testRun + '_2');
cy.get('.modal input#description')
.type('Description');
cy.get('.modal input#isDynamic').check();
cy.get('.modal input#dynamicCriteria')
.type('testLayoutId');
// Add first by clicking next
cy.get('.modal .save-button').click();
// Check if displaygroup is added in toast message
cy.contains('Added Cypress Test Displaygroup ' + testRun + '_2');
});
it('copy an existing displaygroup', function() {
// Create a new displaygroup and then search for it and delete it
cy.createDisplaygroup('Cypress Test Displaygroup ' + testRun).then((res) => {
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: 'Cypress Test Displaygroup ' + testRun},
}).as('loadGridAfterSearch');
// Intercept the POST request
cy.intercept({
method: 'POST',
url: /\/displaygroup\/\d+\/copy$/,
}).as('postRequest');
cy.visit('/displaygroup/view');
// Filter for the created displaygroup
cy.get('#Filter input[name="displayGroup"]')
.type('Cypress Test Displaygroup ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displaygroups tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displaygroups tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displaygroups tr:first-child .displaygroup_button_copy').click({force: true});
// Delete test displaygroup
cy.get('.bootbox .save-button').click();
// Wait for the intercepted POST request and check the form data
cy.wait('@postRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
expect(responseData.displayGroup).to.include('Cypress Test Displaygroup ' + testRun + ' 2');
});
});
});
it('searches and delete existing displaygroup', function() {
// Create a new displaygroup and then search for it and delete it
cy.createDisplaygroup('Cypress Test Displaygroup ' + testRun).then((res) => {
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: 'Cypress Test Displaygroup ' + testRun},
}).as('loadGridAfterSearch');
cy.visit('/displaygroup/view');
// Filter for the created displaygroup
cy.get('#Filter input[name="displayGroup"]')
.type('Cypress Test Displaygroup ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displaygroups tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displaygroups tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displaygroups tr:first-child .displaygroup_button_delete').click({force: true});
// Delete test displaygroup
cy.get('.bootbox .save-button').click();
// Check if displaygroup is deleted in toast message
cy.get('.toast').contains('Deleted Cypress Test Displaygroup');
});
});
// Seeded displays: dispgrp_disp1, dispgrp_disp2
it('manage membership for a displaygroup', function() {
cy.createDisplaygroup('Cypress Test Displaygroup ' + testRun).then((res) => {
// assign displays to display group
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: 'Cypress Test Displaygroup ' + testRun},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'POST',
url: /\/displaygroup\/\d+\/display\/assign$/,
}).as('postRequest');
cy.intercept({
url: '/display*',
query: {display: 'dispgrp_disp1'},
}).as('loadDisplayAfterSearch');
cy.visit('/displaygroup/view');
// Filter for the created displaygroup
cy.get('#Filter input[name="displayGroup"]')
.type('Cypress Test Displaygroup ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displaygroups tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displaygroups tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displaygroups tr:first-child .displaygroup_button_group_members').click({force: true});
cy.get('.modal #display').type('dispgrp_disp1');
cy.wait('@loadDisplayAfterSearch');
cy.get('#displaysMembersTable').within(() => {
// count the rows within table
cy.get('tbody').find('tr').should('have.length', 1);
cy.get('tbody tr:first-child input[type="checkbox"]').check();
});
// Save assignments
cy.get('.bootbox .save-button').click();
// Wait for the intercepted POST request and check the form data
cy.wait('@postRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const body = response.body;
expect(body.success).to.eq(true);
});
});
});
// -------
// Seeded displays: dispgrp_disp_dynamic1, dispgrp_disp_dynamic2
it('should add a dynamic display group', function() {
cy.intercept({
url: '/display?*',
query: {display: 'dynamic'},
}).as('loadDisplayGridAfterSearch');
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);
// Add first by clicking next
cy.get('.modal #isDynamic').check();
// Type "dynamic" into the input field with the name "dynamicCriteria"
cy.get('.modal input[name="dynamicCriteria"]').type('dynamic');
cy.wait('@loadDisplayGridAfterSearch');
// Add first by clicking next
cy.get('.modal .save-button').click();
// Check if displaygroup is added in toast message
cy.contains('Added Cypress Test Displaygroup ' + testRun);
});
it('should edit the criteria of a dynamic display group', function() {
// Create a new displaygroup with dynamic criteria
cy.createDisplaygroup('Cypress Test Displaygroup Dynamic ' + testRun, true, 'dynamic').then((res) => {
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: 'Cypress Test Displaygroup Dynamic ' + testRun},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/displaygroup/*',
}).as('putRequest');
cy.visit('/displaygroup/view');
// Filter for the created displaygroup
cy.get('#Filter input[name="displayGroup"]')
.type('Cypress Test Displaygroup Dynamic ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displaygroups tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displaygroups tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displaygroups tr:first-child .displaygroup_button_edit').click({force: true});
cy.get('.modal input[name="dynamicCriteria"]').clear().type('dynamic_edited');
// Delete test displaygroup
cy.get('.bootbox .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
// assertion on the "display" value
expect(responseData.dynamicCriteria).to.eq('dynamic_edited');
});
});
});
// -------
// -- Delete Many
it('selects multiple display groups and delete them', function() {
// Create a new displaygroup and then search for it and delete it
cy.createDisplaygroup('Cypress Test Displaygroup ' + testRun).then((res) => {
cy.intercept('GET', '/displaygroup?draw=2&*').as('displaygroupGridLoad');
// Delete all test displaygroups
cy.visit('/displaygroup/view');
// Clear filter
cy.get('#Filter input[name="displayGroup"]')
.clear()
.type('Cypress Test Displaygroup');
// Wait for the grid reload
cy.wait('@displaygroupGridLoad');
// Select all
cy.get('button[data-toggle="selectAll"]').click();
// Delete all
cy.get('.dataTables_info button[data-toggle="dropdown"]').click();
cy.get('.dataTables_info a[data-button-id="displaygroup_button_delete"]').click();
cy.get('input#checkbox-confirmDelete').check();
cy.get('button.save-button').click();
// Modal should contain one successful delete at least
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.');
});
});

View File

@@ -0,0 +1,334 @@
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-len */
describe('Displays', function() {
let testRun = '';
beforeEach(function() {
cy.login();
testRun = Cypress._.random(0, 1e9);
});
// Seeded displays: disp1, disp2, disp3, disp4, disp5
// Seeded display Groups: disp5_dispgrp
// Seeded layouts: disp4_default_layout
it('searches and edit existing display', 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.get('.modal input#display').clear()
.type('dis_disp1 Edited');
cy.get('.modal input#license').clear()
.type('dis_disp1_license');
cy.get('.modal input#description').clear()
.type('description');
// edit test display
cy.get('.bootbox .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
// assertion on the "display" value
expect(responseData.display).to.eq('dis_disp1 Edited');
expect(responseData.description).to.eq('description');
expect(responseData.license).to.eq('dis_disp1_license');
});
});
// Display: disp2
it('searches and delete existing display', function() {
cy.intercept({
url: '/display?*',
query: {display: 'dis_disp2'},
}).as('loadGridAfterSearch');
cy.visit('/display/view');
// Filter for the created display
cy.get('#Filter input[name="display"]')
.type('dis_disp2');
// 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_delete').click({force: true});
// Delete test display
cy.get('.bootbox .save-button').click();
// Check if display is deleted in toast message
cy.get('.toast').contains('Deleted dis_disp2');
});
// Display: disp3
it('searches and authorise an unauthorised display', function() {
// search for a display disp1 and edit
cy.intercept({
url: '/display?*',
query: {display: 'dis_disp3'},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/display/authorise/*',
}).as('putRequest');
cy.visit('/display/view');
// Filter for the created display
cy.get('#Filter input[name="display"]')
.type('dis_disp3');
// 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_authorise').click({force: true});
// edit test display
cy.get('.bootbox .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
// assertion
expect(response.body.message).to.eq('Authorised set to 1 for dis_disp3');
});
});
// Display: disp4
it('set a default layout', function() {
cy.intercept({
url: '/display?*',
query: {display: 'dis_disp4'},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/display/defaultlayout/*',
}).as('putRequest');
cy.intercept({
url: '/layout*',
query: {
layout: 'disp4_default_layout',
},
}).as('loadLayoutAfterSearch');
cy.visit('/display/view');
// Filter for the created display
cy.get('#Filter input[name="display"]')
.type('dis_disp4');
// 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_defaultlayout').click({force: true});
// Set the default layout
cy.get('.modal .select2-container--bootstrap').click();
cy.get('.select2-search__field').type('disp4_default_layout');
cy.wait('@loadLayoutAfterSearch');
cy.get('.select2-results__option').contains('disp4_default_layout').click();
// edit test display
cy.get('.bootbox .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const body = response.body;
expect(body.success).to.eq(true);
});
});
// Display: disp5
it('manage membership for disp5', function() {
cy.intercept({
url: '/display?*',
query: {display: 'dis_disp5'},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'POST',
url: /\/display\/\d+\/displaygroup\/assign$/,
}).as('postRequest');
cy.intercept({
url: '/displaygroup*',
query: {
displayGroup: 'disp5_dispgrp',
},
}).as('loadDisplaypGroupAfterSearch');
cy.visit('/display/view');
// Filter for the created display
cy.get('#Filter input[name="display"]')
.type('dis_disp5');
// 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_group_membership').click({force: true});
cy.get('.modal #displayGroup').type('disp5_dispgrp');
cy.wait('@loadDisplaypGroupAfterSearch');
cy.get('#displaysGroupsMembersTable').within(() => {
// count the rows within table
cy.get('tbody').find('tr')
.should('have.length', 1)
.and('contain', 'disp5_dispgrp');
cy.get('tbody tr:first-child input[type="checkbox"]')
.should('not.be.checked')
.check();
});
// Save assignments
cy.get('.bootbox .save-button').click();
// Wait for the intercepted POST request and check the form data
cy.wait('@postRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const body = response.body;
expect(body.success).to.eq(true);
});
});
it('should display map and revert back to table', function() {
cy.intercept('GET', '/user/pref?preference=displayGrid').as('displayPrefsLoad');
cy.intercept('GET', '/display?draw=2*').as('displayLoad');
cy.intercept('POST', '/user/pref').as('userPrefPost');
cy.visit('/display/view');
cy.wait('@displayPrefsLoad');
cy.wait('@displayLoad');
cy.wait('@userPrefPost');
cy.get('#map_button').click();
cy.get('#display-map.leaflet-container').should('be.visible');
cy.get('#list_button').click();
cy.get('#displays_wrapper.dataTables_wrapper').should('be.visible');
});
// ---------
// Tests - Error handling
it('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.');
});
});

View File

@@ -0,0 +1,166 @@
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-len */
describe('Display Settings', function() {
let testRun = '';
beforeEach(function() {
cy.login();
testRun = Cypress._.random(0, 1e9);
});
it('should and edit a display setting', function() {
// Intercept the POST request
cy.intercept({
method: 'POST',
url: '/displayprofile',
}).as('postRequest');
// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/displayprofile/*',
}).as('putRequest');
cy.visit('/displayprofile/view');
// Click on the Add Display Setting button
cy.contains('Add Profile').click();
cy.get('.modal input#name')
.type('Cypress Test Display Setting ' + testRun);
// Add first by clicking next
cy.get('.modal .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@postRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
// assertion on the "tag" value
expect(responseData.name).to.eq('Cypress Test Display Setting ' + testRun);
cy.get('.modal input#name').clear()
.type('Cypress Test Display Setting Edited ' + testRun);
// Select the option with the value "10 minutes"
cy.get('.modal #collectInterval').select('600');
// Add first by clicking next
cy.get('.modal .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
// assertion on the "tag" value
expect(responseData.name).to.eq('Cypress Test Display Setting Edited ' + testRun);
});
});
});
it('searches and edit existing display setting', function() {
// Create a new tag and then search for it and delete it
cy.createDisplayProfile('Cypress Test Display Setting ' + testRun, 'android').then((id) => {
cy.intercept({
url: '/displayprofile?*',
query: {displayProfile: 'Cypress Test Display Setting ' + testRun},
}).as('loadGridAfterSearch');
// Intercept the PUT request
cy.intercept({
method: 'PUT',
url: '/displayprofile/*',
}).as('putRequest');
cy.visit('/displayprofile/view');
// Filter for the created tag
cy.get('#Filter input[name="displayProfile"]')
.type('Cypress Test Display Setting ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displayProfiles tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displayProfiles tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displayProfiles tr:first-child .displayprofile_button_edit').click({force: true});
cy.get('.modal input#name').clear()
.type('Cypress Test Display Setting Edited ' + testRun);
// edit test tag
cy.get('.bootbox .save-button').click();
// Wait for the intercepted PUT request and check the form data
cy.wait('@putRequest').then((interception) => {
// Get the request body (form data)
const response = interception.response;
const responseData = response.body.data;
// assertion on the "tag" value
expect(responseData.name).to.eq('Cypress Test Display Setting Edited ' + testRun);
});
// Delete the user and assert success
cy.deleteDisplayProfile(id).then((res) => {
expect(res.status).to.equal(204);
});
});
});
it('searches and delete existing display setting', function() {
// Create a new tag and then search for it and delete it
cy.createDisplayProfile('Cypress Test Display Setting ' + testRun, 'android').then((id) => {
cy.intercept({
url: '/displayprofile?*',
query: {displayProfile: 'Cypress Test Display Setting ' + testRun},
}).as('loadGridAfterSearch');
cy.visit('/displayprofile/view');
// Filter for the created tag
cy.get('#Filter input[name="displayProfile"]')
.type('Cypress Test Display Setting ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#displayProfiles tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#displayProfiles tr:first-child .dropdown-toggle').click({force: true});
cy.get('#displayProfiles tr:first-child .displayprofile_button_delete').click({force: true});
// Delete test tag
cy.get('.bootbox .save-button').click();
// Check if tag is deleted in toast message
cy.get('.toast').contains('Deleted Cypress Test Display Setting');
});
});
});

View File

@@ -0,0 +1,97 @@
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-len */
describe('Sync Groups', function() {
let testRun = '';
beforeEach(function() {
cy.login();
testRun = Cypress._.random(0, 1e9);
});
it('should add one empty syncgroups', 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);
// 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);
});
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) => {
cy.intercept({
url: '/syncgroup?*',
query: {name: 'Cypress Test Sync Group ' + testRun},
}).as('loadGridAfterSearch');
cy.visit('/syncgroup/view');
// Filter for the created syncgroup
cy.get('#Filter input[name="name"]')
.type('Cypress Test Sync Group ' + testRun);
// Wait for the grid reload
cy.wait('@loadGridAfterSearch');
cy.get('#syncgroups tbody tr').should('have.length', 1);
// Click on the first row element to open the delete modal
cy.get('#syncgroups tr:first-child .dropdown-toggle').click({force: true});
cy.get('#syncgroups tr:first-child .syncgroup_button_group_delete').click({force: true});
// Delete test syncgroup
cy.get('.bootbox .save-button').click();
// Check if syncgroup is deleted in toast message
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');
});
});