Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* new example
if (process.env.APPIUM_OS === 'android') {
await driver.switchContext('NATIVE_APP');
await (await driver.$('~fab')).click();
await driver.switchContext('FLUTTER');
} else {
console.log(
'Switching context to `NATIVE_APP` is currently only applicable to Android demo app.'
);
}
*/
assert.strictEqual(await driver.getElementText(counterTextFinder), '0');
//Long Press using flutter command on Increment button, it should visible 'increment' tooltip after longTap
await driver.execute('flutter:longTap', find.byValueKey('increment'), {durationMilliseconds: 10000, frequency: 30});
//Long Press using TouchAction with wait
await driver.touchAction([
{
action: 'longPress',
element: { elementId: buttonFinder }
},
{
action: 'wait',
ms: 10000
},
{
action: 'release'
}
]);
);
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
),
'3'
);
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
matching: find.byType('Text')
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
matching: find.byType('Text')
})
),
'3'
);
driver.deleteSession();
})();
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
matching: find.byType('Text')
})
),
'3'
);
driver.deleteSession();
})();
assert.strictEqual(await driver.getElementText(counterTextFinder), '2');
await driver.elementClick(find.byTooltip('Increment'));
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.byTooltip('counter_tooltip'),
matching: find.byValueKey('counter')
})
),
'3'
);
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
matching: find.byType('Text')
})
find.descendant({
of: find.byTooltip('counter_tooltip'),
matching: find.byValueKey('counter')
})
),
'3'
);
await driver.elementClick(find.byType('FlatButton'));
await driver.execute(
'flutter:waitForAbsent',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(find.byText('This is 2nd route')),
'This is 2nd route'
);
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});
await driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: 100, durationMilliseconds: 200, frequency: 30});
await driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1});
await driver.elementSendKeys(find.byType('TextField'), 'I can enter text');
await driver.execute('flutter:waitFor', find.byText('I can enter text')); // verify text appears on UI
await driver.elementClick(find.pageBack());
await driver.execute(
'flutter:waitFor',
buttonFinder
);
assert.strictEqual(
await driver.getElementText(
find.descendant({
of: find.ancestor({
of: find.bySemanticsLabel(RegExp('counter_semantic')),
matching: find.byType('Tooltip')
}),
matching: find.byType('Text')
})
),
'3'
);
driver.deleteSession();
})();