-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move test infrastructure from cypress to puppeteer
cypress had a weird way to handle asynchronosity and also strange behaviour for failing, puppeteer on top of jest seems to be a way more stable alternative
- Loading branch information
1 parent
32c22ab
commit 6798400
Showing
13 changed files
with
541 additions
and
476 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fetch from "node-fetch"; | ||
import puppeteer from "puppeteer"; | ||
import { getContent } from "../utils"; | ||
|
||
describe("Setup", () => { | ||
let browser, page; | ||
beforeAll(async () => { | ||
browser = await puppeteer.launch(); | ||
page = await browser.newPage(); | ||
}); | ||
|
||
it("should be able to access zipkin", async () => { | ||
const response = await fetch("http://localhost:9411/api/v2/traces"); | ||
expect(response.status).toBe(200); | ||
}); | ||
|
||
it("should reach the demo page", async () => { | ||
await page.goto("http://localhost:3000"); | ||
await page.click("#Basic"); | ||
|
||
const before = await getContent(page, "#buttonLabel"); | ||
expect(before).toBe("Not-Pressed"); | ||
|
||
await page.click("#basicButton"); | ||
|
||
const after = await getContent(page, "#buttonLabel"); | ||
expect(after).toBe("Is-Pressed"); | ||
|
||
await browser.close(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import fetch from "node-fetch"; | ||
import puppeteer from "puppeteer"; | ||
|
||
describe("Basic: Spans", () => { | ||
let browser, page; | ||
beforeAll(async () => { | ||
browser = await puppeteer.launch(); | ||
page = await browser.newPage(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await page.goto("http://localhost:3000"); | ||
await page.click("#Basic"); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser.close(); | ||
}); | ||
|
||
it("only starting one should not add a new span"); | ||
it("starting and finishing a span should register one in the server"); | ||
it("span should have a name"); | ||
it("span should have a service set"); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import log from "npmlog"; | ||
|
||
export function getContent(page, selector) { | ||
log.info("utils", "query selector: %s", selector); | ||
return page.evaluate( | ||
selector => document.querySelector(selector).textContent, | ||
selector | ||
); | ||
} |
Oops, something went wrong.