From 7a6733973cd1ef411121dfd6a90fe96132a2ef95 Mon Sep 17 00:00:00 2001 From: Thamara Andrade Date: Tue, 25 Oct 2022 01:01:47 -0300 Subject: [PATCH] test --- js/main-window.js | 1 - tests/main-window.js | 47 +++++++++++++++++++------------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/js/main-window.js b/js/main-window.js index cfe8f97ef..653c24c3e 100644 --- a/js/main-window.js +++ b/js/main-window.js @@ -132,7 +132,6 @@ function createWindow() // Emitted when the window is closed. mainWindow.on('close', (event) => { - app.quit(); const savedPreferences = getUserPreferences(); if (!app.isQuitting && savedPreferences['close-to-tray']) { diff --git a/tests/main-window.js b/tests/main-window.js index 508287726..1422a733e 100644 --- a/tests/main-window.js +++ b/tests/main-window.js @@ -103,52 +103,45 @@ describe('Application launch', function() log('Running test - Done'); }); - it('Change to Day View', async function() + it('Day View - Current, yesterday and tomorrow', async function() { log('Running test ' + this.test.title); const { client } = this.app; await client.waitUntilWindowLoaded(10000); + // Switch to Day View const switchViewBtn = await client.$('#switch-view'); await switchViewBtn.click(); - const headerDate = await client.$('#header-date'); - const headerDateText = await headerDate.getText(); + + // Check that changed to current day + let headerDate = await client.$('#header-date'); + let headerDateText = await headerDate.getText(); const today = new Date(); assert.equal(headerDateText, `${weekDay[today.getDay()]}, ${months[today.getMonth()]} ${today.getDate()}, ${today.getFullYear()}`); - log('Running test - Done'); - }); - it('Calendar change to pervious Day', async function() - { - log('Running test ' + this.test.title); - const { client } = this.app; - await client.waitUntilWindowLoaded(10000); - const switchViewBtn = await client.$('#switch-view'); - await switchViewBtn.click(); + // Check that prev day go back to yesterday const prevDay = await client.$('#prev-day'); prevDay.click(); - const headerDate = await client.$('#header-date'); - const headerDateText = await headerDate.getText(); - const today = new Date(); + headerDate = await client.$('#header-date'); + headerDateText = await headerDate.getText(); const previousDayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1); assert.equal(headerDateText, `${weekDay[previousDayDate.getDay()]}, ${months[previousDayDate.getMonth()]} ${previousDayDate.getDate()}, ${previousDayDate.getFullYear()}`); - log('Running test - Done'); - }); - it('Calendar change to next Day', async function() - { - log('Running test ' + this.test.title); - const { client } = this.app; - await client.waitUntilWindowLoaded(10000); - const switchViewBtn = await client.$('#switch-view'); - await switchViewBtn.click(); + // Back to current day + const currentDay = await client.$('#current-day'); + currentDay.click(); + headerDate = await client.$('#header-date'); + headerDateText = await headerDate.getText(); + assert.equal(headerDateText, `${weekDay[today.getDay()]}, ${months[today.getMonth()]} ${today.getDate()}, ${today.getFullYear()}`); + + // Check that next day go back to tomorrow const nextDay = await client.$('#next-day'); nextDay.click(); - const headerDate = await client.$('#header-date'); - const headerDateText = await headerDate.getText(); - const today = new Date(); + headerDate = await client.$('#header-date'); + headerDateText = await headerDate.getText(); const nextDayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1); assert.equal(headerDateText, `${weekDay[nextDayDate.getDay()]}, ${months[nextDayDate.getMonth()]} ${nextDayDate.getDate()}, ${nextDayDate.getFullYear()}`); + log('Running test - Done'); }); });