|  | 
|  | 1 | +/** | 
|  | 2 | + *  Copyright 2025 Shift Crypto AG | 
|  | 3 | + * | 
|  | 4 | + *  Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | + *  you may not use this file except in compliance with the License. | 
|  | 6 | + *  You may obtain a copy of the License at | 
|  | 7 | + * | 
|  | 8 | + *       http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | + * | 
|  | 10 | + *  Unless required by applicable law or agreed to in writing, software | 
|  | 11 | + *  distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | + *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | + *  See the License for the specific language governing permissions and | 
|  | 14 | + *  limitations under the License. | 
|  | 15 | + */ | 
|  | 16 | +import { remote } from 'webdriverio'; | 
|  | 17 | +import { expect } from 'chai'; | 
|  | 18 | + | 
|  | 19 | +// --- Test --- | 
|  | 20 | +describe('BitBoxApp Base Test', function () { | 
|  | 21 | +  this.timeout(180000); | 
|  | 22 | + | 
|  | 23 | +  let driver; | 
|  | 24 | +  before(async () => { | 
|  | 25 | + | 
|  | 26 | +    const opts =  { | 
|  | 27 | +      path: '/', | 
|  | 28 | +      port: 4723, | 
|  | 29 | +      capabilities: { | 
|  | 30 | +        platformName: 'Android', | 
|  | 31 | +        'appium:deviceName': 'Android Emulator', | 
|  | 32 | +        'appium:automationName': 'UiAutomator2', | 
|  | 33 | +        'appium:app': './apk/app-debug.apk', | 
|  | 34 | +        'appium:noReset': true, | 
|  | 35 | +      } | 
|  | 36 | +    }; | 
|  | 37 | + | 
|  | 38 | +    driver = await remote(opts); | 
|  | 39 | + | 
|  | 40 | +    // Switch to WebView if present | 
|  | 41 | +    const contexts = await driver.getContexts(); | 
|  | 42 | +    console.log('Available contexts:', contexts); | 
|  | 43 | +    const webview = contexts.find((c) => c.startsWith('WEBVIEW_')); | 
|  | 44 | +    if (webview) await driver.switchContext(webview); | 
|  | 45 | + | 
|  | 46 | +  }); | 
|  | 47 | + | 
|  | 48 | +  after(async () => { | 
|  | 49 | +    if (driver) await driver.deleteSession(); | 
|  | 50 | +  }); | 
|  | 51 | + | 
|  | 52 | +  it('App main page loads', async () => { | 
|  | 53 | +    const body = await driver.$('body'); | 
|  | 54 | +    const bodyText = await body.getText(); | 
|  | 55 | +    expect(bodyText).to.include( | 
|  | 56 | +      'Please connect your BitBox and tap the side to continue.' | 
|  | 57 | +    ); | 
|  | 58 | +  }); | 
|  | 59 | +}); | 
0 commit comments