Skip to content

Instantly share code, notes, and snippets.

View DMeechan's full-sized avatar
🧑‍🌾
Building stuff

Daniel Meechan DMeechan

🧑‍🌾
Building stuff
View GitHub Profile
@DMeechan
DMeechan / playbook-complete.yml
Last active July 27, 2018 12:55
DevOps Course Chapter 2 - Ansible
---
- hosts: mygroup
become: yes
become_method: sudo
vars:
NODEJS_VERSION: "10"
ansible_become_pass: devops
gecko_version: 0.17.0
selenium_install_firefox: yes
@DMeechan
DMeechan / mocha-real-life-example.js
Last active June 18, 2018 15:14
DevOps Course Chapter 8 - Automated testing
describe('earth', function() {
describe('united kingdom', function() {
it('should have at least 70% rain', function() {
// Code for determining if there is enough rain
});
});
describe('australia', function() {
it('should have at least 80% sunshine', function() {
@DMeechan
DMeechan / mocha-simple-example.js
Created June 18, 2018 15:14
DevOps Course Chapter 8 - Automated testing
describe("string length", function() {
it('should return number of characters in a string', function() {
"Hello".length.should.equal(5)
});
});
@DMeechan
DMeechan / mocha-first-test-case.js
Created June 18, 2018 15:15
DevOps Course Chapter 8 - Automated testing
it('is correct', async function() {
try {
const expectedTitle = 'Example To Do List';
const title = await driver.getTitle();
title.should.equal(expectedTitle);
} catch (error) {
throw new Error(error);
}
});
@DMeechan
DMeechan / mocha-second-test-case.js
Created June 18, 2018 15:16
DevOps Course Chapter 8 - Automated testing
it('lists four tasks', async function() {
try {
const list = await driver.findElements(By.tagName("li"));
list.length.should.equal(4);
} catch (error) {
throw new Error(error);
}
});
@DMeechan
DMeechan / mocha-third-test-case.js
Created June 18, 2018 15:16
DevOps Course Chapter 8 - Automated testing
it('contains DevOps course task', async function() {
try {
const expectedValue = "Finish DevOps course";
const matchingTasks = await driver.findElements(By.css(`li[value="${expectedValue}"]`));
matchingTasks.length.should.equal(1);
} catch (error) {
throw new Error(error);
}
});
@DMeechan
DMeechan / mocha-complete-test-cases.js
Created June 18, 2018 15:18
DevOps Course Chapter 8 - Automated testing
describe('tasks', function() {
const driver = getDriver();
beforeEach(openWebsite(driver));
// ▼ Write the test case for the tasks list below here ▼
it('lists four tasks', async function() {
try {
const list = await driver.findElements(By.tagName("li"));
list.length.should.equal(4);
} catch (error) {
@DMeechan
DMeechan / ibm-cloud-deploy.sh
Created June 19, 2018 08:41
DevOps Course Chapter 7 - Automating our deployments
#!/bin/bash
cf push -f ./manifest.yml
export APP_URL=http://$(cf app $CF_APP_NAME | grep -e urls: -e routes: | awk '{print $2}')
@DMeechan
DMeechan / mocha-first-test-case-full.js
Last active June 19, 2018 12:22
DevOps Course Chapter 8 - Automated testing
// This collection of test cases will be testing the title of the page
describe('title', function() {
const driver = getDriver();
// Before every test runs, we'll need to open up the web page in Firefox
beforeEach(openWebsite(driver));
// ▼ Write the test case for the page title below here ▼
it('is correct', async function() {
@DMeechan
DMeechan / ibm-cloud-run-automated-selenium-tests.sh
Last active June 19, 2018 13:40
DevOps Course Chapter 9 - integrating our automated tests into our delivery pipeline
#!/bin/bash
# This script is run on IBM Cloud in the delivery pipeline
# It enables a Test stage to run automated Selenium tests
# In Firefox using a virtual display
echo "==> Updating all dependencies"
sudo apt-get -y --force-yes update
echo "==> Installing Firefox"
sudo apt-get -y --force-yes install firefox
firefox -v