How to install chrome in Circle CI


To install chrome browser in CircelCi, Paste the below-mentioned commands in circle ci "pre-dependency commands"





Pre-dependency commands

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i ./google-chrome*.deb
sudo apt-get install -f

Remove an web-element from the page during runtime


To Remove the web element in the webpage during selenium execution:


Lets consider this :

Here I want to remove the footer from the webpage while executing and then take a screenshot without the footer.





Method to execute the javascript in the webpage

Method.java

public static void javaScriptExecutor(String javaScript){
    JavascriptExecutor js=null;    if (driver instanceof JavascriptExecutor) {
        js = (JavascriptExecutor)driver;    }
    js.executeScript(javaScript);}



Sample.java

//code whatever you want

Method.javaScriptExecutor("document.getElementsByClassName('footer')[0].style.display
 = \"none\";");

Change the class name as per your requirement.

After this code is executed, the footer is removed.





Integrating rollbar into java application

Rollbar is an error tracking and monitoring application.


Whenever an exception is happing in the java code, it can be logged in the rollbar to view the error log.

POM.XML:
<dependency> 
   <groupId>com.rollbar</groupId>   
   <artifactId>rollbar-java</artifactId>
    <version>1.1.0</version> 
   <exclusions> 
       <exclusion>
            <artifactId>jcl-over-slf4j</artifactId>
            <groupId>org.slf4j</groupId> 
       </exclusion>
        <exclusion>
            <artifactId>slf4j-api</artifactId>
            <groupId>org.slf4j</groupId> 
       </exclusion>
    </exclusions>
</dependency>

Rollbar.java :

package utils;
import com.rollbar.notifier.Rollbar;import com.rollbar.notifier.config.Config;
import java.net.InetAddress;
import static com.rollbar.notifier.config.ConfigBuilder.withAccessToken;
public class rollbar {
    private static Rollbar rollbar;    private static void init() {
        try {
            Config config = withAccessToken(API KEY)
                    .environment("Testing Framework")
                    .platform(InetAddress.getLocalHost().getHostName())
                    .codeVersion("1.0")
                    .build();            rollbar = Rollbar.init(config);        }
        catch (Exception e)
        {
            e.printStackTrace();            log.exception("Rollbar:init() "+"\n"+e.getStackTrace());
        }
    }

    public static void exceptionLog(Exception exception, String exceptionDetils){
        init();        rollbar.error(exception,exceptionDetils);    }

}



Now in your program, you can include the static method in try and catch block to log the details:

Rollbar.exceptionLog(e,"Exception details");


Quality Assurance Engineer - Amazon Interview question

I attend QAE-I interview in Amazon.

Totally i had 8 round of interview. 

1st round : written test
==============
5 question :  1. written programming 
                    2. pseudocode for a program 
                   3. testcase writing 
                        * Functional and non-functional testcase for booking taxi through ola app.
                  4. problem solving
                        * Skype video call is not working, find out the all possible issues.
                 5. test data enumeration  

2nd round : Problem solving 
==================

Totally 2 programming question was asked. 

1. Find the most repetitive character in a string
2. Find the first maximum repeated character in a string

3rd round : Test case enumeration
=====================

1. Testcase for birthday remainder in outlook
2. Testcase for mobile game application
3.Testcase for amazon wallet

4th round: Problem solving
=================
Program + problem solving question
1. Webpage is not loading, what could be the issue ? tell about all possible case to troubleshoot it.
2. Amazon search is not working. how to troubleshoot this issue.

5th round : Managerial Interview 
=====================
Behavioral question  + cultural fit + work done in the past 
1. testcases for banking application. which uses 3rd party app for transcation.

6th round : Bar raiser
=============
Combination of all round with cultural fit 
Few basic question like what is cross browser testing, few program and testcase for whispersync on kindle.

7th round : problem solving
==================
1. two unsorted array 
[-1,-2,4,5,6,8]
[4,3,1,2]

