import WebDriverIO, {remote} from "webdriverio";

const capabilities = {
    platformName: 'android',
    deviceName: 'ZY226TBLVN',
    automationName: 'UiAutomator2',
    appPackage: "com.clicknpush.mobile",
    appActivity: ".MainActivity",
    app: "C:\\Users\\cdmos\\Desktop\\cnp\\atlas-mobile-ts\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk",
    appWaitForLaunch: false, // false needed to run with expo
    newCommandTimeout: 3000,
}

jest.setTimeout(120000)

const options = {
  path: '/wd/hub/',
  port: 4723,
};

let driver: WebDriverIO.Browser<"async">;

// beforeAll(async () => {
//   console.log('creating driver')
//   driver = await remote({ ...options, capabilities});
//   console.log('driver created')
// });

// afterAll(async () => {
//   if (driver) {
    
//   }
// });

it('shows the root view', async () => {
  console.log('creating driver')
  const driver = await remote({ ...options, capabilities});
  console.log('driver created')
  const rootView = await driver.$('rootView').isDisplayed()
  console.log(rootView)
  expect(rootView).toBe(true)
  await driver.deleteSession();
})

// describe('app load', () => {  
//   // Add tests here
// });
