Skip to content

Instantly share code, notes, and snippets.

View batmi02's full-sized avatar

Michael Battat batmi02

  • Applitools
View GitHub Profile
@Test
public void iFrameTest() {
// Navigate to the app
driver.get("http://localhost:8000/iFrameExample.html");
//----------------- FRAME 1 ------------------------------
// Grab the outermost frame
driver.switchTo().defaultContent();
//switch context to outer frameset
@Before
public void beforeEach() {
}
@Test
public void chartTest1() {
eyes.open(driver, "Demo App", "ChartTest 1", new RectangleSize(1200,800));
driver.get("http://localhost:8000/BarChart.html");
eyes.checkWindow("1st Test Window");
@BeforeClass
public static void setBatch() {
// Must be before ALL tests (at Class Level)
batch = new BatchInfo("Data Driven Testing");
// Initialize the Runner for your test
runner - new ClassicRunner();
//Initialize the eyes SDK
eyes = new Eyes(runner);
@Test
@UseDataProvider("testForDataFailure")
public void testLoginFailure(String username, String password, String expected, String testName, string locatorId) {
//try loggin in with username and password
login(username,password);
//get the text from the alert element
String actual = driver.findElement(By.id("alert")).getText();
assertEquals(testName, expected, actual);
}
@Before
public void beforeEach() {
//Open the app
driver.get("http://localhost:8000/tablesort.html");
//Click on the Rank column
driver.findElement(By.id("rank")).click();
}
//Start the test capture
eyes.open(driver, “Demo App”, “Login Page Test”, new RectangleSize(800,800));
//Take a screenshot so AI can analyze
eyes.checkWindow(“Login Window);
//End the test
eyes.closeAsync();
it(‘should add a new todo to the list’, () => {
cy.visit(‘http://todomvc-app-for-testing.surge-sh/’)
cy.get(‘.new-todo’, {timeout: 6000}.type(“Clean room{enter}”)
cy.get(‘label’).should(‘have.text’, ‘Clean room’)
cy.get(‘.toggle’).should(‘not.be.checked’)
})
// <reference types="cypress" />
describe('todo actions', () => {
beforeEach(() => {
cy.visit('http://todomvc-app-for-testing.surge.sh/')
cy.get('.new-todo', {timeout: 6000}).type('Clean room{enter}')
})
it('should add a new todo to the list', () => {
@batmi02
batmi02 / MercuryAppTestsExcerpt.cs
Created May 23, 2019 17:57
Excerpt from MercuryHealthAppTests.cs
[TestMethod]
[TestCategory("UITests")]
public void Add1stDonutTest()
{
var webApp = HomePage.Launch(_applitoolsApiKey,
_applitoolsBatchName,
_applitoolsBatchId,
"Add 1st Donut Test",
_browserType);
@batmi02
batmi02 / BasePage.cs
Created May 23, 2019 17:05
Abel's code for initiating Applitools Eyes
// initialize the eyes SDK and set your private API key
var eyes = new Eyes();
eyes.ApiKey = appliToolsKey;
eyes.Batch = batchInfo;
// Start the test by setting AUT's name, window or the page name that's being tested,
//viewport width and height
TESTNAME = testName;
eyes.Open(driver, "Mercury Health Web App", TESTNAME, WINDOWSIZE);