Skip to content

Commit

Permalink
test: skip picker tests on new arch.
Browse files Browse the repository at this point in the history
  • Loading branch information
asafkorem committed Jan 2, 2025
1 parent abb9ae4 commit 6902b23
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 54 deletions.
3 changes: 2 additions & 1 deletion detox/test/e2e/17.datePicker.test.js
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
4 changes: 3 additions & 1 deletion detox/test/e2e/17.picker.test.js
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
94 changes: 48 additions & 46 deletions detox/test/e2e/copilot/09.copilot.datepicker.test.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
});
});
29 changes: 23 additions & 6 deletions detox/test/e2e/utils/custom-describes.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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;
Expand All @@ -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
};

0 comments on commit 6902b23

Please sign in to comment.