Skip to content

Instantly share code, notes, and snippets.

View O5ten's full-sized avatar

Mikael Östberg O5ten

View GitHub Profile
@O5ten
O5ten / In-build-selenium-server-with-dynamic-port-allocation-maven-profile.xml
Last active September 19, 2017 07:09
In-build selenium-server to run your tests headless in any operating system.
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-selenium-port</id>
@O5ten
O5ten / gist:2d07f589028a8c7aac3bc7394198519f
Created December 22, 2017 09:51
Vagrantfile for selenoid
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box_download_insecure = true
config.vm.box = "ubuntu/xenial64"
@O5ten
O5ten / Vagrantfile
Last active March 9, 2018 15:04
A TeamCity with a linux agent to test plugins with using Vagrant and Docker, put in a folder, do vagrant up
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
@O5ten
O5ten / pom.xml
Created May 1, 2018 20:00
Dependencies for running junit-tests towards a selenium grid
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.7.1</version>
@O5ten
O5ten / SeleniumTestBase.java
Created May 1, 2018 20:19
Remote Grid Selenium TestBase
package framework;
import static framework.Constants.BROWSER_CAPABILIITY;
import static framework.Constants.ENABLE_VIDEO;
import static framework.Constants.ENABLE_VNC;
import static framework.Constants.NAME;
import static framework.Constants.THIRTY;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.net.MalformedURLException;
public class StartPage extends Page {
@FindBy(css = "button[data-test=userButton]")
private WebElement userbutton;
@FindBy(css = "a[data-test=logoutButton]")
private WebElement logoutButton;
public StartPage() {
super("http://my-page.se");
public class LogoutTest extends SeleniumTestBase {
private StartPage startPage = new StartPage();
private LoggedOutPage loggedOutPage = new LoggedOutPage();
public LogoutTest() {
this.pagesToInitialize = Lists.newArrayList(startPage);
}
@Test
public void shouldEndUpOnLoggedOutPageWhenLoggedOut() {
@O5ten
O5ten / Page.java
Created May 1, 2018 20:38
Parent Page Object
public class Page {
private String url;
protected Actions actions;
private RemoteWebDriver browser;
public Page(String url) {
this.url = url;
}
@O5ten
O5ten / issue-collector.js
Created June 4, 2018 06:47
Issue Collector
window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
//Requires that jQuery is available!
jQuery("#myCustomTrigger").click(function(e) {
e.preventDefault();
showCollectorDialog();
console.log("klickade p� support-knapp!");
});
}};
@O5ten
O5ten / jenkins-issue-collector.js
Created June 9, 2018 20:17
jenkins-issue-collector.js
(function(summary, description, component){
window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
jQuery(".jiraTrigger").click(function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues : {
summary : summary,