Skip to content

Instantly share code, notes, and snippets.

Joe Torreggiani jtorreggiani

Block or report user

Report or block jtorreggiani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Todos.js
import React, { Component } from 'react'
const todosUrl = 'http://localhost:3001/todos'
function Todo ({ number, todo }) {
return (
<li>{number}. { todo.title }</li>
)
}
View navigation.spec.js
it('navigates to todos page on link click', async () => {
const link = await browser.$('=Todos')
await link.click()
const heading = await browser.$('h1')
await expect(browser.getUrl()).resolves.toEqual(`${baseUrl}/todos`)
await expect(heading.getText()).resolves.toEqual('Todos')
})
it('navigates to about page on link click', async () => {
@jtorreggiani
jtorreggiani / links.spec.js
Last active Mar 1, 2019
Assert existence of links
View links.spec.js
View homepagetext.spec.js
it('has home page text', async () => {
const heading = await browser.$('h1')
await expect(heading.getText()).resolves.toEqual('Home')
})
@jtorreggiani
jtorreggiani / App.css
Last active Mar 1, 2019
Super basic app styles
View App.css
.App-nav {
display: flex;
flex-direction: row;
padding: 5px;
}
.App-nav > a {
flex: 1 1 auto;
text-align: center;
padding:0 15px;
@jtorreggiani
jtorreggiani / App.js
Created Mar 1, 2019
Basic React Router app
View App.js
import React from 'react'
import './App.css'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
function Home () {
return (
<div>
<h1>Home</h1>
</div>
)
@jtorreggiani
jtorreggiani / headingtext.spec.js
Last active Mar 1, 2019
Introduction test assertion
View headingtext.spec.js
it('has introduction text', async () => {
// Use the browser selector method to get the heading
// See docs for details https://webdriver.io/docs/selectors.html
const paragraph = await browser.$('p')
await expect(paragraph.getText()).resolves.toEqual('Edit src/App.js and save to reload.')
})
@jtorreggiani
jtorreggiani / App.integration.test.js
Last active Mar 1, 2019
Integration test boilerplate code
View App.integration.test.js
// Import the remote function from webdriver
import { remote } from 'webdriverio'
// Describe a basic scenario
describe('User visits home page', () => {
// Define a browser variable to be available to each
// assertion that will be declared below
let browser
// Before all the assertions we set up the browser object
// The default configuration for webdriver is async mode,
// so we will need to be defined our specs as async functions.
View app.yml
entrypoint: bundle exec rackup --port $PORT
env: flex
runtime: ruby
env_variables:
SECRET_KEY_BASE: SECRET_BASE
beta_settings:
cloud_sql_instances: skeleton-application-12345:us-west2:skeleton-application-cloudsql-instance
@jtorreggiani
jtorreggiani / database.yml
Created Feb 26, 2019
config/database.yml
View database.yml
production:
<<: *default
username: deploy
password: [PASSWORD]
database: skeleton_application_production
socket: "/cloudsql/skeleton-application-12345:us-west2:skeleton-application-cloudsql-instance"
You can’t perform that action at this time.