Files
Detox/detox/test/e2e/03.actions.visibility-workaround.test.js
GeorgyandGitHub 8fc2e8918a Fixed scrolling inaccuracy on Android (#4482)
Fixed scrolling inaccuracy on Android
2024-05-06 15:25:55 +03:00

40 lines
1.6 KiB
JavaScript

const {scrollViewDriver} = require('./drivers/fs-scroll-driver');
/**
* A mini suite providing an alternative to tests failing due to issues found in RN 58+ on Android (see
* https://github.com/facebook/react-native/issues/23870).
* It basically runs similar 'action' use cases -- all of which involve visibility and scrolling, but in a
* setup where they <i>can</i> pass, so as to assert that the core Detox functionality is valid nevertheless.
*/
describe(':android: Visibility-bug workaround actions', () => {
beforeEach(async () => {
await device.reloadReactNative();
await element(by.text('FS Scroll Actions')).tap();
});
it('should scroll for a small amount in direction', async () => {
await expect(scrollViewDriver.element()).toBeVisible();
await expect(scrollViewDriver.firstItem()).toBeVisible();
await expect(scrollViewDriver.lastItem()).not.toBeVisible();
await scrollViewDriver.scrollBy(60);
await expect(scrollViewDriver.firstItem()).not.toBeVisible();
await expect(scrollViewDriver.secondItem()).toBeVisible();
await scrollViewDriver.scrollBy(-60);
await expect(scrollViewDriver.firstItem()).toBeVisible();
await expect(scrollViewDriver.lastItem()).not.toBeVisible();
});
it('should scroll for a large amount in direction', async () => {
await expect(scrollViewDriver.element()).toBeVisible();
await expect(scrollViewDriver.firstItem()).toBeVisible();
await expect(scrollViewDriver.lastItem()).not.toBeVisible();
await scrollViewDriver.scrollBy(3000);
await expect(scrollViewDriver.firstItem()).not.toBeVisible();
await expect(scrollViewDriver.lastItem()).toBeVisible();
});
});