Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 163 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,168 @@

# Mobile Tools for Java (J2ME)
.mtj.tmp/

### Eclipse
.settings/
.classpath
.project


# Created by https://www.gitignore.io/api/macos,java,windows,intellij,intellij+iml,maven

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr


### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:

# Sensitive or high-churn files:

# Gradle:

# Mongo Explorer plugin:

## File-based project format:

## Plugin-specific files:

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr


### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Exclude maven wrapper
!/.mvn/wrapper/maven-wrapper.jar


### Java ###
*.class

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

Expand All @@ -10,17 +173,3 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### IntelliJ Idea
#.idea/
*.iml
*.ipr
*.iws

### Eclipse
.settings/
.classpath
.project

### Maven
target/
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ Run these commands depending on your base OS.

### On Mac OS

Copy this bootstrap script and run it in a Terminal shell window:

```
sh -c "$(curl -fsSL https://raw.githubusercontent.com/wilsonmar/Basic-Selenium-Java/master/mac-bootstrap.sh)"
```

It installs the following if it is not already installed:

1. Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
2. Install Caskroom `brew tap caskroom/cask`
3. If you dont have the Java Development Kit (JDK) run this command `brew cask install java`
4. Install Maven `brew install maven`
5. Run `./mac_install_browsers.sh`

### Windows
The script also runs the test.

### On Windows

> This is currently untested

Expand All @@ -38,9 +48,11 @@ The following commands are instructions on how to run the tests

### From CLI

`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml ` on a mac
On a Mac:

`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml`

### Intellij Idea
### Intellij IDEA

There is a shared run configuration that has the maven target setup and another with a sample built in NUnit test runner option.

Expand Down
79 changes: 79 additions & 0 deletions mac-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/sh

# mac-bootstrap.sh
# by wilsonmar at gmail.com
# This bash script bootstraps a MacOS laptop (like at https://github.com/fs/osx-bootstrap)
# to run Selenium against a Java source file that
# simply opens a web page in several browsers.
#
# This script installs:
# - xcode
# - homebrew
#
# It will ask you for your sudo password.

fancy_echo() { # to add blank line between echo statements:
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}

fancy_echo "Boostrapping ..."

trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT

set -e # to stop on error.

# Ask for the administrator password upfront and run a
# keep-alive to update existing `sudo` time stamp until script has finished
# sudo -v
# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

# Ensure Apple's command line tools are installed
if ! command -v cc >/dev/null; then
fancy_echo "Installing xcode (Agreeing to the Xcode/iOS license requires sudo admin privileges) ..."
sudo xcodebuild -license accept
# xcode-select --install
else
fancy_echo "Xcode already installed. Skipping."
fi


if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
else
fancy_echo "Homebrew already installed. Skipping."
fi


fancy_echo "Install Caskroom ..."
brew tap caskroom/cask


if ! command -v java >/dev/null; then
fancy_echo "Installing Java..."
brew cask install java
else
fancy_echo "Java already installed. Skipping."
fi


if ! command -v mvn >/dev/null; then
fancy_echo "Installing Maven..."
brew install maven
else
fancy_echo "Maven already installed. Skipping."
fi


fancy_echo "Run mac_install_browsers.sh ..."
chmod +x mac_install_browsers.sh
./mac_install_browsers.sh


fancy_echo "Run test ..."
mvn test -Dsurefire.suiteXmlFiles=mac-only.xml
# Browser windows should open and close on their own.

fancy_echo "Done with status $? (0=OK)."