diff --git a/detox/test/detox_copilot_cache.json b/detox/test/detox_copilot_cache.json index 69a08d19f9..d11165a366 100644 --- a/detox/test/detox_copilot_cache.json +++ b/detox/test/detox_copilot_cache.json @@ -874,5 +874,42 @@ "{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the DatePicker screen\",\"code\":\"await element(by.text('DatePicker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await expect(element(by.text('Compact Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await element(by.text('Compact Date Picker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await expect(element(by.text('Inline Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await element(by.text('Inline Date Picker')).tap();\"},{\"step\":\"Verify that there is slider element at the bottom of the screen\",\"code\":\"await expect(element(by.id('datePicker'))).toBeVisible();\"},{\"step\":\"Set the date picker to September 9th, 2023\",\"code\":\"await element(by.id('datePicker')).setDatePickerDate('2023-09-09', 'yyyy-MM-dd');\"},{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"code\":\"await element(by.id('datePicker')).setColumnToValue(0, '10');\",\"result\":\"Caught an error while evaluating \\\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\\\", tried with generated code: \\\"await element(by.id('datePicker')).setColumnToValue(0, '10');\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"a0d01a8c26df8429cefd4d1e7531c08c\"}": "await element(by.id('datePicker')).setColumnToValue(0, '10');", "{\"step\":\"Restart the React Native state\",\"previous\":[],\"viewHierarchyHash\":\"2003370c2f8265a387bd7d97432cb918\"}": "await device.reloadReactNative();", "{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the DatePicker screen\",\"code\":\"await element(by.text('DatePicker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await expect(element(by.text('Compact Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await element(by.text('Compact Date Picker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await expect(element(by.text('Inline Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await element(by.text('Inline Date Picker')).tap();\"},{\"step\":\"Verify that there is slider element at the bottom of the screen\",\"code\":\"await expect(element(by.id('datePicker'))).toBeVisible();\"},{\"step\":\"Set the date picker to September 9th, 2023\",\"code\":\"await element(by.id('datePicker')).setDatePickerDate('2023-09-09', 'yyyy-MM-dd');\"}],\"viewHierarchyHash\":\"ad5f42fc058e0247152d3859fbe78791\"}": "await element(by.id('datePicker')).setColumnToValue(0, '10');", - "{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the DatePicker screen\",\"code\":\"await element(by.text('DatePicker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await expect(element(by.text('Compact Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await element(by.text('Compact Date Picker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await expect(element(by.text('Inline Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await element(by.text('Inline Date Picker')).tap();\"},{\"step\":\"Verify that there is slider element at the bottom of the screen\",\"code\":\"await expect(element(by.id('datePicker'))).toBeVisible();\"},{\"step\":\"Set the date picker to September 9th, 2023\",\"code\":\"await element(by.id('datePicker')).setDatePickerDate('2023-09-09', 'yyyy-MM-dd');\"},{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"code\":\"await element(by.id('datePicker')).setColumnToValue(0, '10');\",\"result\":\"Caught an error while evaluating \\\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\\\", tried with generated code: \\\"await element(by.id('datePicker')).setColumnToValue(0, '10');\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"518e222add3a96eaef432a332884d669\"}": "await element(by.id('datePicker')).setColumnToValue(0, '10');" + "{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the DatePicker screen\",\"code\":\"await element(by.text('DatePicker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await expect(element(by.text('Compact Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Compact Date Picker\\\"\",\"code\":\"await element(by.text('Compact Date Picker')).tap();\"},{\"step\":\"Verify there is an element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await expect(element(by.text('Inline Date Picker'))).toExist();\"},{\"step\":\"Tap the element with the text \\\"Inline Date Picker\\\"\",\"code\":\"await element(by.text('Inline Date Picker')).tap();\"},{\"step\":\"Verify that there is slider element at the bottom of the screen\",\"code\":\"await expect(element(by.id('datePicker'))).toBeVisible();\"},{\"step\":\"Set the date picker to September 9th, 2023\",\"code\":\"await element(by.id('datePicker')).setDatePickerDate('2023-09-09', 'yyyy-MM-dd');\"},{\"step\":\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\",\"code\":\"await element(by.id('datePicker')).setColumnToValue(0, '10');\",\"result\":\"Caught an error while evaluating \\\"Set the date picker`s first column to 10th, so the date will be September 10th, 2023\\\", tried with generated code: \\\"await element(by.id('datePicker')).setColumnToValue(0, '10');\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"518e222add3a96eaef432a332884d669\"}": "await element(by.id('datePicker')).setColumnToValue(0, '10');", + "{\"step\":\"Tap the toggle\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Find an element with ID \\\"toggle\\\" (call it \\\"the toggle\\\") in the Assertions\",\"code\":\"const toggle = element(by.id('toggle'));\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await element(by.id('toggle')).tap();", + "{\"step\":\"Verify that the toggle has true value\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Find an element with ID \\\"toggle\\\" (call it \\\"the toggle\\\") in the Assertions\",\"code\":\"const toggle = element(by.id('toggle'));\"},{\"step\":\"Tap the toggle\",\"code\":\"await element(by.id('toggle')).tap();\"}],\"viewHierarchyHash\":\"5bf0766d72e0d6e18a04ab8f683c9f0c\"}": "await expect(element(by.id('toggle'))).toHaveToggleValue(true);", + "{\"step\":\"Set the device location to (-80.125, 66.5)\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"undefined\",\"result\":\"Failed to perform \\\"Set the device location to (-80.125, 66.5)\\\", could not generate prompt result. Let's try a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"b37c0ac76594c4298a109a35482b0429\"}": "await device.setLocation(-80.125, 66.5);", + "{\"step\":\"Verify that \\\"Latitude: -80.125\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(-80.125, 66.5);\"}],\"viewHierarchyHash\":\"b37c0ac76594c4298a109a35482b0429\"}": "await element(by.id('get_location_button')).tap();\nawait expect(element(by.text('Latitude: -80.125'))).toBeVisible();", + "{\"step\":\"Restart the React Native state\",\"previous\":[],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await device.reloadReactNative();", + "{\"step\":\"Set the device location to (-80.125, 66.5)\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await device.setLocation(66.5, -80.125);", + "{\"step\":\"Restart the React Native state\",\"previous\":[],\"viewHierarchyHash\":\"cec89f49238106da6f8eaf0316867e7d\"}": "await element(by.id('redbox-reload')).tap();", + "{\"step\":\"Set the device location to (-80.125, 66.5)\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"await expect(element(by.text('Get location'))).toExist();\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"}],\"viewHierarchyHash\":\"75f51cd719e69401fd8d52e373aaff5f\"}": "await device.setLocation(-80.125, 66.5);", + "{\"step\":\"Restart the React Native state\",\"previous\":[],\"viewHierarchyHash\":\"b37c0ac76594c4298a109a35482b0429\"}": "await device.reloadReactNative();", + "{\"step\":\"Set the device location to (-80.125, 66.5)\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"await expect(element(by.text('Get location'))).toExist();\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await device.setLocation(66.5, -80.125);", + "{\"step\":\"Verify that \\\"Latitude: -80.125\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"await expect(element(by.text('Get location'))).toExist();\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');", + "{\"step\":\"Verify that \\\"Longitude: 66.5\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission always\",\"code\":\"await device.launchApp({ permissions: { location: 'always' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"await expect(element(by.text('Get location'))).toExist();\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"},{\"step\":\"Verify that \\\"Latitude: -80.125\\\" is displayed\",\"code\":\"await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');", + "{\"step\":\"Set the device location to (66.5, -80.125)\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await device.setLocation(66.5, -80.125);", + "{\"step\":\"Verify that \\\"Latitude: 66.5\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"},{\"step\":\"Set the device location to (66.5, -80.125)\",\"code\":\"await device.setLocation(66.5, -80.125);\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_latitude'))).toHaveText('Latitude: 66.5');", + "{\"step\":\"Verify that \\\"Longitude: -80.125\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"},{\"step\":\"Set the device location to (66.5, -80.125)\",\"code\":\"await device.setLocation(66.5, -80.125);\"},{\"step\":\"Verify that \\\"Latitude: 66.5\\\" is displayed\",\"code\":\"await expect(element(by.id('location_latitude'))).toHaveText('Latitude: 66.5');\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');", + "{\"step\":\"Verify that \\\"Latitude: -80.125\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');", + "{\"step\":\"Verify that \\\"Longitude: 66.5\\\" is displayed\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Location screen\",\"code\":\"await element(by.text('Location')).tap();\"},{\"step\":\"Launch the app with location permission just once\",\"code\":\"await device.launchApp({ permissions: { location: 'inuse' } });\"},{\"step\":\"Verify there is an element with the text \\\"Get location\\\"\",\"code\":\"// Visual assertion passed: An element with the text \\\"Get location\\\" is visible in the snapshot image.\"},{\"step\":\"Tap the get location element\",\"code\":\"await element(by.id('get_location_button')).tap();\"},{\"step\":\"Set the device location to (-80.125, 66.5)\",\"code\":\"await device.setLocation(66.5, -80.125);\"},{\"step\":\"Verify that \\\"Latitude: -80.125\\\" is displayed\",\"code\":\"await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');\"}],\"viewHierarchyHash\":\"3f8b3400f1f9019f721d05db61b3701b\"}": "await expect(element(by.id('location_longitude'))).toHaveText('Longitude: -80.125');", + "{\"step\":\"Verify there is an element with the text \\\"i contain some text\\\"\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.text('I contain some text'))).toBeVisible();", + "{\"step\":\"Verify there is an element with the accessibility label \\\"I contain some text\\\"\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.label('I contain some text'))).toExist();", + "{\"step\":\"Verify that the toggle has false value\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.id('toggle'))).toHaveToggleValue(false);", + "{\"step\":\"Find a checkbox element\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.id('toggle'))).toExist();", + "{\"step\":\"Find a checkbox type element\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.id('toggle'))).toExist();", + "{\"step\":\"Find a check-box type element\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "const toggleElement = element(by.id('toggle'));\nawait expect(toggleElement).toExist();", + "{\"step\":\"Find a check-box type element. not toggle\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"No check-box type element found in the view hierarchy. The only toggle-like element present is an RCTSwitch, which is not a check-box.\");", + "{\"step\":\"Find a check-box type element. not toggle\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Find a check-box type element. not toggle\",\"code\":\"throw new Error(\\\"No check-box type element found in the view hierarchy. The only toggle-like element present is an RCTSwitch, which is not a check-box.\\\");\",\"result\":\"Caught an error while evaluating \\\"Find a check-box type element. not toggle\\\", tried with generated code: \\\"throw new Error(\\\"No check-box type element found in the view hierarchy. The only toggle-like element present is an RCTSwitch, which is not a check-box.\\\");\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"No check-box type element found in the view hierarchy. The only toggle-like element present is an RCTSwitch, which is not a check-box.\");", + "{\"step\":\"Find a Check-box type element in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"No checkbox-type element found in the Assertions screen. The view contains a toggle switch, but no checkbox is present.\");", + "{\"step\":\"Find a Check-box type element in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Find a Check-box type element in the Assertions\",\"code\":\"throw new Error(\\\"No checkbox-type element found in the Assertions screen. The view contains a toggle switch, but no checkbox is present.\\\");\",\"result\":\"Caught an error while evaluating \\\"Find a Check-box type element in the Assertions\\\", tried with generated code: \\\"throw new Error(\\\"No checkbox-type element found in the Assertions screen. The view contains a toggle switch, but no checkbox is present.\\\");\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"No checkbox-type element found in the Assertions screen. The view contains a toggle switch, but no checkbox is present.\");", + "{\"step\":\"Verify that the toggle type element is exist in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "// Visual assertion passed: A toggle element is present in the Assertions screen.", + "{\"step\":\"Verify there is element with the text \\\"copilot is the best\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"Unable to find an element with the text 'copilot is the best' in the current view hierarchy or snapshot image.\");", + "{\"step\":\"Verify there is element with the text \\\"copilot is the best\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Verify there is element with the text \\\"copilot is the best\\\" in the Assertions\",\"code\":\"throw new Error(\\\"Unable to find an element with the text 'copilot is the best' in the current view hierarchy or snapshot image.\\\");\",\"result\":\"Caught an error while evaluating \\\"Verify there is element with the text \\\"copilot is the best\\\" in the Assertions\\\", tried with generated code: \\\"throw new Error(\\\"Unable to find an element with the text 'copilot is the best' in the current view hierarchy or snapshot image.\\\");\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"Unable to find an element with the text 'copilot is the best' in the current view hierarchy or snapshot image.\");", + "{\"step\":\"Tap the toggle\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await element(by.id('toggle')).tap();", + "{\"step\":\"Verify that the toggle has true value\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Tap the toggle\",\"code\":\"await element(by.id('toggle')).tap();\"}],\"viewHierarchyHash\":\"5bf0766d72e0d6e18a04ab8f683c9f0c\"}": "// Visual assertion passed: The toggle switch is visually in the \"on\" position, indicating a true value.", + "{\"step\":\"Verify there is element with the text \\\"Text does not exist\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.text('Text does not exist'))).toExist();", + "{\"step\":\"Verify there is element with the text \\\"Text does not exist\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Verify there is element with the text \\\"Text does not exist\\\" in the Assertions\",\"code\":\"await expect(element(by.text('Text does not exist'))).toExist();\",\"result\":\"Caught an error while evaluating \\\"Verify there is element with the text \\\"Text does not exist\\\" in the Assertions\\\", tried with generated code: \\\"await expect(element(by.text('Text does not exist'))).toExist();\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "await expect(element(by.text('Text does not exist'))).toExist();", + "{\"step\":\"Find an element with label \\\"Does not exist\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"Element with label 'Does not exist' is not present in the view hierarchy or visible in the snapshot image.\");", + "{\"step\":\"Find an element with label \\\"Does not exist\\\" in the Assertions\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"},{\"step\":\"Find an element with label \\\"Does not exist\\\" in the Assertions\",\"code\":\"throw new Error(\\\"Element with label 'Does not exist' is not present in the view hierarchy or visible in the snapshot image.\\\");\",\"result\":\"Caught an error while evaluating \\\"Find an element with label \\\"Does not exist\\\" in the Assertions\\\", tried with generated code: \\\"throw new Error(\\\"Element with label 'Does not exist' is not present in the view hierarchy or visible in the snapshot image.\\\");\\\". Validate the code against the APIs and hierarchy and continue with a different approach. If can't, return a code that throws a descriptive error.\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "throw new Error(\"Element with label 'Does not exist' is not present in the view hierarchy or visible in the snapshot image.\");", + "{\"step\":\"Verify there is an element with ID \\\"subtext-root\\\"\",\"previous\":[{\"step\":\"Restart the React Native state\",\"code\":\"await device.reloadReactNative();\"},{\"step\":\"Navigate to the Assertions screen\",\"code\":\"await element(by.text('Assertions')).tap();\"}],\"viewHierarchyHash\":\"e10d5852c1e957c24dc1ddba12738d92\"}": "// Visual assertion passed: An element with ID \"subtext-root\" is present in the view hierarchy." } \ No newline at end of file diff --git a/detox/test/e2e/copilot/07.copilot.assertions.test.js b/detox/test/e2e/copilot/07.copilot.assertions.test.js index c608dcf271..7548751460 100644 --- a/detox/test/e2e/copilot/07.copilot.assertions.test.js +++ b/detox/test/e2e/copilot/07.copilot.assertions.test.js @@ -1,54 +1,85 @@ -const {describeForCopilotEnv} = require("../utils/custom-describes"); +const { describeForCopilotEnv } = require('../utils/custom-describes'); const jestExpect = require('expect').default; -const driver = { - get toggleElement() { return element(by.id('toggle')) }, - } - describeForCopilotEnv('Assertions', () => { - beforeAll(async () => { - await copilot.perform('Start the app'); - }); - - beforeEach(async () => { + beforeAll(async () => { + await copilot.perform('Start the app'); + }); + + beforeEach(async () => { + await copilot.perform( + 'Restart the React Native state', + 'Navigate to the Assertions screen' + ); + }); + + describe('Assertion Tests', () => { + it('should assert an element is visible (by text)', async () => { await copilot.perform( - 'Restart the React Native state', - 'Navigate to the Assertions screen' + 'Verify there is an element with the text "i contain some text"' ); }); - describe('Assertion Tests', () => { + it('should not assert an element is not visible (by text)', async () => { + await jestExpect(async () => + await copilot.perform('Verify there is element with the text "Text does not exist" in the Assertions') + ).rejects.toThrowError(); + }); - it('should assert an element is visible', async () => { + it('should assert an element is visible (by id)', async () => { await copilot.perform( - 'Find an element with ID "main-text" in the Assertions', - 'Verify that the text of this element is "i contain some text"', - ); + 'Verify there is an element with ID "subtext-root"' + ); }); - it('should assert an element does not exist', async () => { - await jestExpect(async () => - await copilot.perform('Find an element with ID "RandomJunk959" in the Assertions') - ).rejects.toThrowError(); + it('should not assert an element that does not exist (by id)', async () => { + await jestExpect(async () => + await copilot.perform('Find an element with ID "RandomJunk959" in the Assertions') + ).rejects.toThrowError(); }); it('should assert an element has (accessibility) label', async () => { - await copilot.perform( - 'Find an element with ID "main-text" in the Assertions', - 'Verify that the element has an accessibility label "I contain some text"', - ); - }); - - it('assert toggle-switch widget', async () => { - await copilot.perform( - 'Find an element with ID "toggle" (call it "the toggle") in the Assertions', - 'Verify that the toggle has false value', - 'Tap the toggle', - 'Verify that the toggle has true value', - ); - await expect(driver.toggleElement).toHaveToggleValue(true); - await expect(driver.toggleElement).not.toHaveToggleValue(false); - }); + await copilot.perform( + 'Verify there is an element with the accessibility label "I contain some text"' + ); + }); + + it('should not assert an element that does not exist (by label)', async () => { + await jestExpect(async () => + await copilot.perform('Find an element with label "Does not exist" in the Assertions') + ).rejects.toThrowError(); + }); + + it('assert toggle exist by element type', async () => { + await copilot.perform( + 'Verify that the toggle type element is exist in the Assertions', + ); + }); + + //Note: The checkbox was defined by copilot as toggle at first. Changed it to Check-box type + it('shouldn`t assert an element that does not exist (by type)', async () => { + await jestExpect(async () => + await copilot.perform('Find a Check-box type element in the Assertions') + ).rejects.toThrowError(); + }); + + it('assert toggle-switch widget false', async () => { + await copilot.perform( + 'Verify that the toggle has false value', + ); + + await expect(element(by.id('toggle'))).toHaveToggleValue(false); + await expect(element(by.id('toggle'))).not.toHaveToggleValue(true); + }); + it('assert toggle-switch widget true ', async () => { + await copilot.perform( + 'Tap the toggle', + 'Verify that the toggle has true value' + ); + + await expect(element(by.id('toggle'))).toHaveToggleValue(true); + await expect(element(by.id('toggle'))).not.toHaveToggleValue(false); + }); + }); }); -}); \ No newline at end of file diff --git a/detox/test/e2e/copilot/08.copilot.location.test.js b/detox/test/e2e/copilot/08.copilot.location.test.js index 273858dc46..3082a5c77e 100644 --- a/detox/test/e2e/copilot/08.copilot.location.test.js +++ b/detox/test/e2e/copilot/08.copilot.location.test.js @@ -1,78 +1,57 @@ -const {describeForCopilotEnv} = require("../utils/custom-describes"); +const { describeForCopilotEnv } = require('../utils/custom-describes'); +const DUMMY_COORDINATE1 = '(-80.125, 66.5)'; +const DUMMY_COORDINATE2 = '(66.5, -80.125)'; + describeForCopilotEnv('Location', () => { + beforeEach(async () => { + await copilot.perform( + 'Restart the React Native state', + 'Navigate to the Location screen' + ); + }); - beforeEach(async () => { + describe('Location Tests', () => { + it('should show error when permission defined as `never`', async () => { await copilot.perform( - 'Restart the React Native state', - 'Navigate to the Location screen' + 'Launch the app with location permission denied', + 'Verify there is an element with the text "Get location"', + 'Tap the get location element', + 'Verify there is an element with the text "User denied access to location services."' ); }); - const tapGetLocationBtn = async () => { - await copilot.perform( - 'Verify there is an element with the text "Get location"', - 'Tap the get location element', - ); - }; - - const setLocation = async() => { - await copilot.perform( - 'Set the device location to (-80.125, 66.5)' - ); - } - - const setLocation2 = async() => { - await copilot.perform( - 'Set the device location to (66.5, -80.125)' - ); - } - - describe('Location Tests', () => { - it('should show error when permission defined as `never`', async () => { - await copilot.perform( - 'Launch the app with location permission denied', - ); - await tapGetLocationBtn() - await copilot.perform( - 'Verify there is an element with the text "User denied access to location services."', - ); - }); - - it('should show location when permission is `always`', async () => { - await copilot.perform( - 'Launch the app with location permission always', - ); - await tapGetLocationBtn() - await setLocation() - await copilot.perform( - 'Verify that "Latitude: -80.125" is displayed', - 'Verify that "Longitude: 66.5" is displayed' - ); - }); + it('should show location when permission is `always`', async () => { + await copilot.perform( + 'Launch the app with location permission always', + 'Verify there is an element with the text "Get location"', + 'Tap the get location element', + `Set the device location to ${DUMMY_COORDINATE1}`, + 'Verify that "Latitude: -80.125" is displayed', + 'Verify that "Longitude: 66.5" is displayed' + ); + }); - it('should show location when permission is `inuse`', async () => { - await copilot.perform( - 'Launch the app with location permission just once', - ); - await tapGetLocationBtn() - await setLocation() - await copilot.perform( - 'Verify that "Latitude: -80.125" is displayed', - 'Verify that "Longitude: 66.5" is displayed' - ); - }); + it('should show location when permission is `inuse`', async () => { + await copilot.perform( + 'Launch the app with location permission just once', + 'Verify there is an element with the text "Get location"', + 'Tap the get location element', + `Set the device location to ${DUMMY_COORDINATE1}`, + 'Verify that "Latitude: -80.125" is displayed', + 'Verify that "Longitude: 66.5" is displayed' + ); + }); - it('should set location multiple times', async () => { - await copilot.perform( - 'Launch the app with location permission just once', - ); - await tapGetLocationBtn() - await setLocation() - await setLocation2() - await copilot.perform( - 'Verify that "Latitude: 66.5" is displayed', - 'Verify that "Longitude: -80.125" is displayed' - ); - }); + it('should set location multiple times', async () => { + await copilot.perform( + 'Launch the app with location permission just once', + 'Verify there is an element with the text "Get location"', + 'Tap the get location element', + `Set the device location to ${DUMMY_COORDINATE1}`, + `Set the device location to ${DUMMY_COORDINATE2}`, + 'Verify that "Latitude: 66.5" is displayed', + 'Verify that "Longitude: -80.125" is displayed' + ); }); -}); \ No newline at end of file + }); +}); diff --git a/detox/test/e2e/copilot/09.copilot.datepicker.test.js b/detox/test/e2e/copilot/09.copilot.datepicker.test.js index 2fb1beeaa1..f1f4dadce6 100644 --- a/detox/test/e2e/copilot/09.copilot.datepicker.test.js +++ b/detox/test/e2e/copilot/09.copilot.datepicker.test.js @@ -1,84 +1,62 @@ -const {describeForCopilotEnv} = require("../utils/custom-describes"); +const { describeForCopilotEnv } = require('../utils/custom-describes'); const { default: jestExpect } = require('expect'); describeForCopilotEnv('DatePicker', () => { - beforeAll(async () => { - await copilot.perform('Start the app'); - }); + beforeAll(async () => { + await copilot.perform('Start the app'); + }); + + beforeEach(async () => { + await copilot.perform( + 'Restart the React Native state', + 'Navigate to the DatePicker screen' + ); + }); + + describe('DatePicker Tests', () => { - beforeEach(async () => { + // Note: when writing "Date (UTC):" instead of "Date (UTC): " copilot failed the test + it('correct date and time', async () => { await copilot.perform( - 'Restart the React Native state', - 'Navigate to the DatePicker screen' + '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' ); }); - describe('DatePicker Tests', () => { - - // 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('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', - // 'Tap the element with today`s date at the bottom of the screen', - // 'Verify that a compact date picker is now display', - // // 'Tap the number 8 inside the compact date picker' - failed - // 'Verify there are numbers from 1 to 28 on the compact date picker screen', - // // 'Set the day to 8' - // ); - // console.log('View hierarchy: ', await device.generateViewHierarchyXml()); - // - // await copilot.perform( - // 'Tap the element with the text "8"', - // ); - // // await web.element(by.web.label('8')).tap(); - // }); - - 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' - ); + 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' + ); + }); - 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(); + 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(); }); + }); }); diff --git a/detox/test/e2e/copilot/10.copilot.visibility.test.js b/detox/test/e2e/copilot/10.copilot.visibility.test.js index 0b60428055..272261f193 100644 --- a/detox/test/e2e/copilot/10.copilot.visibility.test.js +++ b/detox/test/e2e/copilot/10.copilot.visibility.test.js @@ -45,7 +45,6 @@ describeForCopilotEnv('Visibility', () => { await copilot.perform('Verify the purple rectangle is exactly 26% visible') ).rejects.toThrowError(); }); - }); }); }); diff --git a/detox/test/src/Screens/DatePickerScreen.js b/detox/test/src/Screens/DatePickerScreen.js index 38266c9a63..261c8da0ba 100644 --- a/detox/test/src/Screens/DatePickerScreen.js +++ b/detox/test/src/Screens/DatePickerScreen.js @@ -5,13 +5,14 @@ import { Text, View, StyleSheet, Button, Platform } from 'react-native'; import { default as DatePicker } from "@react-native-community/datetimepicker"; const shouldHideDatePicker = Platform.OS === 'android'; +const INITIAL_CHOSEN_DATE = '2023-07-01T19:30:00' export default class DatePickerScreen extends Component { constructor(props) { super(props); this.state = { - chosenDate: new Date('2023-07-01T19:30:00'), + chosenDate: new Date(INITIAL_CHOSEN_DATE), datePickerVisible: !shouldHideDatePicker, datePickerDisplay: DatePickerScreen.MODES[0], }; diff --git a/package.json b/package.json index f1e019cb52..7b523e96f6 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ }, "devDependencies": { "chalk": "^4.0.0", + "detox": "^20.27.6", "dictionary-en": "^3.1.0", "lerna": "^6.6.2", "lodash": "4.17.x",