|
| 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 | + } |
| 35 | + }; |
| 36 | + |
| 37 | + driver = await remote(opts); |
| 38 | + |
| 39 | + // Switch to WebView if present |
| 40 | + const contexts = await driver.getContexts(); |
| 41 | + console.log('Available contexts:', contexts); |
| 42 | + const webview = contexts.find((c) => c.startsWith('WEBVIEW_')); |
| 43 | + if (webview) await driver.switchContext(webview); |
| 44 | + |
| 45 | + }); |
| 46 | + |
| 47 | + after(async () => { |
| 48 | + if (driver) await driver.deleteSession(); |
| 49 | + }); |
| 50 | + |
| 51 | + it('App main page loads', async () => { |
| 52 | + const body = await driver.$('body'); |
| 53 | + const bodyText = await body.getText(); |
| 54 | + expect(bodyText).to.include( |
| 55 | + 'Please connect your BitBox and tap the side to continue.' |
| 56 | + ); |
| 57 | + }); |
| 58 | +}); |
0 commit comments