Skip to content

Instantly share code, notes, and snippets.

View michal-lipski's full-sized avatar
🏠
Working from home

Michal Lipski michal-lipski

🏠
Working from home
View GitHub Profile
@michal-lipski
michal-lipski / .gitconfig
Created August 31, 2012 20:45
.gitconfig
[user]
name = Michal Lipski
email = kiwaczki_@gmail.com
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = always
[alias]
@michal-lipski
michal-lipski / gist:3434637
Created August 23, 2012 09:29
deploying current branch on heroku
#!/bin/bash
#Script for deploying current branch to heroku app given as parameter
die () {
echo >&1 "$@"
echo usage $0 app-name
echo example: $0 dev-ml
exit 1
}
@Test
public void shouldNotLoginWithWrongCredentials() {
//given
GitHubLoginPage loginPage = new GitHubHomePage().open().goToLoginPage();
//when
loginPage.login("user", "wrong_password");
//then
assertThat(loginPage.isLoginError()).isTrue();
}
public class GitHubLoginPage extends GitHubPage {
@FindBy(id = "login_field")
WebElement loginField;
@FindBy(name = "password")
WebElement passwordField;
@FindBy(name = "commit")
WebElement commitButton;
GitHubLoginPage page = PageFactory.initElements(driver, GitHubLoginPage.class);
@FindBy(id="login_field")
WebElement loginField;
@FindBy(name="password")
WebElement passwordField;
@FindBy(className="error_box")
WebElement errorBox;
loginField.sendKeys("text");
driver.findElement(By.id("login_field")).sendKeys("text");
@michal-lipski
michal-lipski / postal_code.java
Created June 21, 2012 00:21
question 2 (postal code)
public Boolean canShip(int postalCode) {
//postalCodeDao operates on database to get list of postal codes
//there is a caching solution applied so that list is stored in memory
// and fetched only when database change
List<Integer> allPostalCodes = postalCodeDao.getAllPostalCodes();
return allPostalCodes.contains(postalCode);
}
@michal-lipski
michal-lipski / deque.java
Created June 21, 2012 00:18
question 1 (deque)
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import org.junit.Test;
public class DequeTest {
@Test
public void should_return_null_on_empty_deque() {