2020-05-08 13:24:37 -07:00
/ * *
* Copyright ( c ) Microsoft Corporation . All rights reserved .
* Licensed under the MIT License .
* /
import { driver , By2 } from 'selenium-appium'
const setup = require ( '../jest-setups/jest.setup' ) ;
2021-04-13 16:40:49 -07:00
jest . setTimeout ( 150000 ) ;
2020-05-08 13:24:37 -07:00
2021-04-13 16:40:49 -07:00
const WindowsApplicationDriverUrl = "http://127.0.0.1:4723/wd/hub" ;
2020-05-08 13:24:37 -07:00
describe ( 'Alert Tests' , ( ) => {
test ( 'Show Alert' , async ( ) => {
2021-04-13 16:40:49 -07:00
await driver . startWithCapabilities ( setup . capabilities , WindowsApplicationDriverUrl ) ;
const showAlertButton = By2 . nativeName ( 'Show alert' ) ;
2020-05-08 13:24:37 -07:00
await showAlertButton . click ( ) ;
2021-04-13 16:40:49 -07:00
await By2 . nativeName ( 'Hello! I am an alert box!' ) ;
// await By2.nativeName('OK').click(); All alerts will be automatically dismissed as Windows Webview does not have support for Alerts https://github.com/MicrosoftDocs/winrt-api/blob/docs/windows.ui.xaml.controls/webview.md#use-of-alert
const dismissMessage = By2 . nativeName ( 'Alert dismissed!' ) ;
2020-05-08 13:24:37 -07:00
expect ( dismissMessage ) . not . toBeNull ( ) ;
2021-04-13 16:40:49 -07:00
await driver . quit ( ) ;
2020-05-08 13:24:37 -07:00
} ) ;
} ) ;