where k=8, find the possible combination which equal to K?

2. abcdeffghijabcd - find the maximum substring in the given string which have a non-repeated characters.

8th round: test data enumeration
====================

1. Testcase for ola app
2. test data enumeration - Given x and y, the program should return number between x and y.
i. Write the program for the above question.
ii. create testdata to break the program which i written.


At last i got the offer in amazon as QAE 😂

Appium Setup in Mac


1. Install android studio :https://developer.android.com/studio/

2. In Avd manager, install the required android os version and create the emulator.

3. Download appium :http://appium.io/

4. Setup the environment variable in .bash_profile.

 To set up :
   i. Open the terminal
   ii. Enter the command : open ~/.bash_profile

Set the environement variable like below:

export PATH=$PATH:/Users/premkumar/Library/Android/sdk
export ANDROID_HOME=/Users/premkumar/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/bin

  iii. save the file and close it.

5. Install node js : brew install node

6.  Then install appium doctor : npm install -g appium-doctor

7. Once it is installed, Run this command : appium-doctor --android

info AppiumDoctor Appium Doctor v.1.4.3
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 10.1.0
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/premkumar/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
info AppiumDoctor  ✔ adb exists at: /Users/premkumar/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: /Users/premkumar/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: /Users/premkumar/Library/Android/sdk/tools/emulator
info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

If all the things are set correct, then appium is configured properly in Mac.

8. run the program.



TO Launch Emulator in Command prompt in MAC:

${ANDROID_HOME}/emulator/emulator -avd Android



How to start appium server using Program:

Install Node Js:
https://nodejs.org/en/

Install appium:
npm install -g appium


Once the appium is installed use this method in your program to launch appium server:


private static AppiumDriverLocalService service=null;
public void startServer() {

    service = AppiumDriverLocalService.buildDefaultService();   
    service.start();

}


To Stop Appium Server Use this method in your program:

public static void stopAppiumServer() throws Exception{
    service.stop();}


To Launch Android Emulator use this method in your program :


public static void startAndroidEmulator() throws Exception{
    Process p;    if(System.getenv("ANDROID_HOME")==null)
        p=Runtime.getRuntime().exec("/Users/premkumar/Library/Android/sdk/emulator/"
+"emulator -avd "+lib.getProperty("ANDROID_DEVICE_NAME"));     
else     
   p=Runtime.getRuntime().exec(System.getenv("ANDROID_HOME")+"/emulator/"
+"emulator -avd "+lib.getProperty("ANDROID_DEVICE_NAME"));
    Thread.sleep(10000);
}

To Close Android Emulator use this method in your program:


public static void stopAndroidEmulator() throws Exception{
    Process p;  
  if(System.getenv("ANDROID_HOME")==null)
        p=Runtime.getRuntime().exec("/Users/premkumar/Library/Android/sdk/platform-tools/
adb -e emu kill");  
  else 
       p=Runtime.getRuntime().exec(System.getenv("ANDROID_HOME")+"/platform-tools/
adb -e emu kill");  
  Thread.sleep(10000);}


To launch App use this method:
(Please make sure, I used lib.getProperty method to get value from the file , in that place use the value instead of method)


public static void AndroidappLauch() throws Exception {
    DesiredCapabilities capabilities=new DesiredCapabilities();   
 capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,
lib.getProperty("ANDROID_DEVICE_NAME"));   
 capabilities.setCapability(MobileCapabilityType.APP,
System.getProperty("user.dir")+"/MobileApps/"+ 
lib.getProperty("ANDROID_APP"));   
 capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");   
 AndroidDriver driver=new AndroidDriver(new 
URL(lib.getProperty("APPIUM_SERVER_URL")), capabilities);
    framework.setAndroidDriver(driver);}

Convert resultset object to list of map

Convert the resultset object to list of map In some cases, while we doing API automation, we need to fetch the value from the DB and hav...