This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Sample Page Object Setup for the Ruby Selenium solution | |
## We have a base Page object to share some functionality across all pages | |
## and then each page would have its own helper functions and selectors | |
include Gridium | |
class SomePage > Page | |
def initialize | |
# Set up some Gridium timeouts/waits | |
# Set up @member properties i.e. references to elements through XPath/CSS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.config = { | |
// This is our base config with which all others should be merged. | |
// Specify test files, we ended our Webdriver test files with *.uitest.js to not get mixed up with our unit tests | |
specs: ["./**/*.uitest.js"], | |
// Patterns to exclude | |
exclude: [], | |
// Group tests for a page in a suite for easier running of groups of page tests in CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const merge = require("deepmerge"); | |
const wdioConf = require("./wdio.conf.js"); | |
exports.config = merge(wdioConf.config, { | |
// Localhost config file for when you have local web app running | |
// and pointing to whichever environment | |
services: ["selenium-standalone"], | |
baseUrl: "http://127.0.0.1:8000", | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const merge = require("deepmerge"); | |
const wdioConf = require("./wdio.conf.js"); | |
exports.config = merge(wdioConf.config, { | |
services: ["selenium-standalone"], | |
// Staging specific environment variables and settings | |
user: "staging_user", | |
password: "staging_user_password", | |
envValue: "staging", | |
baseUrl: "https://staging.app.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const merge = require("deepmerge"); | |
const wdioConf = require("./wdio.conf.js"); | |
exports.config = merge(wdioConf.config, { | |
user: "staging_user", | |
password: "staging_user_password", | |
envValue: "staging", | |
// Selenium Hub in Docker setup | |
host: "selenium-hub", // Needs to match service name in docker-compose | |
port: 4444, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"uitest:localhost": "./node_modules/.bin/wdio wdio.localhost.conf.js", | |
"uitest:staging": "./node_modules/.bin/wdio wdio.staging.conf.js", | |
"uitest:cicd:staging": "./node_modules/.bin/wdio wdio.cicd.staging.conf.js", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12.9.0 | |
# Create working directory to install dependencies into | |
RUN mkdir -p /opt/frontendapp | |
WORKDIR /opt/frontendapp | |
COPY package.json /opt/frontendapp | |
RUN npm install | |
# Copy over the application code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.1' | |
services: | |
selenium-hub: | |
image: 'selenium/hub:latest' | |
ports: | |
- '4444:4444' | |
environment: | |
SE_OPTS: '-timeout 10000 -browserTimeout 10000' | |
JAVA_OPTS: '-Xmx1024m' | |
selenium-chrome: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Page { | |
open(path) { | |
browser.url(`/${path}`); | |
} | |
// Other shared functionality across all pages | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Page from './page'; | |
class SomePage extends Page { | |
get submitButton() { | |
return $("button[data-testid=submit]"); | |
} | |
get tableRows() { | |
return $$("tbody > tr[data-testid=tableRow]"); | |
} |
OlderNewer