diff --git a/awx/ui_next/package.json b/awx/ui_next/package.json index 9a67f2ef02..2da2fd955d 100644 --- a/awx/ui_next/package.json +++ b/awx/ui_next/package.json @@ -5,8 +5,8 @@ "main": "index.jsx", "scripts": { "start": "webpack-dev-server --config ./webpack.config.js --mode development", - "test": "jest --coverage", - "test-watch": "jest --watch", + "test": "TZ='UTC' jest --coverage", + "test-watch": "TZ='UTC' jest --watch", "lint": "eslint --ext .js --ext .jsx .", "add-locale": "lingui add-locale", "extract-strings": "lingui extract", diff --git a/awx/ui_next/src/screens/Job/JobOutput/JobEvent.test.jsx b/awx/ui_next/src/screens/Job/JobOutput/JobEvent.test.jsx index d413f53726..5377edbc58 100644 --- a/awx/ui_next/src/screens/Job/JobOutput/JobEvent.test.jsx +++ b/awx/ui_next/src/screens/Job/JobOutput/JobEvent.test.jsx @@ -24,12 +24,6 @@ const selectors = { lineText: 'JobEvent__JobEventLineText', }; -function tzHours(hours) { - const date = new Date(); - date.setUTCHours(hours); - return date.getHours(); -} - describe('', () => { test('initially renders successfully', () => { mountWithContexts(); @@ -39,7 +33,7 @@ describe('', () => { let wrapper = mountWithContexts(); let lineText = wrapper.find(selectors.lineText); expect( - lineText.filterWhere(e => e.html().includes(`${tzHours(18)}:11:22`)) + lineText.filterWhere(e => e.text().includes('18:11:22')) ).toHaveLength(1); const singleDigitTimestampEvent = { @@ -49,7 +43,7 @@ describe('', () => { wrapper = mountWithContexts(); lineText = wrapper.find(selectors.lineText); expect( - lineText.filterWhere(e => e.html().includes(`${tzHours(8)}:01:02`)) + lineText.filterWhere(e => e.text().includes('08:01:02')) ).toHaveLength(1); }); diff --git a/awx/ui_next/src/screens/Job/JobOutput/JobOutput.test.jsx b/awx/ui_next/src/screens/Job/JobOutput/JobOutput.test.jsx index 252416d580..7762efdb76 100644 --- a/awx/ui_next/src/screens/Job/JobOutput/JobOutput.test.jsx +++ b/awx/ui_next/src/screens/Job/JobOutput/JobOutput.test.jsx @@ -8,7 +8,7 @@ import mockJobEventsData from './data.job_events.json'; jest.mock('@api'); async function checkOutput(wrapper, expectedLines) { - await waitForElement(wrapper, 'div[type="job_event"]', e => e.length > 1); + await waitForElement(wrapper, 'div[type="job_event"]', el => el.length > 1); const jobEventLines = wrapper.find('div[type="job_event_line_text"]'); const actualLines = []; jobEventLines.forEach(line => { @@ -65,9 +65,9 @@ describe('', () => { await waitForElement(wrapper, 'JobEvent', el => el.length > 0); await checkOutput(wrapper, [ '', - 'PLAY [all] *********************************************************************11:37:25', + 'PLAY [all] *********************************************************************15:37:25', '', - 'TASK [debug] *******************************************************************11:37:25', + 'TASK [debug] *******************************************************************15:37:25', 'ok: [localhost] => (item=1) => {', ' "msg": "This is a debug message: 1"', '}', @@ -171,7 +171,7 @@ describe('', () => { 'handleScrollLast' ); wrapper = mountWithContexts(); - await waitForElement(wrapper, 'EmptyStateBody', e => e.length === 0); + await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); wrapper .find('JobOutput') .instance() @@ -190,7 +190,7 @@ describe('', () => { test('should throw error', async done => { JobsAPI.readEvents = () => Promise.reject(new Error()); wrapper = mountWithContexts(); - await waitForElement(wrapper, 'ContentError', e => e.length === 1); + await waitForElement(wrapper, 'ContentError', el => el.length === 1); done(); }); });