Testing Wikipedia navitgation with Geb+Spock+PhantomJS. Page Object pattern and BDD fashion.
778
This is a simple test that will navigate throught Wikipedia. To launch it, with Docker installed and ready, just run:
- docker run -t gopejavi/geb-wiki-example
There is no need to execute any additional command for running the tests, as Docker takes care of that. If you want to check how the tests have been made (including Page Object pattern) you can check it at https://github.com/gopejavi/GebExampleToTest/tree/master/src/test/groovy where the file WikipediaTestSpec.groovy is the test entry point.
Basic steps taken:
Although there's no need to use it, I included it as is not in the tests repository and is part of the work:
# Easily run tests with Geb, Spock and PhantomJS
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
wget \
unzip \
git \
default-jre \
&& rm -rf /var/lib/apt/lists/*
#last line cleans apt cache so reduces Docker image size.
# Gradle
WORKDIR /usr/bin
RUN wget https://services.gradle.org/distributions/gradle-4.0-all.zip && \
unzip gradle-4.0-all.zip && \
ln -s gradle-4.0 gradle && \
rm gradle-4.0-all.zip
ENV GRADLE_HOME /usr/bin/gradle
#RUN chmod +x /usr/bin/gradle
ENV PATH $PATH:$GRADLE_HOME/bin
# Put Gradle cache in /var so it can it is part of container
ENV GRADLE_USER_HOME /var/cache/gradle
# Prime the Gradle cache with dependencies needed to run simple Geb scripts
WORKDIR /root
RUN git clone https://github.com/gopejavi/GebExampleToTest.git
WORKDIR GebExampleToTest
#So it is faster when actually running, as dependencies are already in Docker image (has to be improved)
RUN ./gradlew phantomJsTest
#Output some info in the case some error happens
CMD ./gradlew phantomJsTest --info
Content type
Image
Digest
Size
441.4 MB
Last updated
about 9 years ago
docker pull gopejavi/geb-wiki-example