const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')
const isHarmony = platformInfo.startsWith('harmony')
const isWeb = platformInfo.startsWith('web')
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
describe('component-native-sticky-section', () => {
if (isMP) {
it('not support', () => {
expect(1).toBe(1)
})
return
}
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/component/sticky-section/sticky-section')
await page.waitFor('sticky-section')
await page.waitFor(2000);
})
it('check_delete_and_refresher', async () => {
await page.callMethod('deleteSection')
await page.waitFor(400)
await page.setData({
refresherTriggered: true
})
await page.waitFor(500)
await page.setData({
refresherTriggered: false
})
await page.waitFor(2000)
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
})
it('check_sticky_section', async () => {
await page.waitFor(async () => {
return await page.data('isReady') === true;
});
page.waitFor(600)
await page.callMethod('listViewScrollByY', 1000)
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
})
if (isWeb || isAppWebView) {
return
}
it('check_goto_sticky_header', async () => {
await page.callMethod('toTop')
page.waitFor(100)
await page.setData({
scrolling: true
})
if (!isAppWebView) {
await page.callMethod('gotoStickyHeader', 'C')
}
await page.waitFor(async () => {
return await page.data('scrolling') === false;
});
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
})
})