Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
.project
.settings
.theia
.DS_Store
node_modules/
package-lock.json
log/
cypress/screenshots/
cypress/videos/
6 changes: 4 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
command:
npm install # installs package.json

3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"standard.enable": false,
"eslint.enable": true,
"typescript.surveys.enabled": false,
"editor.formatOnSave": false
}
63 changes: 15 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "4b7344"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -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"
}
28 changes: 28 additions & 0 deletions cypress/integration/examples/login.spec.js
Original file line number Diff line number Diff line change
@@ -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'})
})
})
28 changes: 28 additions & 0 deletions cypress/integration/examples/login_two.spec.js
Original file line number Diff line number Diff line change
@@ -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'})
})
})
22 changes: 22 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// 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
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -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) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -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')
41 changes: 41 additions & 0 deletions lambdatest-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"lambdatest_auth": {
"username": "<Your LambdaTest username>",
"access_key": "<Your LambdaTest 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
}
}
4 changes: 4 additions & 0 deletions lambdatest_run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"build_id": "4760421",
"session_id": "06f0beb1-7753-4285-ab3b-7a3196fd054e"
}
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions parallel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<class name="com.lambdatest.TestNGTodo1"/>
<class name="com.lambdatest.TestNGTodo2"/>
<class name="com.lambdatest.TestNGTodo3"/>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Loading