Skip to content

Instantly share code, notes, and snippets.

View rajaraodv's full-sized avatar

Raja Rao DV rajaraodv

View GitHub Profile
//----------------------------------------------------------------------
//CASE 1: Test Login page (BEFORE):
//-----------------------------------------------------------------------
//Lots of code to test a simple login page
@Test
public void loginTest() {
//Open browser
driver.get("https://demo.applitools.com/loginBefore.html");
@Test
public void loginTest() {
//Open browser
driver.get("https://demo.applitools.com/loginBefore.html");
//Click on the Login button
driver.findElement(By.id("log-in")).click();
//Start the test
eyes.open(driver, "Login App", "Login Page Test");
@Test
public void loginTest() {
//Open browser
driver.get("https://demo.applitools.com/loginBefore.html");
//Click on the Login button
driver.findElement(By.id("log-in")).click();
//Assert the error text
assertEquals("Please enter username and password",
@rajaraodv
rajaraodv / HackathonReporter.js
Last active July 11, 2020 03:08
An example Test Reporter method in JavaScript
//Note: This is just an example in JavaScript. This shows how to print and also how to call that method.
//Feel free to change it to your language and framework needs
const fs = require('fs');
// Get the browser, viewport and device info from a variable like below or from a file or environment variable.
const browser = "Firefox";
const viewport = "1200x700";
const device = "Laptop";
//Note: This is just an example in Java. This shows how to print and also how to call that method.
//Feel free to change it to your language and framework needs
// Get the browser, viewport and device info from a variable like below or from a file or environment variable.
public static String browser = "Firefox";
public static String viewport = "1200X700";
public static String device = "Laptop";
/**
@rajaraodv
rajaraodv / hackathon.rb
Created May 22, 2020 19:04
UFG Hackathon example reporter code
# Note: This is just an example in Ruby. This shows how to print and also how to call that method.
# Feel free to change it to your language and framework needs
# Execute example: $ rspec hackathon.rb -f documentation
require 'rspec'
# A Helper to print the test result in the following format:
# Task: <Task Number>, Test Name: <Test Name>, DOM Id:: <id>, Browser: <Browser>, Viewport: <Width x Height>, Device<Device type>, Status: <Pass | Fail>
#
//Note: This is just an example in .Net C#. This shows how to print and also how to call that method.
//Feel free to change it to your language and framework needs
using NUnit.Framework;
using OpenQA.Selenium;
using System.IO;
namespace HackathonReport3
{
[TestFixture()]
# Note: This is just an example in Python. This shows how to print and also how to call that method.
# Feel free to change it to your language and framework needs
import softest
# Get the browser, viewport and device info from a variable like below or from a file or environment variable.
browser = "Firefox"
viewport = "1200X700"
device = "Laptop"
const Validation = require('data.validation') //from folktalejs
const Success = Validation.Success
const Failure = Validation.Failure
const R = require('ramda');
function isUsernameValid(a) {
return /^(0|[1-9][0-9]*)$/.test(a) ? Failure(["Username can't be a number"]) : Success(a)
}
function isPwdLengthCorrect(a) {
@rajaraodv
rajaraodv / MyFunctor.js
Last active February 8, 2019 13:45
A sample custom functor
const add1 = (a) => a + 1;
class MyFunctor { //Custom "Functor"
constructor(value) {
this.val = value;
}
map(fn) { //Applies function to this.val + returns new Myfunctor
return new Myfunctor(fn(this.val));
}
}
//temp is a Functor instance that's storing value 1