From 20d4e661551322dca21896b0df74ed90d35e8e23 Mon Sep 17 00:00:00 2001
From: lambdapro <93367572+lambdapro@users.noreply.github.com>
Date: Thu, 10 Mar 2022 17:15:24 +0530
Subject: [PATCH 01/14] added prefromance caps
---
.idea/.gitignore | 3 +++
.idea/compiler.xml | 13 ++++++++++++
.idea/jarRepositories.xml | 20 +++++++++++++++++++
.idea/misc.xml | 12 +++++++++++
.idea/runConfigurations.xml | 10 ++++++++++
.idea/vcs.xml | 6 ++++++
pom.xml | 16 ++++++---------
src/test/java/com/lambdatest/TestNGTodo2.java | 1 +
8 files changed, 71 insertions(+), 10 deletions(-)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/jarRepositories.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/runConfigurations.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..c4718d0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d5cd614
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8723a25..30b96cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,11 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
Java-TestNG-Selenium
Java-TestNG-Selenium
0.0.1-SNAPSHOT
- Java-TestNG-Selenium/src
Java-TestNG-Selenium/src
@@ -18,10 +17,7 @@
maven-compiler-plugin
- 3.7.0
-
- 10
-
+ 3.10.0
org.apache.maven.plugins
@@ -60,17 +56,17 @@
io.appium
java-client
7.0.0
-
+
commons-io
commons-io
1.3.2
-
+
com.googlecode.json-simple
json-simple
1.1.1
-
+
\ No newline at end of file
diff --git a/src/test/java/com/lambdatest/TestNGTodo2.java b/src/test/java/com/lambdatest/TestNGTodo2.java
index 1fd4be6..a9f7806 100644
--- a/src/test/java/com/lambdatest/TestNGTodo2.java
+++ b/src/test/java/com/lambdatest/TestNGTodo2.java
@@ -32,6 +32,7 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("build", "TestNG With Java");
caps.setCapability("name", m.getName() + this.getClass().getName());
caps.setCapability("plugin", "git-testng");
+ caps.setCapability("performance",true);
String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
caps.setCapability("tags", Tags);
From 1e5922f3262759a0087fec44fa43e576ce8b0aab Mon Sep 17 00:00:00 2001
From: Amit Walia
Date: Thu, 10 Mar 2022 20:00:23 +0530
Subject: [PATCH 02/14] Network, Console and Throttling
---
.idea/compiler.xml | 1 +
.idea/runConfigurations.xml | 10 ----------
src/test/java/com/lambdatest/TestNGTodo2.java | 3 +++
3 files changed, 4 insertions(+), 10 deletions(-)
delete mode 100644 .idea/runConfigurations.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index c4718d0..3c6cdb5 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -6,6 +6,7 @@
+
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/java/com/lambdatest/TestNGTodo2.java b/src/test/java/com/lambdatest/TestNGTodo2.java
index a9f7806..6754c0b 100644
--- a/src/test/java/com/lambdatest/TestNGTodo2.java
+++ b/src/test/java/com/lambdatest/TestNGTodo2.java
@@ -33,6 +33,9 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("name", m.getName() + this.getClass().getName());
caps.setCapability("plugin", "git-testng");
caps.setCapability("performance",true);
+ caps.setCapability("network", true);
+ caps.setCapability("console", true);
+ caps.setCapability("networkThrottling", "Regular 4G");
String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
caps.setCapability("tags", Tags);
From 5c565949ca213fe677afa785a86fbfafefa75aaf Mon Sep 17 00:00:00 2001
From: Amit Walia
Date: Tue, 15 Mar 2022 01:03:36 +0530
Subject: [PATCH 03/14] network, throttling and logs
---
.idea/compiler.xml | 1 +
.idea/runConfigurations.xml | 10 ----------
src/test/java/com/lambdatest/TestNGTodo2.java | 3 +++
3 files changed, 4 insertions(+), 10 deletions(-)
delete mode 100644 .idea/runConfigurations.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index c4718d0..3c6cdb5 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -6,6 +6,7 @@
+
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/java/com/lambdatest/TestNGTodo2.java b/src/test/java/com/lambdatest/TestNGTodo2.java
index a9f7806..6754c0b 100644
--- a/src/test/java/com/lambdatest/TestNGTodo2.java
+++ b/src/test/java/com/lambdatest/TestNGTodo2.java
@@ -33,6 +33,9 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("name", m.getName() + this.getClass().getName());
caps.setCapability("plugin", "git-testng");
caps.setCapability("performance",true);
+ caps.setCapability("network", true);
+ caps.setCapability("console", true);
+ caps.setCapability("networkThrottling", "Regular 4G");
String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
caps.setCapability("tags", Tags);
From 73be282e5357a10ac8dc3941ae0a6d9b68fc5fa6 Mon Sep 17 00:00:00 2001
From: mayank2193
Date: Tue, 15 Mar 2022 16:53:44 +0530
Subject: [PATCH 04/14] cypress demo added
---
.gitignore | 6 +++
.vscode/settings.json | 6 +++
cypress.json | 3 ++
cypress/fixtures/example.json | 5 +++
cypress/integration/examples/login.spec.js | 28 +++++++++++++
.../integration/examples/login_two.spec.js | 28 +++++++++++++
cypress/plugins/index.js | 22 ++++++++++
cypress/support/commands.js | 25 +++++++++++
cypress/support/index.js | 20 +++++++++
lambdatest-config.json | 41 +++++++++++++++++++
lambdatest_run.json | 4 ++
package.json | 21 ++++++++++
12 files changed, 209 insertions(+)
create mode 100644 .vscode/settings.json
create mode 100644 cypress.json
create mode 100644 cypress/fixtures/example.json
create mode 100644 cypress/integration/examples/login.spec.js
create mode 100644 cypress/integration/examples/login_two.spec.js
create mode 100644 cypress/plugins/index.js
create mode 100644 cypress/support/commands.js
create mode 100644 cypress/support/index.js
create mode 100644 lambdatest-config.json
create mode 100644 lambdatest_run.json
create mode 100644 package.json
diff --git a/.gitignore b/.gitignore
index f70e4d3..bd21d46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,9 @@
.project
.settings
.theia
+.DS_Store
+node_modules/
+package-lock.json
+log/
+cypress/screenshots/
+cypress/videos/
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..fe3f751
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "standard.enable": false,
+ "eslint.enable": true,
+ "typescript.surveys.enabled": false,
+ "editor.formatOnSave": false
+}
diff --git a/cypress.json b/cypress.json
new file mode 100644
index 0000000..43130e0
--- /dev/null
+++ b/cypress.json
@@ -0,0 +1,3 @@
+{
+ "projectId": "4b7344"
+}
diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json
new file mode 100644
index 0000000..02e4254
--- /dev/null
+++ b/cypress/fixtures/example.json
@@ -0,0 +1,5 @@
+{
+ "name": "Using fixtures to represent data",
+ "email": "hello@cypress.io",
+ "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/cypress/integration/examples/login.spec.js b/cypress/integration/examples/login.spec.js
new file mode 100644
index 0000000..ea24f58
--- /dev/null
+++ b/cypress/integration/examples/login.spec.js
@@ -0,0 +1,28 @@
+describe('E2E Tests - Login', () => {
+ it('I navigate to the login page', () => {
+ cy.visit('https://the-internet.herokuapp.com/login')
+ cy.get('h2').should('contain', 'Login Page')
+ })
+
+ it('I submit invalid login credentials', () => {
+ cy.get('#username').type('invalid_usr')
+ cy.get('#password').type('invalid_pass')
+ cy.get('button[type="submit"]').click()
+ cy.get('.flash.error').should('be.visible')
+ cy.screenshot({capture: 'fullPage'})
+ })
+
+ it('I submit valid login credentials', () => {
+ cy.get('#username').type('tomsmith')
+ cy.get('#password').type('SuperSecretPassword!')
+ cy.get('button[type="submit"]').click()
+ cy.get('.flash.success').should('be.visible')
+ cy.screenshot({capture: 'fullPage'})
+ })
+
+ it('I logout from the app', () => {
+ cy.get('.button.secondary.radius').click()
+ cy.get('h2').should('contain', 'Login Page')
+ cy.screenshot({capture: 'fullPage'})
+ })
+})
diff --git a/cypress/integration/examples/login_two.spec.js b/cypress/integration/examples/login_two.spec.js
new file mode 100644
index 0000000..21c1bdb
--- /dev/null
+++ b/cypress/integration/examples/login_two.spec.js
@@ -0,0 +1,28 @@
+describe('E2E Tests - Login_two', () => {
+ it('I navigate to the login page', () => {
+ cy.visit('https://the-internet.herokuapp.com/login')
+ cy.get('h2').should('contain', 'Login Page')
+ })
+
+ it('I submit invalid login credentials', () => {
+ cy.get('#username').type('invalid_usr')
+ cy.get('#password').type('invalid_pass')
+ cy.get('button[type="submit"]').click()
+ cy.get('.flash.error').should('be.visible')
+ cy.screenshot({capture: 'fullPage'})
+ })
+
+ it('I submit valid login credentials', () => {
+ cy.get('#username').type('tomsmith')
+ cy.get('#password').type('SuperSecretPassword!')
+ cy.get('button[type="submit"]').click()
+ cy.get('.flash.success').should('be.visible')
+ cy.screenshot({capture: 'fullPage'})
+ })
+
+ it('I logout from the app', () => {
+ cy.get('.button.secondary.radius').click()
+ cy.get('h2').should('contain', 'Login Page')
+ cy.screenshot({capture: 'fullPage'})
+ })
+})
diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js
new file mode 100644
index 0000000..59b2bab
--- /dev/null
+++ b/cypress/plugins/index.js
@@ -0,0 +1,22 @@
+///
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+module.exports = (on, config) => {
+ // `on` is used to hook into various events Cypress emits
+ // `config` is the resolved Cypress config
+}
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
new file mode 100644
index 0000000..119ab03
--- /dev/null
+++ b/cypress/support/commands.js
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
diff --git a/cypress/support/index.js b/cypress/support/index.js
new file mode 100644
index 0000000..d68db96
--- /dev/null
+++ b/cypress/support/index.js
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
diff --git a/lambdatest-config.json b/lambdatest-config.json
new file mode 100644
index 0000000..4b4011a
--- /dev/null
+++ b/lambdatest-config.json
@@ -0,0 +1,41 @@
+{
+ "lambdatest_auth": {
+ "username": "",
+ "access_key": ""
+ },
+ "browsers": [
+ {
+ "browser": "Chrome",
+ "platform": "Windows 10",
+ "versions": [
+ "latest-1"
+ ]
+ },
+ {
+ "browser": "Firefox",
+ "platform": "macOS Big Sur",
+ "versions": [
+ "latest"
+ ]
+ }
+ ],
+ "run_settings": {
+ "cypress_config_file": "cypress.json",
+ "build_name": "Cypress-Demo",
+ "parallels": 4,
+
+ "specs": "./cypress/integration/examples/*.spec.js",
+ "ignore_files": "",
+ "feature_file_suppport": false,
+ "network": true,
+ "headless": false,
+ "reporter_config_file": "",
+ "npm_dependencies": {
+ "cypress": "9.0.0"
+ }
+ },
+ "tunnel_settings": {
+ "tunnel": false,
+ "tunnel_name": null
+ }
+}
\ No newline at end of file
diff --git a/lambdatest_run.json b/lambdatest_run.json
new file mode 100644
index 0000000..4b3cbef
--- /dev/null
+++ b/lambdatest_run.json
@@ -0,0 +1,4 @@
+{
+ "build_id": "4760421",
+ "session_id": "06f0beb1-7753-4285-ab3b-7a3196fd054e"
+}
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a1c4433
--- /dev/null
+++ b/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "Cypress_Lambdatest_Demo",
+ "version": "0.0.0-development",
+ "description": "This is an example app used to showcase Cypress.io testing. For a full reference of our documentation, go to https://docs.cypress.io",
+ "main": "index.js",
+ "files": [
+ "app",
+ "cypress"
+ ],
+ "scripts": {
+ "test": "npx lambdatest-cypress run"
+ },
+ "author": "Mayank Maurya",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "cypress": "6.2.1",
+ "lambdatest-cypress-cli": "2.3.0",
+ "typescript": "3.7.4"
+ }
+}
From 7d44942b4650061857fac4293f01e2166700bc15 Mon Sep 17 00:00:00 2001
From: mayank2193
Date: Tue, 15 Mar 2022 18:44:31 +0530
Subject: [PATCH 05/14] README.md modified
---
README.md | 63 +++++++++++++------------------------------------------
1 file changed, 15 insertions(+), 48 deletions(-)
diff --git a/README.md b/README.md
index 3817122..6325dee 100644
--- a/README.md
+++ b/README.md
@@ -1,59 +1,26 @@
-# Java TestNG Selenium & Appium
-
-### Environment Setup
-
-1. Global Dependencies
- * Install [Maven](https://maven.apache.org/install.html)
- * Or Install Maven with [Homebrew](http://brew.sh/) (Easier)
- ```
- $ mvn install
- ```
-2. Project Dependencies
- * checkout the repository
- * Check that packages are available
- ```
- $ cd Java_TestNG_Web-App
- ```
- * You may also want to run the command below to check for outdated dependencies. Please be sure to verify and review updates before editing your pom.xml file as they may not be compatible with your code.
- ```
- $ mvn versions:display-dependency-updates
- ```
-
-**LambdaTest Authentication Credentials:** Make sure you have your LambdaTest credentials with you to run test automation scripts with Jest on LambdaTest Selenium Grid. You can obtain these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/) or through [LambdaTest Profile](https://accounts.lambdatest.com/detail/profile).
-
-Set LambdaTest Username and Access Key in environment variables.
-
-* For Linux/macOS:
-`export LT_USERNAME="YOUR_USERNAME"
-export LT_ACCESS_KEY="YOUR ACCESS KEY"`
-
-* For Windows:
-`set LT_USERNAME="YOUR_USERNAME"
-set LT_ACCESS_KEY="YOUR ACCESS KEY"`
-
-### Running Tests
```
-To run single test (Web Browser Automation)
- $ mvn test -D suite=single.xml
+To run single test (Web Browser Automation) use below command
+ mvn test -D suite=single.xml
-To run parallel test (Web Browser Automation)
- $ mvn test -D suite=parallel.xml
+To run parallel test (Web Browser Automation) use below command
+ mvn test -D suite=parallel.xml
-To run single test (Android App Automation)
- $ mvn test -D suite=android_single.xml
+To run single test (Android App Automation) use below command
+ mvn test -D suite=android_single.xml
-To run single test (Android App Automation)
- $ mvn test -D suite=android_parallel.xml
+To run single test (Android App Automation) use below command
+ mvn test -D suite=android_parallel.xml
-To run single test (iOS App Automation)
- $ mvn test -D suite=iOS_single.xml
+To run single test (iOS App Automation) use below command
+ mvn test -D suite=iOS_single.xml
-To run single test (iOS App Automation)
- $ mvn test -D suite=iOS_parallel.xml
+To run single test (iOS App Automation) use below command
+ mvn test -D suite=iOS_parallel.xml
+
+To run Cypress Test use below command
+ npm test
```
-## About LambdaTest
-[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.
From 444c22fbf73f7a9d06e7a535da2fe35d94112044 Mon Sep 17 00:00:00 2001
From: Amit Walia
Date: Tue, 15 Mar 2022 19:00:05 +0530
Subject: [PATCH 06/14] Logs and Video enabled
---
src/test/java/com/lambdatest/TestNGTodo1.java | 9 +++++++++
src/test/java/com/lambdatest/TestNGTodo2.java | 4 ++++
src/test/java/com/lambdatest/TestNGTodo3.java | 9 +++++++++
3 files changed, 22 insertions(+)
diff --git a/src/test/java/com/lambdatest/TestNGTodo1.java b/src/test/java/com/lambdatest/TestNGTodo1.java
index 62577d1..508422e 100644
--- a/src/test/java/com/lambdatest/TestNGTodo1.java
+++ b/src/test/java/com/lambdatest/TestNGTodo1.java
@@ -32,6 +32,15 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("build", "TestNG With Java");
caps.setCapability("name", m.getName() + " - " + this.getClass().getName());
caps.setCapability("plugin", "git-testng");
+ caps.setCapability("performance",true);
+ caps.setCapability("network", true);
+ caps.setCapability("console", true);
+ caps.setCapability("networkThrottling", "Regular 4G");
+ caps.setCapability("commandLog", true);
+ caps.setCapability("systemLog", true);
+ caps.setCapability("terminal", true);
+ caps.setCapability("video", true);
+
String[] Tags = new String[] { "Feature", "Falcon", "Severe" };
caps.setCapability("tags", Tags);
diff --git a/src/test/java/com/lambdatest/TestNGTodo2.java b/src/test/java/com/lambdatest/TestNGTodo2.java
index 6754c0b..64c4277 100644
--- a/src/test/java/com/lambdatest/TestNGTodo2.java
+++ b/src/test/java/com/lambdatest/TestNGTodo2.java
@@ -36,6 +36,10 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("network", true);
caps.setCapability("console", true);
caps.setCapability("networkThrottling", "Regular 4G");
+ caps.setCapability("commandLog", true);
+ caps.setCapability("systemLog", true);
+ caps.setCapability("terminal", true);
+ caps.setCapability("video", true);
String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
caps.setCapability("tags", Tags);
diff --git a/src/test/java/com/lambdatest/TestNGTodo3.java b/src/test/java/com/lambdatest/TestNGTodo3.java
index 632320c..8d12abf 100644
--- a/src/test/java/com/lambdatest/TestNGTodo3.java
+++ b/src/test/java/com/lambdatest/TestNGTodo3.java
@@ -32,6 +32,15 @@ public void setup(Method m, ITestContext ctx) throws MalformedURLException {
caps.setCapability("build", "TestNG With Java");
caps.setCapability("name", m.getName() + this.getClass().getName());
caps.setCapability("plugin", "git-testng");
+ caps.setCapability("performance",true);
+ caps.setCapability("network", true);
+ caps.setCapability("console", true);
+ caps.setCapability("networkThrottling", "Regular 4G");
+ caps.setCapability("commandLog", true);
+ caps.setCapability("systemLog", true);
+ caps.setCapability("terminal", true);
+ caps.setCapability("video", true);
+
String[] Tags = new String[] { "Feature", "Tag", "Moderate" };
caps.setCapability("tags", Tags);
From 2adb0680ae731181b6fa0c83dc070096157deb92 Mon Sep 17 00:00:00 2001
From: DeeLambdaTest <93642921+DeeLambdaTest@users.noreply.github.com>
Date: Thu, 17 Mar 2022 17:52:32 +0530
Subject: [PATCH 07/14] First commit to Deeksha
---
.../com/lambdaTestApp/android/Android1.java | 18 +++++------
.../com/lambdaTestApp/android/Android2.java | 11 +++----
.../android/AppUploadAndroid.java | 28 ++++++++++++++++
.../java/com/lambdaTestApp/iOS/AppUpload.java | 32 +++++++++++++++++++
src/test/java/com/lambdaTestApp/iOS/iOS1.java | 7 ++--
src/test/java/com/lambdaTestApp/iOS/iOS2.java | 7 ++--
6 files changed, 81 insertions(+), 22 deletions(-)
create mode 100644 src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
create mode 100644 src/test/java/com/lambdaTestApp/iOS/AppUpload.java
diff --git a/src/test/java/com/lambdaTestApp/android/Android1.java b/src/test/java/com/lambdaTestApp/android/Android1.java
index 9b36509..0bdd1a3 100644
--- a/src/test/java/com/lambdaTestApp/android/Android1.java
+++ b/src/test/java/com/lambdaTestApp/android/Android1.java
@@ -1,5 +1,6 @@
package com.lambdaTestApp.android;
+import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.net.MalformedURLException;
@@ -13,25 +14,22 @@
import org.testng.annotations.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
-public class Android1 {
+public class Android1 extends AppUploadAndroid{
String userName = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
- String android_appurl = System.getenv("android_appurl") == null ? "Your android appurl" : System.getenv("android_appurl");
@Test
- public void basicTest() throws MalformedURLException,
- InterruptedException {
+ public void basicTest() throws IOException, InterruptedException {
+ String android_appurl = upload();
DesiredCapabilities caps = new DesiredCapabilities();
-
- caps.setCapability("platformName", "Android");
- caps.setCapability("deviceName", "Galaxy Tab S4");
- caps.setCapability("platformVersion", "10");
+ caps.setCapability("deviceName", "Galaxy S21");
caps.setCapability("isRealMobile", true);
- caps.setCapability("project", "App Automation Demo");
+ caps.setCapability("platformVersion","11");
+ caps.setCapability("platformName", "Android");
caps.setCapability("build", "Android");
caps.setCapability("name", "Single Test");
- caps.setCapability("app", android_appurl );
+ caps.setCapability("app", android_appurl);
AndroidDriver driver = new AndroidDriver(
new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"),
diff --git a/src/test/java/com/lambdaTestApp/android/Android2.java b/src/test/java/com/lambdaTestApp/android/Android2.java
index f0f2a6d..6ab36b4 100644
--- a/src/test/java/com/lambdaTestApp/android/Android2.java
+++ b/src/test/java/com/lambdaTestApp/android/Android2.java
@@ -1,5 +1,6 @@
package com.lambdaTestApp.android;
+import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.net.MalformedURLException;
@@ -13,22 +14,20 @@
import org.testng.annotations.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
-public class Android2 {
+public class Android2 extends AppUploadAndroid {
String userName = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
- String android_appurl = System.getenv("android_appurl") == null ? "Your android appurl" : System.getenv("android_appurl");
@Test
- public void basicTest() throws MalformedURLException,
- InterruptedException {
+ public void basicTest() throws IOException,
+ InterruptedException {
+ String android_appurl = upload();
DesiredCapabilities caps = new DesiredCapabilities();
-
caps.setCapability("platformName", "Android");
caps.setCapability("deviceName", "Google Pixel 4");
caps.setCapability("platformVersion", "11");
caps.setCapability("isRealMobile", true);
- caps.setCapability("project", "App Automation Demo");
caps.setCapability("build", "Android");
caps.setCapability("name", "Single Test");
caps.setCapability("app", android_appurl);
diff --git a/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java b/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
new file mode 100644
index 0000000..1c59b28
--- /dev/null
+++ b/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
@@ -0,0 +1,28 @@
+package com.lambdaTestApp.android;
+
+import okhttp3.*;
+
+import java.io.File;
+import java.io.IOException;
+
+public class AppUploadAndroid {
+ public String upload() throws IOException {
+ OkHttpClient client = new OkHttpClient().newBuilder()
+ .build();
+ MediaType mediaType = MediaType.parse("text/plain");
+ RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
+ .addFormDataPart("appFile","apps/WikipediaSample.apk",
+ RequestBody.create(MediaType.parse("application/octet-stream"),
+ new File("apps/WikipediaSample.apk")))
+ .build();
+ Request request = new Request.Builder()
+ .url("https://manual-api.lambdatest.com/app/upload/realDevice")
+ .method("POST", body)
+ .addHeader("Authorization", "Basic ZGVla3NoYXNhbHVndTp0RlU2ZzBjcmJHSjg1V0tDR3U0V1ZTNnJyUGxYOXdRdGM1U29KeG1rNDBvaVNWY0FjVQ==")
+ .build();
+ Response response = client.newCall(request).execute();
+ String a = response.body().string().substring(96,127);
+ System.out.println(a);
+ return a;
+ }
+}
diff --git a/src/test/java/com/lambdaTestApp/iOS/AppUpload.java b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
new file mode 100644
index 0000000..e969c8c
--- /dev/null
+++ b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
@@ -0,0 +1,32 @@
+package com.lambdaTestApp.iOS;
+
+import okhttp3.*;
+
+import java.io.File;
+import java.io.IOException;
+
+public class AppUpload {
+ public String upload() throws IOException {
+ OkHttpClient client = new OkHttpClient().newBuilder()
+ .build();
+ MediaType mediaType = MediaType.parse("text/plain");
+ RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
+ .addFormDataPart("appFile", "apps/lambdatest.ipa",
+ RequestBody.create(MediaType.parse("application/octet-stream"),
+ new File("apps/lambdatest.ipa")))
+ .addFormDataPart("name", "Demo")
+ .build();
+ Request request = new Request.Builder()
+ .url("https://manual-api.lambdatest.com/app/upload/realDevice")
+ .method("POST", body)
+ .addHeader("Authorization", "Basic ZGVla3NoYXNhbHVndTp0RlU2ZzBjcmJHSjg1V0tDR3U0V1ZTNnJyUGxYOXdRdGM1U29KeG1rNDBvaVNWY0FjVQ==")
+ .build();
+ Response response = client.newCall(request).execute();
+ String a = response.body().string().substring(77,108);
+ System.out.println(a);
+ return a;
+ }
+}
+
+// String a[] = response.body().string().split(":");
+//System.out.println(a[4]);
\ No newline at end of file
diff --git a/src/test/java/com/lambdaTestApp/iOS/iOS1.java b/src/test/java/com/lambdaTestApp/iOS/iOS1.java
index d081f60..ae8e87e 100644
--- a/src/test/java/com/lambdaTestApp/iOS/iOS1.java
+++ b/src/test/java/com/lambdaTestApp/iOS/iOS1.java
@@ -1,5 +1,6 @@
package com.lambdaTestApp.iOS;
+import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
@@ -12,13 +13,13 @@
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
-public class iOS1 {
+public class iOS1 extends AppUpload {
public static String username = System.getenv("LT_USERNAME");
public static String accessKey = System.getenv("LT_ACCESS_KEY");
- public static String iOS_appurl = System.getenv("iOS_appurl");
@Test
- public void basicTest() throws MalformedURLException, InterruptedException {
+ public void basicTest() throws IOException, InterruptedException {
+ String iOS_appurl = upload();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "iOSAppAutomation_LT");
capabilities.setCapability("name", "iOS_Test");
diff --git a/src/test/java/com/lambdaTestApp/iOS/iOS2.java b/src/test/java/com/lambdaTestApp/iOS/iOS2.java
index 3975c83..4f28bf2 100644
--- a/src/test/java/com/lambdaTestApp/iOS/iOS2.java
+++ b/src/test/java/com/lambdaTestApp/iOS/iOS2.java
@@ -1,5 +1,6 @@
package com.lambdaTestApp.iOS;
+import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
@@ -12,13 +13,13 @@
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
-public class iOS2 {
+public class iOS2 extends AppUpload {
public static String username = System.getenv("LT_USERNAME");
public static String accessKey = System.getenv("LT_ACCESS_KEY");
- public static String iOS_appurl = System.getenv("iOS_appurl");
@Test
- public void basicTest() throws MalformedURLException, InterruptedException {
+ public void basicTest() throws IOException, InterruptedException {
+ String iOS_appurl = upload();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "iOSAppAutomation_LT");
capabilities.setCapability("name", "iOS_Test");
From a3766c4a60ee2d7200cdcd6f98b710f5c04eb668 Mon Sep 17 00:00:00 2001
From: DeeLambdaTest <93642921+DeeLambdaTest@users.noreply.github.com>
Date: Thu, 17 Mar 2022 20:54:05 +0530
Subject: [PATCH 08/14] Added AppUpload classes
---
parallel.xml | 1 +
src/test/java/com/lambdaTestApp/iOS/AppUpload.java | 3 ---
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/parallel.xml b/parallel.xml
index 21cddc0..06c588a 100644
--- a/parallel.xml
+++ b/parallel.xml
@@ -6,6 +6,7 @@
+
\ No newline at end of file
diff --git a/src/test/java/com/lambdaTestApp/iOS/AppUpload.java b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
index e969c8c..215f2ea 100644
--- a/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
+++ b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
@@ -27,6 +27,3 @@ public String upload() throws IOException {
return a;
}
}
-
-// String a[] = response.body().string().split(":");
-//System.out.println(a[4]);
\ No newline at end of file
From 2e5de5bf7344e9f34450c532969f2bc0aca98ee1 Mon Sep 17 00:00:00 2001
From: lambdapro <93367572+lambdapro@users.noreply.github.com>
Date: Fri, 18 Mar 2022 01:24:28 +0530
Subject: [PATCH 09/14] Update .gitpod.yml
---
.gitpod.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.gitpod.yml b/.gitpod.yml
index 2f1526e..b520d64 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -5,5 +5,7 @@ ports:
# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
tasks:
- - init: mvn install -Dsuite=parallel.xml # runs during prebuild
- command: echo 'Please check your test on https://automation.lambdatest.com/'
+ - init: mvn install # runs during prebuild
+ npm install # installs package.json
+ command:
+ echo 'Please check your test on https://automation.lambdatest.com/'
From 293c4fba6f136af5ee5c0bda11a7ce4191cbd37e Mon Sep 17 00:00:00 2001
From: lambdapro <93367572+lambdapro@users.noreply.github.com>
Date: Fri, 18 Mar 2022 01:28:52 +0530
Subject: [PATCH 10/14] Update .gitpod.yml
---
.gitpod.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitpod.yml b/.gitpod.yml
index b520d64..cd55283 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -6,6 +6,6 @@ ports:
# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: mvn install # runs during prebuild
- npm install # installs package.json
command:
+ npm install # installs package.json
echo 'Please check your test on https://automation.lambdatest.com/'
From a3d6c93f67f66c6ae7288f997a27104421c93557 Mon Sep 17 00:00:00 2001
From: lambdapro <93367572+lambdapro@users.noreply.github.com>
Date: Fri, 18 Mar 2022 01:29:20 +0530
Subject: [PATCH 11/14] Update .gitpod.yml
---
.gitpod.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitpod.yml b/.gitpod.yml
index cd55283..7a33b68 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -8,4 +8,4 @@ tasks:
- init: mvn install # runs during prebuild
command:
npm install # installs package.json
- echo 'Please check your test on https://automation.lambdatest.com/'
+
From 5e5360bc1dea78b72396dcab6dc21b98378e72a6 Mon Sep 17 00:00:00 2001
From: lambdapro <93367572+lambdapro@users.noreply.github.com>
Date: Fri, 18 Mar 2022 01:36:24 +0530
Subject: [PATCH 12/14] Update TestNGTodo2.java
---
src/test/java/com/lambdatest/TestNGTodo2.java | 86 ++++++++++++++++++-
1 file changed, 85 insertions(+), 1 deletion(-)
diff --git a/src/test/java/com/lambdatest/TestNGTodo2.java b/src/test/java/com/lambdatest/TestNGTodo2.java
index 4904811..dda3707 100644
--- a/src/test/java/com/lambdatest/TestNGTodo2.java
+++ b/src/test/java/com/lambdatest/TestNGTodo2.java
@@ -93,6 +93,90 @@ public void basicTest() throws InterruptedException {
driver.findElement(By.id("addbutton")).click();
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li9")).click();
+ driver.get("https://lambdatest.github.io/sample-todo-app/");
+
+ System.out.println("Checking Box");
+ driver.findElement(By.name("li1")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li2")).click();
+
+ System.out.println("Checking Box");
+ driver.findElement(By.name("li3")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li4")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 6");
+ driver.findElement(By.id("addbutton")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 7");
+ driver.findElement(By.id("addbutton")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 8");
+ driver.findElement(By.id("addbutton")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li1")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li3")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li7")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li8")).click();
+
+ System.out.println("Entering Text");
+ driver.findElement(By.id("sampletodotext")).sendKeys("Get Taste of Lambda and Stick to It");
+
+ driver.findElement(By.id("addbutton")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li9")).click();
+ driver.get("https://lambdatest.github.io/sample-todo-app/");
+
+ System.out.println("Checking Box");
+ driver.findElement(By.name("li1")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li2")).click();
+
+ System.out.println("Checking Box");
+ driver.findElement(By.name("li3")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li4")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 6");
+ driver.findElement(By.id("addbutton")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 7");
+ driver.findElement(By.id("addbutton")).click();
+
+ driver.findElement(By.id("sampletodotext")).sendKeys(" List Item 8");
+ driver.findElement(By.id("addbutton")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li1")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li3")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li7")).click();
+
+ System.out.println("Checking Another Box");
+ driver.findElement(By.name("li8")).click();
+
+ System.out.println("Entering Text");
+ driver.findElement(By.id("sampletodotext")).sendKeys("Get Taste of Lambda and Stick to It");
+
+ driver.findElement(By.id("addbutton")).click();
+
System.out.println("Checking Another Box");
driver.findElement(By.name("li9")).click();
@@ -113,4 +197,4 @@ public void tearDown() {
driver.quit();
}
-}
\ No newline at end of file
+}
From 571836ccc5ec9fd34ddf7d2db149d553b8d2453e Mon Sep 17 00:00:00 2001
From: DeeLambdaTest <93642921+DeeLambdaTest@users.noreply.github.com>
Date: Wed, 23 Mar 2022 18:52:53 +0530
Subject: [PATCH 13/14] Second commit
---
pom.xml | 10 +++++++++-
.../com/lambdaTestApp/android/Android1.java | 12 ++++++++----
.../com/lambdaTestApp/android/Android2.java | 4 ++--
.../android/AppUploadAndroid.java | 18 +++++++++++++-----
.../java/com/lambdaTestApp/iOS/AppUpload.java | 13 +++++++------
src/test/java/com/lambdaTestApp/iOS/iOS1.java | 4 ++--
src/test/java/com/lambdaTestApp/iOS/iOS2.java | 6 +++---
7 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/pom.xml b/pom.xml
index 30b96cf..75b8f8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,15 @@
-
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 7
+ 7
+
+
+
diff --git a/src/test/java/com/lambdaTestApp/android/Android1.java b/src/test/java/com/lambdaTestApp/android/Android1.java
index 0bdd1a3..a720b9b 100644
--- a/src/test/java/com/lambdaTestApp/android/Android1.java
+++ b/src/test/java/com/lambdaTestApp/android/Android1.java
@@ -9,19 +9,23 @@
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.tools.ant.taskdefs.condition.IsFalse;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
+import java.util.Objects;
-public class Android1 extends AppUploadAndroid{
-
+public class Android1 {
+ public static boolean uploaded;
String userName = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
@Test
public void basicTest() throws IOException, InterruptedException {
- String android_appurl = upload();
+ AppUploadAndroid.upload();
+
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "Galaxy S21");
caps.setCapability("isRealMobile", true);
@@ -29,7 +33,7 @@ public void basicTest() throws IOException, InterruptedException {
caps.setCapability("platformName", "Android");
caps.setCapability("build", "Android");
caps.setCapability("name", "Single Test");
- caps.setCapability("app", android_appurl);
+ caps.setCapability("app", "android_appurl");
AndroidDriver driver = new AndroidDriver(
new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"),
diff --git a/src/test/java/com/lambdaTestApp/android/Android2.java b/src/test/java/com/lambdaTestApp/android/Android2.java
index 6ab36b4..163f4c8 100644
--- a/src/test/java/com/lambdaTestApp/android/Android2.java
+++ b/src/test/java/com/lambdaTestApp/android/Android2.java
@@ -22,7 +22,7 @@ public class Android2 extends AppUploadAndroid {
@Test
public void basicTest() throws IOException,
InterruptedException {
- String android_appurl = upload();
+ AppUploadAndroid.upload();
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "Android");
caps.setCapability("deviceName", "Google Pixel 4");
@@ -30,7 +30,7 @@ public void basicTest() throws IOException,
caps.setCapability("isRealMobile", true);
caps.setCapability("build", "Android");
caps.setCapability("name", "Single Test");
- caps.setCapability("app", android_appurl);
+ caps.setCapability("app", "android_appurl");
AndroidDriver driver = new AndroidDriver(
new URL("https://" + userName + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"),
diff --git a/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java b/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
index 1c59b28..c2cea1c 100644
--- a/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
+++ b/src/test/java/com/lambdaTestApp/android/AppUploadAndroid.java
@@ -1,12 +1,20 @@
package com.lambdaTestApp.android;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializer;
import okhttp3.*;
+import org.json.simple.JSONObject;
+import org.openqa.selenium.json.Json;
import java.io.File;
import java.io.IOException;
public class AppUploadAndroid {
- public String upload() throws IOException {
+ public static String userName = System.getenv("LT_USERNAME");
+ public static String accessKey = System.getenv("LT_ACCESS_KEY");
+ public static void upload () throws IOException {
+ String credential = Credentials.basic(userName, accessKey);
+
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
@@ -14,15 +22,15 @@ public String upload() throws IOException {
.addFormDataPart("appFile","apps/WikipediaSample.apk",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("apps/WikipediaSample.apk")))
+ .addFormDataPart("custom_id","android_appurl")
.build();
Request request = new Request.Builder()
.url("https://manual-api.lambdatest.com/app/upload/realDevice")
.method("POST", body)
- .addHeader("Authorization", "Basic ZGVla3NoYXNhbHVndTp0RlU2ZzBjcmJHSjg1V0tDR3U0V1ZTNnJyUGxYOXdRdGM1U29KeG1rNDBvaVNWY0FjVQ==")
+ .addHeader("Authorization", credential)
.build();
Response response = client.newCall(request).execute();
- String a = response.body().string().substring(96,127);
- System.out.println(a);
- return a;
+ System.out.println(response.body().string());
+
}
}
diff --git a/src/test/java/com/lambdaTestApp/iOS/AppUpload.java b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
index 215f2ea..345aa70 100644
--- a/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
+++ b/src/test/java/com/lambdaTestApp/iOS/AppUpload.java
@@ -6,7 +6,11 @@
import java.io.IOException;
public class AppUpload {
- public String upload() throws IOException {
+ public static String userName = System.getenv("LT_USERNAME");
+ public static String accessKey = System.getenv("LT_ACCESS_KEY");
+ public static void upload1() throws IOException {
+ String credential = Credentials.basic(userName, accessKey);
+
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
@@ -14,16 +18,13 @@ public String upload() throws IOException {
.addFormDataPart("appFile", "apps/lambdatest.ipa",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("apps/lambdatest.ipa")))
- .addFormDataPart("name", "Demo")
+ .addFormDataPart("custom_id","iOS_appurl")
.build();
Request request = new Request.Builder()
.url("https://manual-api.lambdatest.com/app/upload/realDevice")
.method("POST", body)
- .addHeader("Authorization", "Basic ZGVla3NoYXNhbHVndTp0RlU2ZzBjcmJHSjg1V0tDR3U0V1ZTNnJyUGxYOXdRdGM1U29KeG1rNDBvaVNWY0FjVQ==")
+ .addHeader("Authorization", credential)
.build();
Response response = client.newCall(request).execute();
- String a = response.body().string().substring(77,108);
- System.out.println(a);
- return a;
}
}
diff --git a/src/test/java/com/lambdaTestApp/iOS/iOS1.java b/src/test/java/com/lambdaTestApp/iOS/iOS1.java
index ae8e87e..8078fb0 100644
--- a/src/test/java/com/lambdaTestApp/iOS/iOS1.java
+++ b/src/test/java/com/lambdaTestApp/iOS/iOS1.java
@@ -19,7 +19,7 @@ public class iOS1 extends AppUpload {
@Test
public void basicTest() throws IOException, InterruptedException {
- String iOS_appurl = upload();
+ AppUpload.upload1();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "iOSAppAutomation_LT");
capabilities.setCapability("name", "iOS_Test");
@@ -29,7 +29,7 @@ public void basicTest() throws IOException, InterruptedException {
capabilities.setCapability("platformVersion", "15.0");
capabilities.setCapability("console", true);
capabilities.setCapability("visual", true);
- capabilities.setCapability("app", iOS_appurl);
+ capabilities.setCapability("app", "iOS_appurl");
IOSDriver driver = new IOSDriver(
new URL("https://" + username + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"),
diff --git a/src/test/java/com/lambdaTestApp/iOS/iOS2.java b/src/test/java/com/lambdaTestApp/iOS/iOS2.java
index 4f28bf2..8e321ae 100644
--- a/src/test/java/com/lambdaTestApp/iOS/iOS2.java
+++ b/src/test/java/com/lambdaTestApp/iOS/iOS2.java
@@ -19,17 +19,17 @@ public class iOS2 extends AppUpload {
@Test
public void basicTest() throws IOException, InterruptedException {
- String iOS_appurl = upload();
+ AppUpload.upload1();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "iOSAppAutomation_LT");
capabilities.setCapability("name", "iOS_Test");
capabilities.setCapability("platformName", "iOS");
- capabilities.setCapability("deviceName", "iPhone 11");
+ capabilities.setCapability("deviceName", "iPhone 8");
capabilities.setCapability("isRealMobile", true);
capabilities.setCapability("platformVersion", "13.0");
capabilities.setCapability("console", true);
capabilities.setCapability("visual", true);
- capabilities.setCapability("app", iOS_appurl);
+ capabilities.setCapability("app", "iOS_appurl");
IOSDriver driver = new IOSDriver(
new URL("https://" + username + ":" + accessKey + "@beta-hub.lambdatest.com/wd/hub"),
From 4549a273a0a3e6872331dcb29250c1c1afe41918 Mon Sep 17 00:00:00 2001
From: DeeLambdaTest <93642921+DeeLambdaTest@users.noreply.github.com>
Date: Thu, 31 Mar 2022 19:45:18 +0530
Subject: [PATCH 14/14] Pushing use of lambda hooks to fail test
---
runThis.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 runThis.txt
diff --git a/runThis.txt b/runThis.txt
new file mode 100644
index 0000000..e69de29