Skip to content

Instantly share code, notes, and snippets.

View slawekradzyminski's full-sized avatar

Slawek Radzyminski slawekradzyminski

View GitHub Profile
package org.fluentlenium.sample.pages;
import org.fluentlenium.core.FluentPage;
/**
* Created by s.radzyminski on 10/01/16.
*/
public class FacebookLoggedOutPage extends FluentPage {
@Override
<dependency>
<groupId>org.fluentlenium</groupId>
<artifactId>fluentlenium-testng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
package org.fluentlenium.sample.pages;
import org.fluentlenium.core.FluentPage;
/**
* Created by s.radzyminski on 10/01/16.
*/
public class GroupApprovePage extends FluentPage {
private static final String APPROVE_ALL_BUTTON = "[rel=async-post]";
email=www.awesome-testing.blogspot.com
password=wwww.awesome-bookreviews.blogspot.com
package org.fluentlenium.sample.support;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
/**
* Created by s.radzyminski on 12/22/2015.
*/
public class LoadProperties {
private FacebookLoggedOutPage fbLogOutPage;
@BeforeMethod
public void authenticate() {
fbLogOutPage = createPage(FacebookLoggedOutPage.class);
fbLogOutPage.go();
fbLogOutPage.login(EMAIL, PASSWORD);
fbLogOutPage.verifySuccessfulLogin();
}
package org.fluentlenium.sample.tests;
import org.fluentlenium.adapter.FluentTestNg;
import org.fluentlenium.sample.pages.FacebookLoggedOutPage;
import org.fluentlenium.sample.pages.GroupApprovePage;
import org.fluentlenium.sample.support.LoadProperties;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class FacebookTests extends FluentTestNg {
private static final String PREFS = "prefs";
@Override
public WebDriver getDefaultDriver() {
return new ChromeDriver(getChromeCapabilities());
}
private DesiredCapabilities getChromeCapabilities() {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, getChromeOptions());
private static final String BROWSER_NOTIFICATIONS = "profile.managed_default_content_settings.notifications";
private static final short DISABLED = 2;
/**
* Full list of available prefs - https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup
*
* @return prefs
*/
private Map<String, Object> getChromePrefs() {
Map<String, Object> chromePrefs = new HashMap<>();
public interface ChromeSwitchesInt {
String START_FULLSCREEN = "start-fullscreen";
String ALLOW_INSECURE_CONTENT = "allow-running-insecure-content";
String INCOGNITO = "incognito";
String IGNORE_CERTIFICATE_ERRORS = "--ignore-certificate-errors";
}