From 9007bc5c903cc8443597d1cae95a3ccb5614cef1 Mon Sep 17 00:00:00 2001 From: Vadym Nastoiashchyi Date: Wed, 30 Nov 2022 11:08:49 +0200 Subject: [PATCH] Added ESlint --- .eslintrc.js | 41 +++++++++++++++++++++++++++++++++++++ README.md | 3 +++ config/wdio-android.conf.ts | 21 +++++++++---------- package.json | 6 +++++- test/specs/android/logIn.ts | 14 ++++++------- 5 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..65504b7 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,41 @@ +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + }, + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: [ + "@typescript-eslint", + "wdio" + ], + rules: { + "quotes": [ + "error", + "double", + { + "allowTemplateLiterals": true + } + ], + "no-trailing-spaces": "error", + "@typescript-eslint/typedef": [ + "error", + { + "parameter": true + } + ], + "@typescript-eslint/semi": [ + "error" + ], + "@typescript-eslint/explicit-function-return-type": ["error"] + }, + extends: [ + "plugin:wdio/recommended", + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + ], +}; \ No newline at end of file diff --git a/README.md b/README.md index 17aaaf0..de56bb4 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,11 @@ > Before you follow the steps below, make sure you have the [Node.js](https://nodejs.org/en/download/) installed _globally_ only your system +> [Android Studio](https://developer.android.com/studio) + [Appium Server](https://appium.io/) + [Appium Inspector](https://github.com/appium/appium-inspector) Install all the necessary dependency using npm : diff --git a/config/wdio-android.conf.ts b/config/wdio-android.conf.ts index 2d81ad2..53dccf6 100644 --- a/config/wdio-android.conf.ts +++ b/config/wdio-android.conf.ts @@ -1,4 +1,4 @@ -import {join} from 'path'; +import {join} from "path"; exports.config = { @@ -6,7 +6,7 @@ exports.config = { autoCompile: true, tsNodeOpts: { transpileOnly: true, - project: 'test/tsconfig.json' + project: "test/tsconfig.json" } }, // @@ -26,16 +26,15 @@ exports.config = { maxInstances: 1, capabilities: [ { - platformName: 'Android', + platformName: "Android", maxInstances: 1, - 'appium:deviceName': 'Pixel_3_10.0', - 'appium:platformVersion': '10.0', - 'appium:orientation': 'PORTRAIT', - 'appium:automationName': 'UiAutomator2', - 'appium:app': join(process.cwd(), './app/Android.SauceLabs.Mobile.Sample.app.2.7.1.apk'), - // @ts-ignore - 'appium:appWaitActivity': 'com.swaglabsmobileapp.MainActivity', - 'appium:newCommandTimeout': 240, + "appium:deviceName": "Pixel_3_10.0", + "appium:platformVersion": "10.0", + "appium:orientation": "PORTRAIT", + "appium:automationName": "UiAutomator2", + "appium:app": join(process.cwd(), "./app/Android.SauceLabs.Mobile.Sample.app.2.7.1.apk"), + "appium:appWaitActivity": "com.swaglabsmobileapp.MainActivity", + "appium:newCommandTimeout": 240, }, ], // diff --git a/package.json b/package.json index 78147c0..76dd470 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,11 @@ "chromedriver": "^106.0.1", "wdio-chromedriver-service": "^8.0.0", "ts-node": "^10.8.0", - "typescript": "^4.6.4" + "typescript": "^4.6.4", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", + "eslint": "8.24.0", + "eslint-plugin-wdio": "7.21.0" }, "scripts": { "wdioAndroid": "wdio run config/wdio-android.conf.ts" diff --git a/test/specs/android/logIn.ts b/test/specs/android/logIn.ts index 96b8c31..ad333fa 100644 --- a/test/specs/android/logIn.ts +++ b/test/specs/android/logIn.ts @@ -1,10 +1,10 @@ -describe("My Login Demo", () => { - beforeEach(async () => { - await $("~open menu").click(); - await $('//*[@text="Log In"]').click(); - }); - - it("should not login with invalid credentials", async () => { +describe("Log in tests", () => { + // beforeEach(async () => { + // await $("~open menu").click(); + // await $('//*[@text="Log In"]').click(); + // }); + it("", async () => { + await $("~test-Username") }); }); \ No newline at end of file