From fbcb033ccefbb9a79fca40876ef6d04acd84baf0 Mon Sep 17 00:00:00 2001 From: Damjan Smickovski Date: Tue, 27 Jun 2023 20:08:01 +0200 Subject: [PATCH] Added Screens and config folders --- appium-conf.ts => src/config/appium-conf.ts | 0 src/config/index.ts | 1 + src/screens/Settings.ts | 23 +++++++++++++++++++++ src/screens/index.ts | 1 + src/tests/settingsTest.ts | 6 ++++-- tsconfig.json | 6 ++++++ 6 files changed, 35 insertions(+), 2 deletions(-) rename appium-conf.ts => src/config/appium-conf.ts (100%) create mode 100644 src/config/index.ts create mode 100644 src/screens/Settings.ts create mode 100644 src/screens/index.ts diff --git a/appium-conf.ts b/src/config/appium-conf.ts similarity index 100% rename from appium-conf.ts rename to src/config/appium-conf.ts diff --git a/src/config/index.ts b/src/config/index.ts new file mode 100644 index 0000000..5cca04d --- /dev/null +++ b/src/config/index.ts @@ -0,0 +1 @@ +export * from './appium-conf' \ No newline at end of file diff --git a/src/screens/Settings.ts b/src/screens/Settings.ts new file mode 100644 index 0000000..828b259 --- /dev/null +++ b/src/screens/Settings.ts @@ -0,0 +1,23 @@ + + + +export default class SettingsScreen { + public batteryButton = '//*[@text="Battery"]'; + + constructor() { + // Configuration + } + + // Some example methods + public async openBatterySettings() { + throw new Error("Not implemented"); + }; + + public async getBatteryLevel() { + throw new Error("Not implemented"); + }; +} + + + +export const settingsScreen = new SettingsScreen(); \ No newline at end of file diff --git a/src/screens/index.ts b/src/screens/index.ts new file mode 100644 index 0000000..36d0edf --- /dev/null +++ b/src/screens/index.ts @@ -0,0 +1 @@ +export * from './Settings' \ No newline at end of file diff --git a/src/tests/settingsTest.ts b/src/tests/settingsTest.ts index 97754ff..b9f3359 100644 --- a/src/tests/settingsTest.ts +++ b/src/tests/settingsTest.ts @@ -1,14 +1,16 @@ const { remote } = require('webdriverio'); -import { getConfig } from '../../appium-conf'; +import SettingsScreen from '@screens/Settings'; +import { getConfig } from '@config/appium-conf'; describe("Settings suite", async () => { const config = getConfig('android'); + const settingsScreen = new SettingsScreen(); it("Should open settings -> Battery", async () => { const driver = await remote(config); try { - const batteryItem = await driver.$('//*[@text="Battery"]'); + const batteryItem = await driver.$(settingsScreen.batteryButton); await batteryItem.click(); } finally { await driver.pause(1000); diff --git a/tsconfig.json b/tsconfig.json index ce90a9b..ab33074 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,9 +9,15 @@ "outDir": "dist", "baseUrl": "./src", "paths": { + "@config/*": [ + "config/*" + ], "@tests/*": [ "tests/*" ], + "@screens/*": [ + "screens/*" + ] }, "strict": true },