diff --git a/detox/test/e2e/17.datePicker.test.js b/detox/test/e2e/17.datePicker.test.js index f664941e67..131065b053 100644 --- a/detox/test/e2e/17.datePicker.test.js +++ b/detox/test/e2e/17.datePicker.test.js @@ -1,6 +1,7 @@ +const { describeNewArchNotSupported } = require('./utils/custom-describes'); const jestExpect = require('expect').default; -describe('DatePicker', () => { +describeNewArchNotSupported('DatePicker', () => { describe.each([ ['ios', 'compact', 0], ['ios', 'inline', 1], diff --git a/detox/test/e2e/17.picker.test.js b/detox/test/e2e/17.picker.test.js index 14e0f3a852..a6be677257 100644 --- a/detox/test/e2e/17.picker.test.js +++ b/detox/test/e2e/17.picker.test.js @@ -1,4 +1,6 @@ -describe(":ios: Picker", () => { +const { describeNewArchNotSupported } = require('./utils/custom-describes'); + +describeNewArchNotSupported(":ios: Picker", () => { beforeEach(async () => { await device.reloadReactNative(); await element(by.text("Picker")).tap(); diff --git a/detox/test/e2e/copilot/09.copilot.datepicker.test.js b/detox/test/e2e/copilot/09.copilot.datepicker.test.js index ad35350efd..d894508fa1 100644 --- a/detox/test/e2e/copilot/09.copilot.datepicker.test.js +++ b/detox/test/e2e/copilot/09.copilot.datepicker.test.js @@ -1,58 +1,60 @@ -const { describeForCopilotEnv } = require('../utils/custom-describes'); +const { describeForCopilotEnv, describeNewArchNotSupported } = require('../utils/custom-describes'); const { default: jestExpect } = require('expect'); -describeForCopilotEnv('DatePicker', () => { - beforeEach(async () => { - await copilot.perform( - 'Restart the React Native state', - 'Navigate to the DatePicker screen' - ); - }); - - describe('DatePicker Tests', () => { - - // Note: when writing "Date (UTC):" instead of "Date (UTC): " copilot failed the test - it('correct date and time', async () => { +describeNewArchNotSupported('DatePicker', () => { + describeForCopilotEnv('Copilot', () => { + beforeEach(async () => { await copilot.perform( - 'Verify there is element with the text "Date (UTC): "', - 'Verify the element value of current date UTC July 1st 2023', - 'Verify there is element with the text "Time (UTC): "', - 'Verify there is element with the text "Time Local: "', - 'Verify "Time Local: " value is 7:30 pm' + 'Restart the React Native state', + 'Navigate to the DatePicker screen' ); }); - it('compact date picker', async () => { - await copilot.perform( - 'Verify there is an element with the text "Compact Date Picker"', - 'Verify there is an element with today`s date at the bottom of the screen', - 'Set the date picker to September 9th, 2023' - ); - }); + describe('DatePicker Tests', () => { - it('inline date picker', async () => { - await copilot.perform( - 'Verify there is an element with the text "Compact Date Picker"', - 'Tap the element with the text "Compact Date Picker"', - 'Verify there is an element with the text "Inline Date Picker"', - 'Verify there is an element with today`s date at the bottom of the screen', - 'Set the date picker to September 9th, 2023' - ); - }); + // Note: when writing "Date (UTC):" instead of "Date (UTC): " copilot failed the test + it('correct date and time', async () => { + await copilot.perform( + 'Verify there is element with the text "Date (UTC): "', + 'Verify the element value of current date UTC July 1st 2023', + 'Verify there is element with the text "Time (UTC): "', + 'Verify there is element with the text "Time Local: "', + 'Verify "Time Local: " value is 7:30 pm' + ); + }); - it('switch to spinner date picker', async () => { - await copilot.perform( - 'Verify there is an element with the text "Compact Date Picker"', - 'Tap the element with the text "Compact Date Picker"', - 'Verify there is an element with the text "Inline Date Picker"', - 'Tap the element with the text "Inline Date Picker"', - 'Verify that there is slider element at the bottom of the screen', - 'Set the date picker to September 9th, 2023' - ); + it('compact date picker', async () => { + await copilot.perform( + 'Verify there is an element with the text "Compact Date Picker"', + 'Verify there is an element with today`s date at the bottom of the screen', + 'Set the date picker to September 9th, 2023' + ); + }); + + it('inline date picker', async () => { + await copilot.perform( + 'Verify there is an element with the text "Compact Date Picker"', + 'Tap the element with the text "Compact Date Picker"', + 'Verify there is an element with the text "Inline Date Picker"', + 'Verify there is an element with today`s date at the bottom of the screen', + 'Set the date picker to September 9th, 2023' + ); + }); + + it('switch to spinner date picker', async () => { + await copilot.perform( + 'Verify there is an element with the text "Compact Date Picker"', + 'Tap the element with the text "Compact Date Picker"', + 'Verify there is an element with the text "Inline Date Picker"', + 'Tap the element with the text "Inline Date Picker"', + 'Verify that there is slider element at the bottom of the screen', + 'Set the date picker to September 9th, 2023' + ); - await jestExpect(async () => - await copilot.perform('Set the date picker`s first column to 10th, so the date will be September 10th, 2023') - ).rejects.toThrowError(); + await jestExpect(async () => + await copilot.perform('Set the date picker`s first column to 10th, so the date will be September 10th, 2023') + ).rejects.toThrowError(); + }); }); }); }); diff --git a/detox/test/e2e/utils/custom-describes.js b/detox/test/e2e/utils/custom-describes.js index d44f4872a4..f66cb3f168 100644 --- a/detox/test/e2e/utils/custom-describes.js +++ b/detox/test/e2e/utils/custom-describes.js @@ -1,13 +1,14 @@ const axios = require('axios'); const PromptHandler = require("./PromptHandler"); -const describeOrDescribeSkip = process.env.CI === 'true' ? describe.skip : describe; - describeForCopilotEnv = (description, fn) => { - describeOrDescribeSkip(':ios: Copilot', () => { + const isCI = process.env.CI === 'true'; + const describeOrDescribeSkipIfCI = isCI ? describe.skip : describe; + + describeOrDescribeSkipIfCI(':ios: Copilot', () => { describe(description, () => { beforeAll(async () => { - if (!await checkVpnStatus()) { + if (!await _checkVpnStatus()) { console.warn('Cannot access the LLM service without Wix BO environment. Relying on cached responses only.'); } try { @@ -25,7 +26,7 @@ describeForCopilotEnv = (description, fn) => { }); }; -checkVpnStatus = async () => { +_checkVpnStatus = async () => { try { const response = await axios.get('https://bo.wix.com/_serverless/expert-toolkit/checkVpn'); return response.data.enabled === true; @@ -35,6 +36,22 @@ checkVpnStatus = async () => { } }; +describeNewArchNotSupported = (description, fn) => { + const isNewArch = process.env.RCT_NEW_ARCH_ENABLED === '1'; + const describeOrDescribeSkipIfNewArch = isNewArch ? describe.skip : describe; + + if (isNewArch) { + console.warn('Skipping tests for new architecture, as there are issues related to the new architecture.'); + } + + describeOrDescribeSkipIfNewArch('Legacy Arch (Paper)', () => { + describe(description, () => { + fn(); + }); + }); +} + module.exports = { - describeForCopilotEnv + describeForCopilotEnv, + describeNewArchNotSupported };