Initial Upload
This commit is contained in:
220
cypress/e2e/Schedule/dayparts.cy.js
Normal file
220
cypress/e2e/Schedule/dayparts.cy.js
Normal file
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* 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('Dayparts', function() {
|
||||
let testRun = '';
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
|
||||
testRun = Cypress._.random(0, 1e9);
|
||||
});
|
||||
|
||||
it('should add a daypart', function() {
|
||||
cy.visit('/daypart/view');
|
||||
|
||||
// Click on the Add Daypart button
|
||||
cy.contains('Add Daypart').click();
|
||||
|
||||
cy.get('.modal input#name')
|
||||
.type('Cypress Test Daypart ' + testRun + '_1');
|
||||
|
||||
cy.get(':nth-child(3) > .col-sm-10 > .input-group > .flatpickr-wrapper > .datePickerHelper').click();
|
||||
// cy.get('.open > .flatpickr-time > :nth-child(1) > .arrowUp').click();
|
||||
cy.get('.open > .flatpickr-time > :nth-child(1) > .numInput').type('8');
|
||||
cy.get(':nth-child(4) > .col-sm-10 > .input-group > .flatpickr-wrapper > .datePickerHelper').click();
|
||||
cy.get('.open > .flatpickr-time > :nth-child(1) > .numInput').type('17');
|
||||
|
||||
// Add first by clicking next
|
||||
cy.get('.modal .save-button').click();
|
||||
|
||||
// Check if daypart is added in toast message
|
||||
cy.contains('Added Cypress Test Daypart ' + testRun + '_1');
|
||||
});
|
||||
|
||||
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({force: true});
|
||||
cy.get('#dayparts tr:first-child .daypart_button_edit').click({force: true});
|
||||
|
||||
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.intercept({
|
||||
url: '/daypart?*',
|
||||
query: {name: 'Cypress Test Daypart ' + testRun},
|
||||
}).as('loadGridAfterSearch');
|
||||
|
||||
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({force: true});
|
||||
cy.get('#dayparts tr:first-child .daypart_button_delete').click({force: true});
|
||||
|
||||
// Delete test daypart
|
||||
cy.get('.bootbox .save-button').click();
|
||||
|
||||
// Check if daypart is deleted in toast message
|
||||
cy.get('.toast').contains('Deleted Cypress Test Daypart');
|
||||
});
|
||||
});
|
||||
|
||||
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({
|
||||
query: {name: 'Everyone'},
|
||||
url: /\/user\/permissions\/DayPart\/\d+\?draw=2/,
|
||||
}).as('draw2');
|
||||
|
||||
cy.intercept({
|
||||
query: {name: 'Everyone'},
|
||||
url: /\/user\/permissions\/DayPart\/\d+\?draw=3/,
|
||||
}).as('draw3');
|
||||
|
||||
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({force: true});
|
||||
cy.get('#dayparts tr:first-child .daypart_button_permissions').click({force: true});
|
||||
|
||||
cy.get('.modal #name').type('Everyone');
|
||||
cy.wait('@draw2');
|
||||
cy.get('#permissionsTable tbody tr').should('have.length', 1);
|
||||
|
||||
cy.get('#permissionsTable').within(() => {
|
||||
cy.get('input[type="checkbox"][data-permission="view"]').should('be.visible').check();
|
||||
|
||||
// DOM is refreshed at this point, so wait for it
|
||||
cy.wait('@draw3');
|
||||
// We have no other option but to put {force: true} here
|
||||
cy.get('input[type="checkbox"][data-permission="edit"]').check();
|
||||
});
|
||||
|
||||
// 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');
|
||||
|
||||
// Clear filter
|
||||
cy.get('#Filter input[name="name"]')
|
||||
.clear()
|
||||
.type('Cypress Test Daypart');
|
||||
|
||||
// Wait for the grid reload
|
||||
cy.wait('@loadGridAfterSearch');
|
||||
|
||||
// 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="daypart_button_delete"]').click();
|
||||
|
||||
cy.get('button.save-button').click();
|
||||
|
||||
// Modal should contain one successful delete at least
|
||||
cy.get('.modal-body').contains(': Success');
|
||||
});
|
||||
});
|
||||
});
|
||||
392
cypress/e2e/Schedule/schedule.cy.js
Normal file
392
cypress/e2e/Schedule/schedule.cy.js
Normal file
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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('Schedule Events', function() {
|
||||
// Seeded Data
|
||||
const campaignSchedule1 = 'Campaign for Schedule 1';
|
||||
const layoutSchedule1 = 'Layout for Schedule 1';
|
||||
|
||||
const display1 = 'List Campaign Display 1';
|
||||
const display2 = 'List Campaign Display 2';
|
||||
const command1 = 'Set Timezone';
|
||||
|
||||
beforeEach(function() {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it('should list all scheduled events', function() {
|
||||
// Make a GET request to the API endpoint '/schedule/data/events'??
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/schedule/data/events',
|
||||
}).then((response) => {
|
||||
// Assertions on the response
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.have.property('result');
|
||||
});
|
||||
});
|
||||
|
||||
// TC-01
|
||||
it('should schedule an event layout that has no priority, no recurrence', function() {
|
||||
cy.intercept('GET', '/schedule/form/add?*').as('scheduleAddForm');
|
||||
|
||||
// Set up intercepts with aliases
|
||||
cy.intercept({
|
||||
url: '/display?start=*',
|
||||
query: {display: display1},
|
||||
}).as('loadDisplayAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/displaygroup?*',
|
||||
query: {displayGroup: display1},
|
||||
}).as('loadDisplaygroupAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/campaign?type=list*',
|
||||
query: {name: layoutSchedule1},
|
||||
}).as('loadListCampaignsAfterSearch');
|
||||
|
||||
// Click on the Add Event button
|
||||
cy.visit('/schedule/view');
|
||||
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
cy.contains('Add Event').click();
|
||||
|
||||
cy.get('.bootbox.modal')
|
||||
.should('be.visible') // essential: Ensure the modal is visible
|
||||
.then(() => {
|
||||
cy.get('.modal-content #eventTypeId').select('Layout');
|
||||
// Select layout
|
||||
cy.selectFromDropdown('.layout-control .select2-selection', layoutSchedule1, layoutSchedule1, '@loadListCampaignsAfterSearch');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select display
|
||||
cy.selectFromDropdown('.display-group-control .select2-selection', display1, display1, '@loadDisplaygroupAfterSearch', 1);
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select day part and set name
|
||||
cy.get('.modal-content [name="dayPartId"]').select('Always');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
cy.get('.modal-content [name="name"]').type('Always - Layout Event');
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Finish').click();
|
||||
|
||||
cy.contains('Added Event');
|
||||
});
|
||||
|
||||
// Validate - schedule creation should be successful
|
||||
cy.visit('/schedule/view');
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
|
||||
cy.get('#DisplayList + span .select2-selection').click();
|
||||
|
||||
// Type the display name
|
||||
cy.get('.select2-container--open textarea[type="search"]').type(display1);
|
||||
|
||||
// Wait for Display to load
|
||||
cy.wait('@loadDisplayAfterSearch');
|
||||
cy.get('.select2-container--open').contains(display1);
|
||||
cy.get('.select2-container--open .select2-results > ul > li').should('have.length', 1);
|
||||
|
||||
// Select the display from the dropdown
|
||||
cy.get('.select2-container--open .select2-results > ul > li:first').contains(display1).click();
|
||||
|
||||
// Verify that the schedule is successfully created and listed in the grid
|
||||
cy.get('#schedule-grid').contains(layoutSchedule1);
|
||||
|
||||
// Should have 1
|
||||
cy.get('#schedule-grid tbody tr').should('have.length', 1);
|
||||
});
|
||||
|
||||
// relies on TC-01
|
||||
it('should edit a scheduled event', function() {
|
||||
cy.intercept('GET', '/schedule/form/add?*').as('scheduleAddForm');
|
||||
|
||||
// Set up intercepts with aliases
|
||||
cy.intercept({
|
||||
url: '/display?start=*',
|
||||
query: {display: display1},
|
||||
}).as('loadDisplayAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/displaygroup?*',
|
||||
query: {displayGroup: display2},
|
||||
}).as('loadDisplaygroupAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/campaign?type=list*',
|
||||
query: {name: layoutSchedule1},
|
||||
}).as('loadListCampaignsAfterSearch');
|
||||
|
||||
// Click on the Add Event button
|
||||
cy.visit('/schedule/view');
|
||||
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
|
||||
cy.get('#DisplayList + span .select2-selection').click();
|
||||
|
||||
// Type the display name
|
||||
cy.get('.select2-container--open textarea[type="search"]').type(display1);
|
||||
|
||||
// Wait for Display to load
|
||||
cy.wait('@loadDisplayAfterSearch');
|
||||
cy.get('.select2-container--open').contains(display1);
|
||||
cy.get('.select2-container--open .select2-results > ul > li').should('have.length', 1);
|
||||
|
||||
// Select the display from the dropdown
|
||||
cy.get('.select2-container--open .select2-results > ul > li:first').contains(display1).click();
|
||||
|
||||
// Verify that the schedule is successfully created and listed in the grid
|
||||
cy.get('#schedule-grid').contains(layoutSchedule1);
|
||||
|
||||
// Should have 1
|
||||
cy.get('#schedule-grid tbody tr').should('have.length', 1);
|
||||
cy.get('#schedule-grid tr:first-child .dropdown-toggle').click({force: true});
|
||||
cy.get('#schedule-grid tr:first-child .schedule_button_edit').click({force: true});
|
||||
|
||||
cy.contains('.stepwizard-step', 'Displays')
|
||||
.find('a')
|
||||
.click();
|
||||
|
||||
// Select display
|
||||
cy.get('.display-group-control > .col-sm-10 > .select2 > .selection > .select2-selection').type(display2);
|
||||
// Wait for the display group to load after search
|
||||
cy.wait('@loadDisplaygroupAfterSearch');
|
||||
cy.get('.select2-container--open .select2-dropdown .select2-results > ul')
|
||||
.should('contain', display2);
|
||||
cy.get('.select2-container--open .select2-dropdown .select2-results > ul > li')
|
||||
.should('have.length', 2)
|
||||
.last()
|
||||
.click();
|
||||
|
||||
cy.contains('.stepwizard-step', 'Optional')
|
||||
.find('a')
|
||||
.click();
|
||||
|
||||
cy.get('.modal-content [name="name"]').clear().type('Always - Layout Event Edited');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Save').click();
|
||||
cy.contains('Edited Event');
|
||||
});
|
||||
|
||||
it('should schedule an event campaign that has no priority, no recurrence', function() {
|
||||
cy.intercept('GET', '/schedule/form/add?*').as('scheduleAddForm');
|
||||
|
||||
// Set up intercepts with aliases
|
||||
cy.intercept({
|
||||
url: '/display?start=*',
|
||||
query: {display: display1},
|
||||
}).as('loadDisplayAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/displaygroup?*',
|
||||
query: {displayGroup: display1},
|
||||
}).as('loadDisplaygroupAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/campaign?type=list*',
|
||||
query: {name: campaignSchedule1},
|
||||
}).as('loadListCampaignsAfterSearch');
|
||||
|
||||
// Visit the page and click on the Add Event button
|
||||
cy.visit('/schedule/view');
|
||||
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
cy.contains('Add Event').click();
|
||||
|
||||
cy.get('.bootbox.modal')
|
||||
.should('be.visible') // essential: Ensure the modal is visible
|
||||
.then(() => {
|
||||
cy.get('.modal-content #eventTypeId').select('Campaign');
|
||||
// Select campaign
|
||||
cy.selectFromDropdown('.layout-control .select2-selection', campaignSchedule1, campaignSchedule1, '@loadListCampaignsAfterSearch');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select display
|
||||
cy.selectFromDropdown('.display-group-control .select2-selection', display1, display1, '@loadDisplaygroupAfterSearch', 1);
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select day part and campaign
|
||||
cy.get('.modal-content [name="dayPartId"]').select('Always');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
cy.get('.modal-content [name="name"]').type('Always - Campaign Event');
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Finish').click();
|
||||
|
||||
cy.contains('Added Event');
|
||||
});
|
||||
|
||||
// Validate - schedule creation should be successful
|
||||
cy.visit('/schedule/view');
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
|
||||
cy.get('#DisplayList + span .select2-selection').click();
|
||||
|
||||
// Type the display name
|
||||
cy.get('.select2-container--open textarea[type="search"]').type(display1);
|
||||
|
||||
// Wait for Display to load
|
||||
cy.wait('@loadDisplayAfterSearch');
|
||||
cy.get('.select2-container--open').contains(display1);
|
||||
cy.get('.select2-container--open .select2-results > ul > li').should('have.length', 1);
|
||||
|
||||
// Select the display from the dropdown
|
||||
cy.get('.select2-container--open .select2-results > ul > li:first').contains(display1).click();
|
||||
|
||||
// Verify that the schedule is successfully created and listed in the grid
|
||||
cy.get('#schedule-grid').contains(campaignSchedule1);
|
||||
});
|
||||
|
||||
it('should schedule an event command layout that has no priority, no recurrence', function() {
|
||||
cy.intercept('GET', '/schedule/form/add?*').as('scheduleAddForm');
|
||||
cy.intercept({
|
||||
url: '/displaygroup?*',
|
||||
query: {displayGroup: display1},
|
||||
}).as('loadDisplaygroupAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/command?*',
|
||||
query: {command: command1},
|
||||
}).as('loadCommandAfterSearch');
|
||||
|
||||
// Click on the Add Event button
|
||||
cy.visit('/schedule/view');
|
||||
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
cy.contains('Add Event').click();
|
||||
|
||||
cy.get('.bootbox.modal')
|
||||
.should('be.visible') // essential: Ensure the modal is visible
|
||||
.then(() => {
|
||||
cy.get('.modal-content #eventTypeId').select('Command');
|
||||
// Select command
|
||||
cy.selectFromDropdown('.command-control .select2-selection', command1, command1, '@loadCommandAfterSearch');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select display
|
||||
cy.selectFromDropdown('.display-group-control .select2-selection', display1, display1, '@loadDisplaygroupAfterSearch', 1);
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
cy.get('.starttime-control > .col-sm-10 > .input-group > .flatpickr-wrapper > .datePickerHelper').click();
|
||||
cy.get('.open > .flatpickr-innerContainer > .flatpickr-rContainer > .flatpickr-days > .dayContainer > .today').click();
|
||||
cy.get('.open > .flatpickr-time > :nth-child(3) > .arrowUp').click();
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
cy.get('.modal-content [name="name"]').type('Custom - Command Event');
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Finish').click();
|
||||
});
|
||||
});
|
||||
|
||||
it('should schedule an event overlay layout that has no priority, no recurrence', function() {
|
||||
cy.intercept('GET', '/schedule/form/add?*').as('scheduleAddForm');
|
||||
cy.intercept({
|
||||
url: '/displaygroup?*',
|
||||
query: {displayGroup: display1},
|
||||
}).as('loadDisplaygroupAfterSearch');
|
||||
|
||||
cy.intercept({
|
||||
url: '/campaign?type=list*',
|
||||
query: {name: layoutSchedule1},
|
||||
}).as('loadListCampaignsAfterSearch');
|
||||
|
||||
// Click on the Add Event button
|
||||
cy.visit('/schedule/view');
|
||||
|
||||
cy.contains('Clear Filters').should('be.visible').click();
|
||||
cy.contains('Add Event').click();
|
||||
|
||||
cy.get('.bootbox.modal')
|
||||
.should('be.visible') // essential: Ensure the modal is visible
|
||||
.then(() => {
|
||||
cy.get('.modal-content #eventTypeId').select('Overlay Layout');
|
||||
// Select layout
|
||||
cy.selectFromDropdown('.layout-control .select2-selection', layoutSchedule1, layoutSchedule1, '@loadListCampaignsAfterSearch');
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select display
|
||||
cy.selectFromDropdown('.display-group-control .select2-selection', display1, display1, '@loadDisplaygroupAfterSearch', 1);
|
||||
|
||||
// Click Next and check toast message
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
|
||||
// Select daypart - custom
|
||||
cy.get('#dayPartId').select('Custom');
|
||||
|
||||
|
||||
cy.get('.starttime-control > .col-sm-10 > .input-group > .flatpickr-wrapper > .datePickerHelper')
|
||||
.click() // Open the picker
|
||||
.then(() => {
|
||||
// Select today's date
|
||||
cy.get('.flatpickr-calendar.open .flatpickr-days .dayContainer .today')
|
||||
.click();
|
||||
|
||||
// Increment the hour (adjust time)
|
||||
cy.get('.flatpickr-calendar.open .flatpickr-time :nth-child(3) .arrowUp')
|
||||
.click();
|
||||
|
||||
// Close the picker by clicking outside
|
||||
cy.get('body').click(0, 0);
|
||||
});
|
||||
|
||||
cy.get('.endtime-control > .col-sm-10 > .input-group > .flatpickr-wrapper > .datePickerHelper')
|
||||
.click() // Open the picker
|
||||
.then(() => {
|
||||
// Select today's date
|
||||
cy.get('.flatpickr-calendar.open .flatpickr-days .dayContainer .today')
|
||||
.click();
|
||||
|
||||
// Increment the hour (adjust time)
|
||||
cy.get('.flatpickr-calendar.open .flatpickr-time :nth-child(3) .arrowUp')
|
||||
.click()
|
||||
.click();
|
||||
|
||||
// Close the picker by clicking outside
|
||||
cy.get('body').click(0, 0);
|
||||
});
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Next').click();
|
||||
cy.get('.modal-content [name="name"]').type('Custom - Overlay Event');
|
||||
|
||||
cy.get('.modal .modal-footer').contains('Finish').click();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user