Created
August 15, 2019 21:43
-
-
Save jasonbyrne/ec3dcfc71bfb45e405edbba0c8b2b787 to your computer and use it in GitHub Desktop.
Sample Test Suite created in the Flagpole Walkthrough on August 15, 2019
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 { Flagpole } = require('flagpole'); | |
const searchTerm = 'Flagpole QA'; | |
const suite = Flagpole.suite('Basic Smoke Test of Site') | |
.base('https://www.google.com'); | |
suite.html('Homepage Loads') | |
.open('/') | |
.next('Test the basic headers', (ctx) => { | |
ctx.assert('Status is 200', ctx.response.statusCode) | |
.equals(200); | |
}) | |
.next('Fill out the search form', async (ctx) => { | |
const form = await ctx.find('form'); | |
const searchBox = await ctx.find('input[name="q"]'); | |
ctx.assert('Form exists on the page', form).exists(); | |
ctx.assert(searchBox).exists(); | |
await form.fillForm({ | |
q: searchTerm | |
}); | |
ctx.assert(await searchBox.getValue()).equals(searchTerm); | |
form.submit('Submit form and check results page', async function () { | |
const searchInputBox = await this.find('input[name="q"]'); | |
this.assert('Search input box should have the value we typed', await searchInputBox.getValue()) | |
.equals(searchTerm); | |
const npmResult = await this.find('a[href*="npm"]'); | |
this.assert('Link to Flagpole NPM is on first page of results', npmResult).exists(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment