-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
jetpack-componse-element-values-e2e-specs.js
55 lines (41 loc) · 1.62 KB
/
jetpack-componse-element-values-e2e-specs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { initSession, deleteSession, MOCHA_TIMEOUT } from '../helpers/session';
import { COMPOSE_CAPS } from '../desired';
describe('Jetpack Compose', function () {
this.timeout(MOCHA_TIMEOUT);
let driver;
let chai;
before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.should();
chai.use(chaiAsPromised.default);
// For SDK 23 and below Jetpack compose app crashes while running under instrumentation.
if (parseInt(process.env.ANDROID_SDK_VERSION, 10) <= 23) {
this.skip();
}
});
beforeEach(async function () {
driver = await initSession(COMPOSE_CAPS);
});
afterEach(async function () {
await deleteSession();
});
it('should find element by tag and text and click it', async function () {
let el = await driver.elementByXPath("//*[@text='Text Input Components']");
await driver.moveTo(el);
await el.click();
await driver.updateSettings({ driver: 'compose' });
let textElement = await driver.elementByTagName('text_input');
// verify default text
await textElement.text().should.eventually.equal('Enter your text here');
await textElement.setImmediateValue(['hello']);
// should append to the exiting text
await driver.elementByTagName('text_input').text().should.eventually.equal('Enter your text herehello');
textElement.setText(['テスト']);
// should replace existing text
await textElement.text().should.eventually.equal('テスト');
textElement.clear();
// should clear existing text
await textElement.text().should.eventually.equal('');
});
});