Initial Upload
This commit is contained in:
322
cypress/e2e/Library/datasets.cy.js
Normal file
322
cypress/e2e/Library/datasets.cy.js
Normal file
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
* 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('Datasets', function() {
|
||||
let testRun = '';
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
testRun = Cypress._.random(0, 1e9);
|
||||
});
|
||||
|
||||
it('should add one empty dataset', 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 + '_1');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if dataset is added in toast message
|
||||
cy.contains('Added Cypress Test Dataset ' + testRun + '_1');
|
||||
});
|
||||
|
||||
it('should be able to cancel creating dataset', 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 + '_1');
|
||||
|
||||
// Click cancel
|
||||
cy.get('.modal #dialog_btn_1').click();
|
||||
|
||||
// Check if you are back to the view page
|
||||
cy.url().should('include', '/dataset/view');
|
||||
});
|
||||
|
||||
it('searches and edit existing dataset', function() {
|
||||
// Create a new dataset and then search for it and delete it
|
||||
cy.createDataset('Cypress Test Dataset ' + testRun).then((id) => {
|
||||
cy.intercept({
|
||||
url: '/dataset?*',
|
||||
query: {dataSet: 'Cypress Test Dataset ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/dataset/*',
|
||||
}).as('putRequest');
|
||||
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Filter for the created dataset
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.type('Cypress Test Dataset ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#datasets tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#datasets tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#datasets tr:first-child .dataset_button_edit').click({force: true});
|
||||
|
||||
cy.get('.modal input#dataSet').clear()
|
||||
.type('Cypress Test Dataset Edited ' + testRun);
|
||||
|
||||
// edit test dataset
|
||||
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 "dataset" value
|
||||
expect(responseData.dataSet).to.eq('Cypress Test Dataset Edited ' + testRun);
|
||||
});
|
||||
|
||||
// Delete the dataset and assert success
|
||||
cy.deleteDataset(id).then((res) => {
|
||||
expect(res.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('add row/column to an existing dataset', function() {
|
||||
// Create a new dataset and then search for it and delete it
|
||||
cy.createDataset('Cypress Test Dataset ' + testRun).then((id) => {
|
||||
cy.intercept({
|
||||
url: '/dataset?*',
|
||||
query: {dataSet: 'Cypress Test Dataset ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: /\/dataset\/\d+\/column$/,
|
||||
}).as('postRequestAddColumn');
|
||||
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: /\/dataset\/data\/\d+/,
|
||||
}).as('postRequestAddRow');
|
||||
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Filter for the created dataset
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.type('Cypress Test Dataset ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#datasets tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the View data
|
||||
cy.get('#datasets tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#datasets tr:first-child .dataset_button_viewcolumns').click({force: true});
|
||||
|
||||
cy.get('#datasets').contains('No data available in table');
|
||||
|
||||
// Add data row to dataset
|
||||
cy.contains('Add Column').click();
|
||||
cy.get('.modal input#heading').type('Col1');
|
||||
|
||||
// Save
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Wait for the intercepted PUT request and check the form data
|
||||
cy.wait('@postRequestAddColumn').then((interception) => {
|
||||
// Get the request body (form data)
|
||||
const response = interception.response;
|
||||
const responseData = response.body.data;
|
||||
|
||||
// assertion on the "dataset" value
|
||||
expect(responseData.heading).to.eq('Col1');
|
||||
|
||||
cy.contains('View Data').click();
|
||||
cy.get('#datasets').contains('No data available in table');
|
||||
|
||||
// Add data row to dataset
|
||||
cy.contains('Add Row').click();
|
||||
cy.get('#dataSetDataAdd').within(() => {
|
||||
cy.get('input:first').type('Your text goes here');
|
||||
});
|
||||
|
||||
// Save
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Wait for the intercepted request and check data
|
||||
cy.wait('@postRequestAddRow').then((interception) => {
|
||||
cy.contains('Added Row');
|
||||
});
|
||||
});
|
||||
|
||||
// Now try to delete the dataset
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Filter for the created dataset
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.type('Cypress Test Dataset ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#datasets tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the View data
|
||||
cy.get('#datasets tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#datasets tr:first-child .dataset_button_delete').click({force: true});
|
||||
});
|
||||
});
|
||||
|
||||
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) => {
|
||||
cy.intercept({
|
||||
url: '/dataset?*',
|
||||
query: {dataSet: 'Cypress Test Dataset ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the POST request
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: /\/dataset\/copy\/\d+/,
|
||||
}).as('postRequest');
|
||||
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Filter for the created dataset
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.type('Cypress Test Dataset ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#datasets tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#datasets tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#datasets tr:first-child .dataset_button_copy').click({force: true});
|
||||
|
||||
// save
|
||||
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.dataSet).to.include('Cypress Test Dataset ' + testRun + ' 2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and delete existing dataset', function() {
|
||||
// Create a new dataset and then search for it and delete it
|
||||
cy.createDataset('Cypress Test Dataset ' + testRun).then((res) => {
|
||||
cy.intercept('GET', '/dataset?draw=2&*').as('datasetGridLoad');
|
||||
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Filter for the created dataset
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.type('Cypress Test Dataset ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@datasetGridLoad');
|
||||
cy.get('#datasets tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#datasets tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#datasets tr:first-child .dataset_button_delete').click({force: true});
|
||||
|
||||
// Delete test dataset
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Check if dataset is deleted in toast message
|
||||
cy.get('.toast').contains('Deleted Cypress Test Dataset');
|
||||
});
|
||||
});
|
||||
|
||||
it('selects multiple datasets and delete them', function() {
|
||||
// Create a new dataset and then search for it and delete it
|
||||
cy.createDataset('Cypress Test Dataset ' + testRun).then((res) => {
|
||||
cy.intercept('GET', '/dataset?draw=2&*').as('datasetGridLoad');
|
||||
|
||||
// Delete all test datasets
|
||||
cy.visit('/dataset/view');
|
||||
|
||||
// Clear filter
|
||||
cy.get('#Filter input[name="dataSet"]')
|
||||
.clear()
|
||||
.type('Cypress Test Dataset');
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@datasetGridLoad');
|
||||
|
||||
// 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="dataset_button_delete"]').click();
|
||||
|
||||
cy.get('input#deleteData').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 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();
|
||||
|
||||
// Click on the "Remote" tab
|
||||
cy.get(':nth-child(2) > .nav-link').should('be.visible').click();
|
||||
|
||||
// Check that the error message is displayed for the missing URI field
|
||||
cy.get('#uri-error').should('have.text', 'This field is required.');
|
||||
});
|
||||
});
|
||||
111
cypress/e2e/Library/media.cy.js
Normal file
111
cypress/e2e/Library/media.cy.js
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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('Media Admin', function() {
|
||||
let testRun;
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
testRun = Cypress._.random(0, 1e9);
|
||||
});
|
||||
|
||||
it('should add a media via url', function() {
|
||||
cy.visit('/library/view');
|
||||
|
||||
// Click on the Add Playlist button
|
||||
cy.contains('Add media (URL)').click();
|
||||
|
||||
cy.get('#url')
|
||||
.type('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
|
||||
|
||||
cy.get('#optionalName')
|
||||
.type('Cypress Test Media ' + testRun);
|
||||
|
||||
cy.get('.modal .save-button').click();
|
||||
cy.wait(24000);
|
||||
|
||||
// Filter for the created playlist
|
||||
cy.get('#media')
|
||||
.type('Cypress Test Media ' + testRun);
|
||||
|
||||
// Should have the added playlist
|
||||
cy.get('#libraryItems tbody tr').should('have.length', 1);
|
||||
cy.get('#libraryItems tbody tr:nth-child(1) td:nth-child(2)').contains('Cypress Test Media ' + testRun);
|
||||
});
|
||||
|
||||
it('should cancel adding a media', function() {
|
||||
cy.visit('/library/view');
|
||||
|
||||
// Click on the Add Playlist button
|
||||
cy.contains('Add media (URL)').click();
|
||||
|
||||
cy.get('#url')
|
||||
.type('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
|
||||
|
||||
cy.get('#optionalName')
|
||||
.type('Cypress Test Media ' + testRun);
|
||||
|
||||
// Click cancel
|
||||
cy.get('#dialog_btn_1').click();
|
||||
|
||||
// Check if you are back to the view page
|
||||
cy.url().should('include', '/library/view');
|
||||
});
|
||||
|
||||
it('should show a list of Media', function() {
|
||||
// Wait for playlist grid reload
|
||||
cy.intercept('/library?draw=1&*').as('mediaGridLoad');
|
||||
|
||||
cy.visit('/library/view').then(function() {
|
||||
cy.wait('@mediaGridLoad');
|
||||
cy.get('#libraryItems');
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('selects media and delete them', function() {
|
||||
// Create a new playlist and then search for it and delete it
|
||||
cy.intercept('/library?draw=1&*').as('mediaGridLoad');
|
||||
|
||||
// Delete all test playlists
|
||||
cy.visit('/library/view');
|
||||
|
||||
// Clear filter and search for text playlists
|
||||
cy.get('#media')
|
||||
.clear()
|
||||
.type('Cypress Test Media');
|
||||
|
||||
// Wait for 1st playlist grid reload
|
||||
cy.wait('@mediaGridLoad');
|
||||
|
||||
// Select first entry
|
||||
cy.get('table#libraryItems').contains('Cypress Test Media').parents('tr.odd').should('be.visible').click();
|
||||
cy.get('button[data-toggle="dropdown"]').first().click();
|
||||
|
||||
// Click Delete
|
||||
cy.contains('Delete').click();
|
||||
cy.get('button.save-button').click();
|
||||
|
||||
// Modal should contain one successful delete at least
|
||||
cy.get('div[class="toast-message"]').should('contain', 'Deleted');
|
||||
});
|
||||
});
|
||||
439
cypress/e2e/Library/menuboards.cy.js
Normal file
439
cypress/e2e/Library/menuboards.cy.js
Normal file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
* 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('Menuboards', function() {
|
||||
let testRun = '';
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
testRun = Cypress._.random(0, 1e9);
|
||||
});
|
||||
|
||||
it('should add a menuboard', function() {
|
||||
cy.visit('/menuboard/view');
|
||||
|
||||
// Click on the Add Menuboard button
|
||||
cy.contains('Add Menu Board').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Menuboard ' + testRun + '_1');
|
||||
cy.get('.modal input#code')
|
||||
.type('MENUBOARD');
|
||||
cy.get('.modal textarea#description')
|
||||
.type('Menuboard Description');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if menuboard is added in toast message
|
||||
cy.contains('Added Menu Board');
|
||||
});
|
||||
|
||||
it('searches and edit existing menuboard', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((res) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard?*',
|
||||
query: {name: 'Cypress Test Menuboard ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/menuboard/*',
|
||||
}).as('putRequest');
|
||||
|
||||
cy.visit('/menuboard/view');
|
||||
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Menuboard ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoards tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoards tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoards tr:first-child .menuBoard_edit_button').click({force: true});
|
||||
|
||||
cy.get('.modal input#name').clear()
|
||||
.type('Cypress Test Menuboard Edited ' + testRun);
|
||||
|
||||
// edit test menuboard
|
||||
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 "menuboard" value
|
||||
expect(responseData.name).to.eq('Cypress Test Menuboard Edited ' + testRun);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and delete existing menuboard', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((res) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard?*',
|
||||
query: {name: 'Cypress Test Menuboard ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
cy.visit('/menuboard/view');
|
||||
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Menuboard ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoards tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoards tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoards tr:first-child .menuBoard_delete_button').click({force: true});
|
||||
|
||||
// Delete test menuboard
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Check if menuboard is deleted in toast message
|
||||
cy.get('.toast').contains('Deleted Cypress Test Menuboard');
|
||||
});
|
||||
});
|
||||
|
||||
// -------------------
|
||||
it('should add categories and products to a menuboard', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard?*',
|
||||
query: {name: 'Cypress Test Menuboard ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
cy.visit('/menuboard/view');
|
||||
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Menuboard ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoards tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoards tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoards tr:first-child .menuBoard_button_viewcategories').click({force: true});
|
||||
|
||||
// Click on the Add Category button
|
||||
cy.contains('Add Category').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Category ' + testRun + '_1');
|
||||
cy.get('.modal input#code')
|
||||
.type('MENUBOARDCAT');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if menuboard is added in toast message
|
||||
cy.contains('Added Menu Board Category');
|
||||
|
||||
// Wait for the grid reload
|
||||
// cy.wait('@loadCategoryGridAfterSearch');
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoardCategories tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoardCategories tr:first-child .menuBoardCategory_button_viewproducts').click({force: true});
|
||||
|
||||
// Click on the Add Product button
|
||||
cy.contains('Add Product').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Product ' + testRun + '_1');
|
||||
cy.get('.modal input#code')
|
||||
.type('MENUBOARDPROD');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if menuboard is added in toast message
|
||||
cy.contains('Added Menu Board Product');
|
||||
});
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Categories
|
||||
it('should add a category', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuId + '/categories/view');
|
||||
// Click on the Add Category button
|
||||
cy.contains('Add Category').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Category ' + testRun + '_1');
|
||||
cy.get('.modal input#code')
|
||||
.type('MENUBOARDCAT');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check toast message
|
||||
cy.contains('Added Menu Board Category');
|
||||
|
||||
// Delete the menuboard and assert success
|
||||
cy.deleteMenuboard(menuId).then((response) => {
|
||||
expect(response.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and edit existing category', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.createMenuboardCat('Cypress Test Category ' + testRun, menuId).then((menuCatId) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard/' + menuId + '/categories?*',
|
||||
query: {name: 'Cypress Test Category ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/menuboard/' + menuCatId + '/category',
|
||||
}).as('putRequest');
|
||||
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuId + '/categories/view');
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Category ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoardCategories tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoardCategories tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoardCategories tr:first-child .menuBoardCategory_edit_button').click({force: true});
|
||||
|
||||
// EDIT
|
||||
cy.get('.modal input#name').clear()
|
||||
.type('Cypress Test Category Edited ' + testRun);
|
||||
|
||||
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 "menuboard" value
|
||||
expect(responseData.name).to.eq('Cypress Test Category Edited ' + testRun);
|
||||
});
|
||||
|
||||
// Delete the menuboard and assert success
|
||||
cy.deleteMenuboard(menuId).then((response) => {
|
||||
expect(response.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and delete existing category', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.createMenuboardCat('Cypress Test Category ' + testRun, menuId).then((menuCatId) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard/' + menuId + '/categories?*',
|
||||
query: {name: 'Cypress Test Category ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/menuboard/' + menuCatId + '/category',
|
||||
}).as('putRequest');
|
||||
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuId + '/categories/view');
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Category ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoardCategories tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoardCategories tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoardCategories tr:first-child .menuBoardCategory_delete_button').click({force: true});
|
||||
|
||||
// Delete test category
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Check toast message
|
||||
cy.get('.toast').contains('Deleted Cypress Test Category');
|
||||
|
||||
// Delete the menuboard and assert success
|
||||
cy.deleteMenuboard(menuId).then((response) => {
|
||||
expect(response.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Products
|
||||
it('should add a product', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.createMenuboardCat('Cypress Test Category ' + testRun, menuId).then((menuCatId) => {
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuCatId + '/products/view');
|
||||
// Click on the Add Product button
|
||||
cy.contains('Add Product').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Product ' + testRun);
|
||||
cy.get('.modal input#code')
|
||||
.type('MENUBOARDPROD');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if menuboard is added in toast message
|
||||
cy.contains('Added Menu Board Product');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and edit existing product', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.log(menuId);
|
||||
cy.createMenuboardCat('Cypress Test Category ' + testRun, menuId).then((menuCatId) => {
|
||||
cy.log(menuCatId);
|
||||
cy.createMenuboardCatProd('Cypress Test Product ' + testRun, menuCatId).then((menuProdId) => {
|
||||
cy.log(menuProdId);
|
||||
cy.intercept({
|
||||
url: '/menuboard/' + menuCatId + '/products?*',
|
||||
query: {name: 'Cypress Test Product ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/menuboard/' + menuProdId + '/product',
|
||||
}).as('putRequest');
|
||||
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuCatId + '/products/view');
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Product ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoardProducts tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoardProducts tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoardProducts tr:first-child .menuBoardProduct_edit_button').click({force: true});
|
||||
|
||||
// EDIT
|
||||
cy.get('.modal input#name').clear()
|
||||
.type('Cypress Test Product Edited ' + testRun);
|
||||
|
||||
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 "menuboard" value
|
||||
expect(responseData.name).to.eq('Cypress Test Product Edited ' + testRun);
|
||||
});
|
||||
|
||||
// Delete the menuboard and assert success
|
||||
cy.deleteMenuboard(menuId).then((response) => {
|
||||
expect(response.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('searches and delete existing product', function() {
|
||||
// Create a new menuboard and then search for it and delete it
|
||||
cy.createMenuboard('Cypress Test Menuboard ' + testRun).then((menuId) => {
|
||||
cy.createMenuboardCat('Cypress Test Category ' + testRun, menuId).then((menuCatId) => {
|
||||
cy.createMenuboardCatProd('Cypress Test Product ' + testRun, menuCatId).then((menuProdId) => {
|
||||
cy.intercept({
|
||||
url: '/menuboard/' + menuCatId + '/products?*',
|
||||
query: {name: 'Cypress Test Product ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
// Intercept the PUT request
|
||||
cy.intercept({
|
||||
method: 'PUT',
|
||||
url: '/menuboard/' + menuProdId + '/product',
|
||||
}).as('putRequest');
|
||||
|
||||
// GO to products page
|
||||
cy.visit('/menuboard/' + menuCatId + '/products/view');
|
||||
// Filter for the created menuboard
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Product ' + testRun);
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
cy.get('#menuBoardProducts tbody tr').should('have.length', 1);
|
||||
|
||||
// Click on the first row element to open the delete modal
|
||||
cy.get('#menuBoardProducts tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#menuBoardProducts tr:first-child .menuBoardProduct_delete_button').click({force: true});
|
||||
|
||||
// Delete test menuboard
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Check toast message
|
||||
cy.get('.toast').contains('Deleted Cypress Test Product');
|
||||
|
||||
// Delete the menuboard and assert success
|
||||
cy.deleteMenuboard(menuId).then((response) => {
|
||||
expect(response.status).to.equal(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
41
cypress/e2e/Library/playlist_editor_empty.cy.js
Normal file
41
cypress/e2e/Library/playlist_editor_empty.cy.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
describe('Playlist Editor (Empty)', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
// Create random name
|
||||
let uuid = Cypress._.random(0, 1e9);
|
||||
|
||||
// Create a new layout and go to the layout's designer page
|
||||
cy.createNonDynamicPlaylist(uuid).as('testPlaylistId').then((res) => {
|
||||
cy.openPlaylistEditorAndLoadPrefs(res);
|
||||
});
|
||||
});
|
||||
|
||||
it('should show the droppable zone and toolbar', function() {
|
||||
|
||||
cy.get('#playlist-editor-container').should('be.visible');
|
||||
cy.get('div[class="container-toolbar container-fluid flex-column flex-column justify-content-between"]').should('be.visible');
|
||||
});
|
||||
});
|
||||
208
cypress/e2e/Library/playlist_editor_populated.cy.js
Normal file
208
cypress/e2e/Library/playlist_editor_populated.cy.js
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
describe('Playlist Editor (Populated)', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
// Create random name
|
||||
let uuid = Cypress._.random(0, 1e9);
|
||||
|
||||
// Create a new layout and go to the layout's designer page
|
||||
cy.createNonDynamicPlaylist(uuid).as('testPlaylistId').then((res) => {
|
||||
|
||||
// Populate playlist with some widgets and media
|
||||
cy.addWidgetToPlaylist(res, 'embedded', {
|
||||
name: 'Embedded Widget'
|
||||
});
|
||||
|
||||
cy.addMediaToLibrary("file/example.zip");
|
||||
|
||||
cy.addWidgetToPlaylist(res, 'clock', {
|
||||
name: 'Clock Widget'
|
||||
});
|
||||
|
||||
cy.openPlaylistEditorAndLoadPrefs(res);
|
||||
});
|
||||
});
|
||||
|
||||
it('changes and saves widget properties', () => {
|
||||
// Create and alias for reload widget
|
||||
// cy.intercept('GET','/playlist/widget/form/edit/*').as('reloadWidget');
|
||||
|
||||
// Select the first widget on timeline ( image )
|
||||
cy.get('#timeline-container [data-type="widget"]').first().click();
|
||||
|
||||
// Wait for the widget to load
|
||||
// cy.wait('@reloadWidget');
|
||||
|
||||
// Type the new name in the input
|
||||
cy.get('a[href="#advancedTab"]').click();
|
||||
cy.get('#properties-panel-form-container input[name="name"]').clear().type('newName');
|
||||
|
||||
// Set a duration
|
||||
cy.get('#properties-panel-form-container input[name="useDuration"]').check();
|
||||
cy.get('#properties-panel-form-container input[name="duration"]').clear().type(12);
|
||||
|
||||
// Save form
|
||||
cy.get('#properties-panel-form-container button[data-action="save"]').click();
|
||||
|
||||
// Should show a notification for the name change
|
||||
// cy.get('.toast-success');
|
||||
|
||||
// Wait for the widget to reload
|
||||
// cy.wait('@reloadWidget');
|
||||
|
||||
// Check if the values are the same entered after reload
|
||||
cy.get('#properties-panel-form-container input[name="name"]').should('have.prop', 'value').and('equal', 'newName');
|
||||
cy.get('#properties-panel-form-container input[name="duration"]').should('have.prop', 'value').and('equal', '12');
|
||||
|
||||
});
|
||||
|
||||
it.skip('should revert a saved form to a previous state', () => {
|
||||
|
||||
let oldName;
|
||||
|
||||
// Create and alias for reload widget
|
||||
// cy.intercept('GET', '/playlist/widget/form/edit/*').as('reloadWidget');
|
||||
// cy.intercept('PUT', '/playlist/widget/*').as('saveWidget');
|
||||
|
||||
// Select the first widget on timeline ( image )
|
||||
cy.get('#timeline-container [data-type="widget"]').first().click();
|
||||
|
||||
// Wait for the widget to load
|
||||
// cy.wait('@reloadWidget');
|
||||
|
||||
// Get the input field
|
||||
cy.get('a[href="#advancedTab"]').click();
|
||||
cy.get('#properties-panel-form-container input[name="name"]').then(($input) => {
|
||||
|
||||
// Save old name
|
||||
oldName = $input.val();
|
||||
|
||||
//Type the new name in the input
|
||||
cy.get('#properties-panel-form-container input[name="name"]').clear().type('newName');
|
||||
|
||||
// Save form
|
||||
cy.get('#properties-panel-form-container button[data-action="save"]').click();
|
||||
|
||||
// Should show a notification for the name change
|
||||
// cy.get('.toast-success');
|
||||
|
||||
// Wait for the widget to save
|
||||
// cy.wait('@reloadWidget');
|
||||
|
||||
// Click the revert button
|
||||
cy.get('#playlist-editor-toolbar #undoContainer').click();
|
||||
|
||||
// Wait for the widget to save
|
||||
// cy.wait('@saveWidget');
|
||||
|
||||
// Test if the revert made the name go back to the old name
|
||||
cy.get('#properties-panel-form-container input[name="name"]').should('have.prop', 'value').and('equal', oldName);
|
||||
});
|
||||
});
|
||||
|
||||
it('should delete a widget using the toolbar bin', () => {
|
||||
// cy.intercept('/playlist?playlistId=*').as('reloadPlaylist');
|
||||
|
||||
// Select a widget from the navigator
|
||||
cy.get('#playlist-timeline [data-type="widget"]').first().click().then(($el) => {
|
||||
|
||||
const widgetId = $el.attr('id');
|
||||
|
||||
// Click trash container
|
||||
cy.get('div[class="widgetDelete"]').first().click({force: true});
|
||||
|
||||
// Confirm delete on modal
|
||||
cy.get('button[class*="btn-bb-confirm"]').click();
|
||||
|
||||
// Check toast message
|
||||
// cy.get('.toast-success').contains('Deleted');
|
||||
|
||||
// Wait for the layout to reload
|
||||
// cy.wait('@reloadPlaylist');
|
||||
|
||||
// Check that widget is not on timeline
|
||||
cy.get('#playlist-timeline [data-type="widget"]#' + widgetId).should('not.exist');
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('should add an audio clip to a widget by the context menu, and adds a link to open the form in the timeline', () => {
|
||||
|
||||
cy.populateLibraryWithMedia();
|
||||
|
||||
// Create and alias for reload playlist
|
||||
cy.intercept('/playlist?playlistId=*').as('reloadPlaylist');
|
||||
|
||||
// Right click to open the context menu and select add audio
|
||||
cy.get('#timeline-container [data-type="widget"]').first().should('be.visible').rightclick();
|
||||
cy.get('.context-menu-btn[data-property="Audio"]').should('be.visible').click();
|
||||
|
||||
// Select the 1st option
|
||||
cy.get('[data-test="widgetPropertiesForm"] #mediaId > option').eq(1).then(($el) => {
|
||||
cy.get('[data-test="widgetPropertiesForm"] #mediaId').select($el.val());
|
||||
});
|
||||
|
||||
// Save and close the form
|
||||
cy.get('[data-test="widgetPropertiesForm"] .btn-bb-done').click();
|
||||
|
||||
// Check if the widget has the audio icon
|
||||
// cy.wait('@reloadPlaylist');
|
||||
cy.get('#timeline-container [data-type="widget"]:first-child')
|
||||
.find('i[data-property="Audio"]').should('exist').click({force: true});
|
||||
|
||||
cy.get('[data-test="widgetPropertiesForm"]').contains('Audio for');
|
||||
});
|
||||
|
||||
// Skip test for now ( it's failing in the test suite and being tested already in layout designer spec )
|
||||
it.skip('attaches expiry dates to a widget by the context menu, and adds a link to open the form in the timeline', () => {
|
||||
// Create and alias for reload playlist
|
||||
// cy.intercept('/playlist?playlistId=*').as('reloadPlaylist');
|
||||
|
||||
// Right click to open the context menu and select add audio
|
||||
cy.get('#timeline-container [data-type="widget"]').first().should('be.visible').rightclick();
|
||||
cy.get('.context-menu-btn[data-property="Expiry"]').should('be.visible').click();
|
||||
|
||||
// Add dates
|
||||
cy.get('[data-test="widgetPropertiesForm"] .starttime-control .date-clear-button').click();
|
||||
// cy.get('[data-test="widgetPropertiesForm"] #fromDt').find('input[class="datePickerHelper form-control dateControl dateTime active"]').click();
|
||||
cy.get('div[class="flatpickr-wrapper"]').first().click();
|
||||
cy.get('.flatpickr-calendar.open .dayContainer .flatpickr-day:first').click();
|
||||
|
||||
cy.get('[data-test="widgetPropertiesForm"] .endtime-control .date-clear-button').click();
|
||||
// cy.get('[data-test="widgetPropertiesForm"] #toDt').find('input[class="datePickerHelper form-control dateControl dateTime active"]').click();
|
||||
cy.get('div[class="flatpickr-wrapper"]').last().click();
|
||||
cy.get('.flatpickr-calendar.open .dayContainer .flatpickr-day:first').click();
|
||||
|
||||
|
||||
// Save and close the form
|
||||
cy.get('[data-test="widgetPropertiesForm"] .btn-bb-done').click();
|
||||
|
||||
// Check if the widget has the expiry dates icon
|
||||
// cy.wait('@reloadPlaylist');
|
||||
cy.get('#timeline-container [data-type="widget"]:first-child')
|
||||
.find('i[data-property="Expiry"]').should('exist').click({force: true});
|
||||
|
||||
cy.get('[data-test="widgetPropertiesForm"]').contains('Expiry for');
|
||||
});
|
||||
});
|
||||
110
cypress/e2e/Library/playlist_editor_populated_unchanged.cy.js
Normal file
110
cypress/e2e/Library/playlist_editor_populated_unchanged.cy.js
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
describe('Playlist Editor (Populated/Unchanged)', function() {
|
||||
|
||||
before(function() {
|
||||
cy.login();
|
||||
|
||||
// Create random name
|
||||
let uuid = Cypress._.random(0, 1e9);
|
||||
|
||||
// Create a new layout and go to the layout's designer page
|
||||
cy.createNonDynamicPlaylist(uuid).as('testPlaylistId').then((res) => {
|
||||
|
||||
// Populate playlist with some widgets and media
|
||||
cy.addWidgetToPlaylist(res, 'embedded', {
|
||||
name: 'Embedded Widget'
|
||||
});
|
||||
|
||||
// TODO skip so that the test success
|
||||
// cy.addRandomMediaToPlaylist(res);
|
||||
|
||||
cy.addWidgetToPlaylist(res, 'clock', {
|
||||
name: 'Clock Widget'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
cy.openPlaylistEditorAndLoadPrefs(this.testPlaylistId);
|
||||
});
|
||||
|
||||
it('opens a media tab in the toolbar and searches for items', () => {
|
||||
|
||||
// cy.intercept('/library/search?*').as('mediaLoad');
|
||||
|
||||
cy.populateLibraryWithMedia();
|
||||
|
||||
// Open audio tool tab
|
||||
cy.get('a[id="btn-menu-3"]').should('be.visible').click();
|
||||
|
||||
// cy.wait('@mediaLoad');
|
||||
|
||||
// Check if there are audio items in the search content
|
||||
cy.get('div[class="toolbar-card-preview"]').last().should('be.visible');
|
||||
});
|
||||
|
||||
it('creates a new widget by selecting a searched media from the toolbar to the editor, and then reverts the change', () => {
|
||||
cy.populateLibraryWithMedia();
|
||||
|
||||
// Create and alias for reload playlist
|
||||
// cy.intercept('/playlist?playlistId=*').as('reloadPlaylist');
|
||||
// cy.intercept('DELETE', '/playlist/widget/*').as('deleteWidget');
|
||||
// cy.intercept('/library/search?*').as('mediaLoad');
|
||||
|
||||
// Open library search tab
|
||||
cy.get('a[id="btn-menu-0"]').should('be.visible').click();
|
||||
|
||||
// cy.wait('@mediaLoad');
|
||||
cy.wait(1000);
|
||||
|
||||
// Get a table row, select it and add to the dropzone
|
||||
cy.get('div[class="toolbar-card ui-draggable ui-draggable-handle"]').eq(2).should('be.visible').click({force: true}).then(() => {
|
||||
cy.get('#timeline-overlay-container').click({force: true}).then(() => {
|
||||
|
||||
// Wait for the layout to reload
|
||||
// cy.wait('@reloadPlaylist');
|
||||
cy.wait(3000);
|
||||
|
||||
// Check if there is just one widget in the timeline
|
||||
cy.get('#timeline-container [data-type="widget"]').then(($widgets) => {
|
||||
expect($widgets.length).to.eq(3);
|
||||
});
|
||||
|
||||
// Click the revert button
|
||||
cy.get('#timeline-container [id^="widget_"]').last().click();
|
||||
cy.get('button[data-action="undo"]').click({force: true});
|
||||
|
||||
// Wait for the widget to be deleted and for the playlist to reload
|
||||
// cy.wait('@deleteWidget');
|
||||
// cy.wait('@reloadPlaylist');
|
||||
cy.wait(3000);
|
||||
|
||||
// Check if there is just one widget in the timeline
|
||||
cy.get('#timeline-container [data-type="widget"]').then(($widgets) => {
|
||||
expect($widgets.length).to.eq(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
107
cypress/e2e/Library/playlists.cy.js
Normal file
107
cypress/e2e/Library/playlists.cy.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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('Playlists Admin', function() {
|
||||
let testRun;
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
testRun = Cypress._.random(0, 1e9);
|
||||
});
|
||||
|
||||
it('should add a non-dynamic playlist', function() {
|
||||
cy.visit('/playlist/view');
|
||||
|
||||
// Click on the Add Playlist button
|
||||
cy.contains('Add Playlist').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Playlist ' + testRun);
|
||||
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Filter for the created playlist
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.type('Cypress Test Playlist ' + testRun);
|
||||
|
||||
// Should have the added playlist
|
||||
cy.get('#playlists tbody tr').should('have.length', 1);
|
||||
cy.get('#playlists tbody tr:nth-child(1) td:nth-child(2)').contains('Cypress Test Playlist ' + testRun);
|
||||
});
|
||||
|
||||
it('should cancel adding a non-dynamic playlist', function() {
|
||||
cy.visit('/playlist/view');
|
||||
|
||||
// Click on the Add Playlist button
|
||||
cy.contains('Add Playlist').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Playlist ' + testRun);
|
||||
|
||||
// Click cancel
|
||||
cy.get('#dialog_btn_1').click();
|
||||
|
||||
// Check if you are back to the view page
|
||||
cy.url().should('include', '/playlist/view');
|
||||
});
|
||||
|
||||
it('should show a list of Playlists', function() {
|
||||
// Wait for playlist grid reload
|
||||
cy.intercept('/playlist?draw=1&*').as('playlistGridLoad');
|
||||
|
||||
cy.visit('/playlist/view').then(function() {
|
||||
cy.wait('@playlistGridLoad');
|
||||
cy.get('#playlists');
|
||||
});
|
||||
});
|
||||
|
||||
it('selects multiple playlists and delete them', function() {
|
||||
// Create a new playlist and then search for it and delete it
|
||||
cy.createNonDynamicPlaylist('Cypress Test Playlist ' + testRun).then(() => {
|
||||
cy.intercept('/playlist?draw=2&*').as('playlistGridLoad');
|
||||
|
||||
// Delete all test playlists
|
||||
cy.visit('/playlist/view');
|
||||
|
||||
// Clear filter and search for text playlists
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.clear()
|
||||
.type('Cypress Test Playlist');
|
||||
|
||||
// Wait for 2nd playlist grid reload
|
||||
cy.wait('@playlistGridLoad');
|
||||
|
||||
// Select all
|
||||
cy.get('button[data-toggle="selectAll"]').click();
|
||||
|
||||
// Delete all
|
||||
cy.get('.dataTables_info button[data-toggle="dropdown"]').click({force: true});
|
||||
cy.get('.dataTables_info a[data-button-id="playlist_button_delete"]').click({force: true});
|
||||
|
||||
cy.get('button.save-button').click();
|
||||
|
||||
// Modal should contain one successful delete at least
|
||||
cy.get('.modal-body').contains(': Success');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user