diff --git a/cypress/e2e/Display/datasets.cy.js b/cypress/e2e/Display/datasets.cy.js index d7a548235b..bdcd24530f 100644 --- a/cypress/e2e/Display/datasets.cy.js +++ b/cypress/e2e/Display/datasets.cy.js @@ -96,8 +96,95 @@ describe('Datasets', function() { }); }); - it('copy an existing dataset', function() { + 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(); + cy.get('#datasets tr:first-child .dataset_button_viewcolumns').click(); + + 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(); + cy.get('#datasets tr:first-child .dataset_button_delete').click(); + }); + }); + + + 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?*', @@ -124,7 +211,7 @@ describe('Datasets', function() { cy.get('#datasets tr:first-child .dropdown-toggle').click(); cy.get('#datasets tr:first-child .dataset_button_copy').click(); - // Delete test dataset + // save cy.get('.bootbox .save-button').click(); // Wait for the intercepted POST request and check the form data diff --git a/cypress/e2e/Display/dayparts.cy.js b/cypress/e2e/Display/dayparts.cy.js index 0666dbb57a..779b0aa7a8 100644 --- a/cypress/e2e/Display/dayparts.cy.js +++ b/cypress/e2e/Display/dayparts.cy.js @@ -50,12 +50,64 @@ describe('Dayparts', function() { cy.contains('Added Cypress Test Daypart ' + testRun + '_1'); }); - // TODO filter needed - it.skip('searches and delete existing daypart', function() { + it('searches and edit existing daypart', function() { + // Create a new daypart and then search for it and edit it + cy.createDayPart('Cypress Test Daypart ' + testRun).then((id) => { + cy.intercept({ + url: '/daypart?*', + query: {name: 'Cypress Test Daypart ' + testRun}, + }).as('loadGridAfterSearch'); + + // Intercept the PUT request + cy.intercept({ + method: 'PUT', + url: '/daypart/*', + }).as('putRequest'); + + cy.visit('/daypart/view'); + + // Filter for the created daypart + cy.get('#Filter input[name="name"]') + .type('Cypress Test Daypart ' + testRun); + + // Wait for the grid reload + cy.wait('@loadGridAfterSearch'); + cy.get('#dayparts tbody tr').should('have.length', 1); + + // Click on the first row element to open the delete modal + cy.get('#dayparts tr:first-child .dropdown-toggle').click(); + cy.get('#dayparts tr:first-child .daypart_button_edit').click(); + + cy.get('.modal input#name').clear() + .type('Cypress Test Daypart Edited ' + testRun); + + // edit test daypart + 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 "daypart" value + expect(responseData.name).to.eq('Cypress Test Daypart Edited ' + testRun); + }); + + // Delete the daypart and assert success + cy.deleteDayPart(id).then((res) => { + expect(res.status).to.equal(204); + }); + }); + }); + + it('searches and delete existing daypart', function() { // Create a new daypart and then search for it and delete it cy.createDayPart('Cypress Test Daypart ' + testRun).then((res) => { - cy.server(); - cy.route('/daypart?draw=2&*').as('daypartGridLoad'); + cy.intercept({ + url: '/daypart?*', + query: {name: 'Cypress Test Daypart ' + testRun}, + }).as('loadGridAfterSearch'); cy.visit('/daypart/view'); @@ -64,7 +116,8 @@ describe('Dayparts', function() { .type('Cypress Test Daypart ' + testRun); // Wait for the grid reload - cy.wait('@daypartGridLoad'); + cy.wait('@loadGridAfterSearch'); + cy.get('#dayparts tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#dayparts tr:first-child .dropdown-toggle').click(); @@ -78,14 +131,61 @@ describe('Dayparts', function() { }); }); - it.skip('selects multiple dayparts and delete them', function() { - // Create a new daypart and then search for it and delete it + it('searches and share existing daypart', function() { + // Create a new daypart and then search for it and share it cy.createDayPart('Cypress Test Daypart ' + testRun).then((res) => { cy.intercept({ url: '/daypart?*', query: {name: 'Cypress Test Daypart ' + testRun}, }).as('loadGridAfterSearch'); + cy.intercept({ + url: '/user/permissions/DayPart/*', + query: {name: 'Everyone'}, + }).as('loadPermissionDayPartAfterSearch'); + + cy.visit('/daypart/view'); + + // Filter for the created daypart + cy.get('#Filter input[name="name"]') + .type('Cypress Test Daypart ' + testRun); + + // Wait for the grid reload + cy.wait('@loadGridAfterSearch'); + cy.get('#dayparts tbody tr').should('have.length', 1); + + // Click on the first row element to open the delete modal + cy.get('#dayparts tr:first-child .dropdown-toggle').click(); + cy.get('#dayparts tr:first-child .daypart_button_permissions').click(); + + cy.get('.modal #name').type('Everyone'); + cy.wait('@loadPermissionDayPartAfterSearch'); + + cy.get('#permissionsTable').within(() => { + cy.get('tbody').find('tr').should('have.length', 1); + + cy.get('input[type="checkbox"][data-permission="view"]').should('be.visible').check().should('be.checked'); + + cy.wait(1000); // without this wait it does not work, so lets keep the 1s wait here + cy.get('input[type="checkbox"][data-permission="edit"]').check().should('be.checked'); + }); + + // Save + cy.get('.bootbox .save-button').click(); + + // Check if daypart is deleted in toast message + cy.get('.toast').contains('Share option Updated'); + }); + }); + + it('selects multiple dayparts and delete them', function() { + // Create a new daypart and then search for it and delete it + cy.createDayPart('Cypress Test Daypart ' + testRun).then((res) => { + cy.intercept({ + url: '/daypart?*', + query: {name: 'Cypress Test Daypart'}, + }).as('loadGridAfterSearch'); + // Delete all test dayparts cy.visit('/daypart/view'); @@ -104,7 +204,6 @@ describe('Dayparts', function() { cy.get('.dataTables_info button[data-toggle="dropdown"]').click(); cy.get('.dataTables_info a[data-button-id="daypart_button_delete"]').click(); - cy.get('input#deleteData').check(); cy.get('button.save-button').click(); // Modal should contain one successful delete at least diff --git a/cypress/e2e/Display/displaygroups.cy.js b/cypress/e2e/Display/displaygroups.cy.js index a1fd376144..1fa946bd1c 100644 --- a/cypress/e2e/Display/displaygroups.cy.js +++ b/cypress/e2e/Display/displaygroups.cy.js @@ -84,6 +84,7 @@ describe('Display Groups', function() { // 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(); @@ -118,6 +119,7 @@ describe('Display Groups', function() { // 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(); @@ -159,6 +161,7 @@ describe('Display Groups', function() { // 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(); @@ -237,6 +240,7 @@ describe('Display Groups', function() { // 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(); diff --git a/cypress/e2e/Display/syncgroups.cy.js b/cypress/e2e/Display/syncgroups.cy.js index 242b5a00b6..5a0a9f02b5 100644 --- a/cypress/e2e/Display/syncgroups.cy.js +++ b/cypress/e2e/Display/syncgroups.cy.js @@ -62,6 +62,7 @@ describe('Sync Groups', function() { // 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(); diff --git a/cypress/e2e/Layout/displaysettings.cy.js b/cypress/e2e/Layout/displaysettings.cy.js index b7159c8db6..7b1354ac79 100644 --- a/cypress/e2e/Layout/displaysettings.cy.js +++ b/cypress/e2e/Layout/displaysettings.cy.js @@ -105,6 +105,7 @@ describe('Display Settings', function() { // 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(); @@ -149,6 +150,7 @@ describe('Display Settings', function() { // 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(); diff --git a/cypress/e2e/Layout/tags.cy.js b/cypress/e2e/Layout/tags.cy.js index 44a0ba99e2..e87f50b4bf 100644 --- a/cypress/e2e/Layout/tags.cy.js +++ b/cypress/e2e/Layout/tags.cy.js @@ -67,6 +67,7 @@ describe('Tags', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#tags tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#tags tr:first-child .dropdown-toggle').click(); @@ -107,6 +108,7 @@ describe('Tags', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#tags tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#tags tr:first-child .dropdown-toggle').click(); diff --git a/cypress/e2e/Layout/transitions.cy.js b/cypress/e2e/Layout/transitions.cy.js index ed0bc641b9..e31f60ec16 100644 --- a/cypress/e2e/Layout/transitions.cy.js +++ b/cypress/e2e/Layout/transitions.cy.js @@ -25,7 +25,7 @@ describe('Transitions', function() { cy.login(); }); - it('should add edit an transition', function() { + it('should edit an transition', function() { // Intercept the PUT request cy.intercept({ method: 'PUT', @@ -33,6 +33,7 @@ describe('Transitions', function() { }).as('putRequest'); cy.visit('/transition/view'); + cy.get('#transitions tbody tr').should('have.length', 3); // Click on the first row element to open the delete modal cy.get('#transitions tr:first-child .dropdown-toggle').click(); diff --git a/cypress/e2e/Layout/usergroups.cy.js b/cypress/e2e/Layout/usergroups.cy.js index d20e66613b..d0c03c2183 100644 --- a/cypress/e2e/Layout/usergroups.cy.js +++ b/cypress/e2e/Layout/usergroups.cy.js @@ -67,6 +67,7 @@ describe('Usergroups', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#userGroups tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#userGroups tr:first-child .dropdown-toggle').click(); @@ -111,6 +112,7 @@ describe('Usergroups', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#userGroups tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#userGroups tr:first-child .dropdown-toggle').click(); diff --git a/cypress/e2e/Layout/users.cy.js b/cypress/e2e/Layout/users.cy.js index 67475c6cf2..ba4ab7e72c 100644 --- a/cypress/e2e/Layout/users.cy.js +++ b/cypress/e2e/Layout/users.cy.js @@ -50,6 +50,7 @@ describe('Users', function() { .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') @@ -84,6 +85,7 @@ describe('Users', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#users tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#users tr:first-child .dropdown-toggle').click(); @@ -128,6 +130,7 @@ describe('Users', function() { // Wait for the grid reload cy.wait('@loadGridAfterSearch'); + cy.get('#users tbody tr').should('have.length', 1); // Click on the first row element to open the delete modal cy.get('#users tr:first-child .dropdown-toggle').click(); diff --git a/cypress/e2e/displays.cy.js b/cypress/e2e/displays.cy.js index 1670982e2d..4d54135061 100644 --- a/cypress/e2e/displays.cy.js +++ b/cypress/e2e/displays.cy.js @@ -36,7 +36,7 @@ describe('Displays', function() { // search for a display disp1 and edit cy.intercept({ url: '/display?*', - query: {display: 'disp1'}, + query: {display: 'dis_disp1'}, }).as('loadGridAfterSearch'); // Intercept the PUT request @@ -49,7 +49,7 @@ describe('Displays', function() { // Filter for the created display cy.get('#Filter input[name="display"]') - .type('disp1'); + .type('dis_disp1'); // Wait for the grid reload cy.wait('@loadGridAfterSearch'); @@ -59,14 +59,14 @@ describe('Displays', function() { cy.get('#displays tr:first-child .dropdown-toggle').click(); cy.get('#displays tr:first-child .display_button_edit').click(); - cy.get('.modal input#name').clear() - .type('disp1 Edited'); + cy.get('.modal input#display').clear() + .type('dis_disp1 Edited'); cy.get('.modal input#license').clear() - .type('disp1_license'); + .type('dis_disp1_license'); cy.get('.modal input#description').clear() - .type('disp1 description'); + .type('description'); // edit test display cy.get('.bootbox .save-button').click(); @@ -78,9 +78,9 @@ describe('Displays', function() { const responseData = response.body.data; // assertion on the "display" value - expect(responseData.display).to.eq('disp1 Edited'); - expect(responseData.description).to.eq('disp1 description'); - expect(responseData.license).to.eq('disp1_license'); + expect(responseData.display).to.eq('dis_disp1 Edited'); + expect(responseData.description).to.eq('description'); + expect(responseData.license).to.eq('dis_disp1_license'); }); }); @@ -88,14 +88,14 @@ describe('Displays', function() { it('searches and delete existing display', function() { cy.intercept({ url: '/display?*', - query: {display: 'disp2'}, + query: {display: 'dis_disp2'}, }).as('loadGridAfterSearch'); cy.visit('/display/view'); // Filter for the created display cy.get('#Filter input[name="display"]') - .type('disp2'); + .type('dis_disp2'); // Wait for the grid reload cy.wait('@loadGridAfterSearch'); @@ -109,28 +109,28 @@ describe('Displays', function() { cy.get('.bootbox .save-button').click(); // Check if display is deleted in toast message - cy.get('.toast').contains('Deleted disp2'); + cy.get('.toast').contains('Deleted dis_disp2'); }); // Display: disp3 - it('searches and authorise an unauthorised display', function() { + it.only('searches and authorise an unauthorised display', function() { // search for a display disp1 and edit cy.intercept({ url: '/display?*', - query: {display: 'disp3'}, + query: {display: 'dis_disp3'}, }).as('loadGridAfterSearch'); // Intercept the PUT request cy.intercept({ method: 'PUT', - url: '/display/*', + url: '/display/authorise/*', }).as('putRequest'); cy.visit('/display/view'); // Filter for the created display cy.get('#Filter input[name="display"]') - .type('disp3'); + .type('dis_disp3'); // Wait for the grid reload cy.wait('@loadGridAfterSearch'); @@ -147,11 +147,8 @@ describe('Displays', function() { 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('disp3'); - expect(responseData.licensed).to.eq(1); + // assertion + expect(response.body.message).to.eq('Authorised set to 1 for dis_disp3'); }); }); @@ -159,7 +156,7 @@ describe('Displays', function() { it('set a default layout', function() { cy.intercept({ url: '/display?*', - query: {display: 'disp4'}, + query: {display: 'dis_disp4'}, }).as('loadGridAfterSearch'); // Intercept the PUT request @@ -179,7 +176,7 @@ describe('Displays', function() { // Filter for the created display cy.get('#Filter input[name="display"]') - .type('disp4'); + .type('dis_disp4'); // Wait for the grid reload cy.wait('@loadGridAfterSearch'); @@ -212,7 +209,7 @@ describe('Displays', function() { it('manage membership for disp5', function() { cy.intercept({ url: '/display?*', - query: {display: 'disp5'}, + query: {display: 'dis_disp5'}, }).as('loadGridAfterSearch'); // Intercept the PUT request @@ -232,7 +229,7 @@ describe('Displays', function() { // Filter for the created display cy.get('#Filter input[name="display"]') - .type('disp5'); + .type('dis_disp5'); // Wait for the grid reload cy.wait('@loadGridAfterSearch'); @@ -263,7 +260,7 @@ describe('Displays', function() { }); }); - it.only('should display map and revert back to table', function() { + it('should display map and revert back to table', function() { cy.visit('/display/view'); cy.get('#displays_wrapper.dataTables_wrapper').should('be.visible'); diff --git a/cypress/e2e/layout_designer_empty.cy.js b/cypress/e2e/layout_designer_empty.cy.js index 66f9d19c7e..ba46be7b47 100644 --- a/cypress/e2e/layout_designer_empty.cy.js +++ b/cypress/e2e/layout_designer_empty.cy.js @@ -19,162 +19,148 @@ * along with Xibo. If not, see . */ +/* eslint-disable max-len */ describe('Layout Designer (Empty)', function() { - - beforeEach(function() { - cy.login(); + beforeEach(function() { + cy.login(); + }); + + context('Unexisting Layout', function() { + it('show layout not found if layout does not exist', function() { + // Use a huge id to test a layout not found + cy.visit({ + url: '/layout/designer/111111111111', + failOnStatusCode: false, + }); + + // See page not found message + cy.contains('Layout not found'); }); + }); - context('Unexisting Layout', function() { - - it('show layout not found if layout does not exist', function() { + context('Empty layout (published)', function() { + const layoutTempName = ''; - // Use a huge id to test a layout not found - cy.visit({ - url: '/layout/designer/111111111111', - failOnStatusCode: false - }); - - // See page not found message - cy.contains('Layout not found'); - }); + beforeEach(function() { + // Import a layout and go to the Layout's designer page - we need a Layout in a Published state + cy.importLayout('../assets/export_test_layout.zip').as('testLayoutId').then((res) => { + cy.goToLayoutAndLoadPrefs(res); + }); }); - context('Empty layout (published)', function() { - - var layoutTempName = ''; - - beforeEach(function() { - - // Import a layout and go to the Layout's designer page - we need a Layout in a Published state - cy.importLayout('../assets/export_test_layout.zip').as('testLayoutId').then((res) => { - - cy.goToLayoutAndLoadPrefs(res); - }); - - }); - - it.skip('goes into draft mode when checked out', function() { - - // Get the done button from the checkout modal - cy.get('[data-test="welcomeModal"] button.btn-bb-checkout').click(); - - // Check if campaign is deleted in toast message - cy.contains('Checked out ' + layoutTempName); - }); - - it.skip('should prevent a layout edit action, and show a toast message', function() { + it.skip('goes into draft mode when checked out', function() { + // Get the done button from the checkout modal + cy.get('[data-test="welcomeModal"] button.btn-bb-checkout').click(); - // Should contain widget options form - cy.get('#properties-panel-form-container').contains('Edit Layout'); - - // The save button should not be visible - cy.get('#properties-panel-form-container [data-action="save"]').should('not.exist'); - }); + // Check if campaign is deleted in toast message + cy.contains('Checked out ' + layoutTempName); }); - context('Empty layout (draft)', function() { - - beforeEach(function() { - // Create random name - let uuid = Cypress._.random(0, 1e9); - - // Create a new layout and go to the layout's designer page, then load toolbar prefs - cy.createLayout(uuid).as('testLayoutId').then((res) => { + it.skip('should prevent a layout edit action, and show a toast message', function() { + // Should contain widget options form + cy.get('#properties-panel-form-container').contains('Edit Layout'); - cy.goToLayoutAndLoadPrefs(res); - }); - }); - - it.skip('should create a new region from within the navigator edit', () => { - // Open navigator edit - cy.get('.editor-bottom-bar #navigator-edit-btn').click(); + // The save button should not be visible + cy.get('#properties-panel-form-container [data-action="save"]').should('not.exist'); + }); + }); - // Click on add region button - cy.get('.editor-bottom-bar #add-btn').click(); + context('Empty layout (draft)', function() { + beforeEach(function() { + // Create random name + const uuid = Cypress._.random(0, 1e9); - // Check if there are 2 regions in the timeline ( there was 1 by default ) - cy.get('#layout-timeline [data-type="region"]').should('have.length', 2); - }); + // Create a new layout and go to the layout's designer page, then load toolbar prefs + cy.createLayout(uuid).as('testLayoutId').then((res) => { + cy.goToLayoutAndLoadPrefs(res); + }); + }); - it.skip('should delete a region using the toolbar bin', () => { - cy.server(); - cy.route('/layout?layoutId=*').as('reloadLayout'); + it.skip('should create a new region from within the navigator edit', () => { + // Open navigator edit + cy.get('.editor-bottom-bar #navigator-edit-btn').click(); - // Open navigator edit - cy.get('.editor-bottom-bar #navigator-edit-btn').click(); + // Click on add region button + cy.get('.editor-bottom-bar #add-btn').click(); - // Select a region from the navigator - cy.get('#layout-navigator-content [data-type="region"]:first-child').click().then(($el) => { + // Check if there are 2 regions in the timeline ( there was 1 by default ) + cy.get('#layout-timeline [data-type="region"]').should('have.length', 2); + }); - const regionId = $el.attr('id'); + it.skip('should delete a region using the toolbar bin', () => { + cy.server(); + cy.route('/layout?layoutId=*').as('reloadLayout'); - // Click trash container - cy.get('.editor-bottom-bar #delete-btn').click(); + // Open navigator edit + cy.get('.editor-bottom-bar #navigator-edit-btn').click(); - // Confirm delete on modal - cy.get('[data-test="deleteObjectModal"] button.btn-bb-confirm').click(); + // Select a region from the navigator + cy.get('#layout-navigator-content [data-type="region"]:first-child').click().then(($el) => { + const regionId = $el.attr('id'); - // Check toast message - cy.get('.toast-success').contains('Deleted'); + // Click trash container + cy.get('.editor-bottom-bar #delete-btn').click(); - // Wait for the layout to reload - cy.wait('@reloadLayout'); + // Confirm delete on modal + cy.get('[data-test="deleteObjectModal"] button.btn-bb-confirm').click(); - // Check that region is not on timeline - cy.get('#layout-timeline [data-type="region"]#' + regionId).should('not.exist'); - }); - }); + // Check toast message + cy.get('.toast-success').contains('Deleted'); - it.skip('creates a new widget by selecting a searched media from the toolbar to layout-navigator region', () => { + // Wait for the layout to reload + cy.wait('@reloadLayout'); - cy.populateLibraryWithMedia(); + // Check that region is not on timeline + cy.get('#layout-timeline [data-type="region"]#' + regionId).should('not.exist'); + }); + }); - // Create and alias for reload Layout - cy.server(); - cy.route('/layout?layoutId=*').as('reloadLayout'); - cy.route('/library/search?*').as('mediaLoad'); + it.skip('creates a new widget by selecting a searched media from the toolbar to layout-navigator region', () => { + cy.populateLibraryWithMedia(); - // Open library search tab - cy.get('.editor-main-toolbar #btn-menu-0').should('be.visible').click({force: true}); - cy.get('.editor-main-toolbar #btn-menu-1').should('be.visible').click({force: true}); + // Create and alias for reload Layout + cy.server(); + cy.route('/layout?layoutId=*').as('reloadLayout'); + cy.route('/library/search?*').as('mediaLoad'); - cy.wait('@mediaLoad'); + // Open library search tab + cy.get('.editor-main-toolbar #btn-menu-0').should('be.visible').click({force: true}); + cy.get('.editor-main-toolbar #btn-menu-1').should('be.visible').click({force: true}); - cy.get('.editor-bottom-bar #navigator-edit-btn').click({force: true}); + cy.wait('@mediaLoad'); - cy.get('.editor-main-toolbar #media-content-1 .toolbar-card:nth-of-type(2)').find("img").should('be.visible'); + cy.get('.editor-bottom-bar #navigator-edit-btn').click({force: true}); - // Get a table row, select it and add to the region - cy.get('.editor-main-toolbar #media-content-1 .toolbar-card:nth-of-type(2) .select-button').click({force: true}).then(() => { - cy.get('#layout-navigator [data-type="region"]:first-child').click().then(() => { + cy.get('.editor-main-toolbar #media-content-1 .toolbar-card:nth-of-type(2)').find('img').should('be.visible'); - // Wait for the layout to reload - cy.wait('@reloadLayout'); + // Get a table row, select it and add to the region + cy.get('.editor-main-toolbar #media-content-1 .toolbar-card:nth-of-type(2) .select-button').click({force: true}).then(() => { + cy.get('#layout-navigator [data-type="region"]:first-child').click().then(() => { + // Wait for the layout to reload + cy.wait('@reloadLayout'); - // Check if there is just one widget in the timeline - cy.get('#layout-timeline [data-type="region"] [data-type="widget"]').then(($widgets) => { - expect($widgets.length).to.eq(1); - }); - }); - }); + // Check if there is just one widget in the timeline + cy.get('#layout-timeline [data-type="region"] [data-type="widget"]').then(($widgets) => { + expect($widgets.length).to.eq(1); + }); }); + }); + }); - it.skip('shows the file upload form by adding a uploadable media from the toolbar to layout-navigator region', () => { - - cy.populateLibraryWithMedia(); + it.skip('shows the file upload form by adding a uploadable media from the toolbar to layout-navigator region', () => { + cy.populateLibraryWithMedia(); - // Open toolbar Widgets tab - cy.get('.editor-main-toolbar #btn-menu-1').should('be.visible').click({force: true}); - cy.get('.editor-main-toolbar #btn-menu-2').should('be.visible').click({force: true}); + // Open toolbar Widgets tab + cy.get('.editor-main-toolbar #btn-menu-1').should('be.visible').click({force: true}); + cy.get('.editor-main-toolbar #btn-menu-2').should('be.visible').click({force: true}); - cy.get('.editor-bottom-bar #navigator-edit-btn').click(); + cy.get('.editor-bottom-bar #navigator-edit-btn').click(); - cy.get('.editor-main-toolbar #content-2 .toolbar-pane-content .toolbar-card.upload-card').should('be.visible').then(() => { - cy.get('.editor-main-toolbar #content-2 .toolbar-pane-content .toolbar-card.upload-card .select-upload').click({force: true}); - cy.get('#layout-navigator [data-type="region"]:first-child').click({force: true}); - cy.get('[data-test="uploadFormModal"]').contains('Upload media'); - }); - }); + cy.get('.editor-main-toolbar #content-2 .toolbar-pane-content .toolbar-card.upload-card').should('be.visible').then(() => { + cy.get('.editor-main-toolbar #content-2 .toolbar-pane-content .toolbar-card.upload-card .select-upload').click({force: true}); + cy.get('#layout-navigator [data-type="region"]:first-child').click({force: true}); + cy.get('[data-test="uploadFormModal"]').contains('Upload media'); + }); }); -}); \ No newline at end of file + }); +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 8c13a00c50..b88c55c73e 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -470,7 +470,22 @@ Cypress.Commands.add('createDayPart', function(name) { endTime: '02:00:00', }, }).then((res) => { - return res.body.id; + return res.body.dayPartId; + }); +}); + +// Delete DayPart +Cypress.Commands.add('deleteDayPart', function(id) { + cy.request({ + method: 'DELETE', + url: '/api/daypart/' + id, + form: true, + headers: { + Authorization: 'Bearer ' + Cypress.env('accessToken'), + }, + body: {}, + }).then((res) => { + return res; }); }); diff --git a/lib/XTR/SeedDatabaseTask.php b/lib/XTR/SeedDatabaseTask.php index ce6f2272d7..fb337d3866 100644 --- a/lib/XTR/SeedDatabaseTask.php +++ b/lib/XTR/SeedDatabaseTask.php @@ -216,11 +216,11 @@ private function createDisplays(): void 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], // Displays for displays.cy.js test - 'disp1' => ['license' => 'disp1', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], - 'disp2' => ['license' => 'disp2', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], - 'disp3' => ['license' => 'disp3', 'licensed' => false, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], - 'disp4' => ['license' => 'disp4', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], - 'disp5' => ['license' => 'disp5', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], + 'dis_disp1' => ['license' => 'dis_disp1', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], + 'dis_disp2' => ['license' => 'dis_disp2', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], + 'dis_disp3' => ['license' => 'dis_disp3', 'licensed' => false, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], + 'dis_disp4' => ['license' => 'dis_disp4', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], + 'dis_disp5' => ['license' => 'dis_disp5', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4], // Displays for displaygroups.cy.js test 'dispgrp_disp1' => ['license' => 'dispgrp_disp1', 'licensed' => true, 'clientType' => 'android', 'clientCode' => 400, 'clientVersion' => 4],