-
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.
WIP - cypress not waiting for request, maybe add a second 'done' requ…
…est in the app to indicate finish?
- Loading branch information
1 parent
0370131
commit f7acdbd
Showing
12 changed files
with
473 additions
and
479 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000", | ||
"projectId": "5gpnqw" | ||
} |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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,60 @@ | ||
require("babel-polyfill"); | ||
import { getSpan } from "../../utils"; | ||
|
||
describe("Basic", () => { | ||
before(() => { | ||
cy.server(); | ||
cy | ||
.route({ | ||
url: "/api/v1/**", | ||
onRequest: xhr => { | ||
xhr.url = "http://localhost:9411" + xhr.url; | ||
} | ||
}) | ||
.as("zipkinAPICall"); | ||
}); | ||
|
||
describe("Setup", () => { | ||
it("should be able to access zipkin", async () => { | ||
const response = await fetch("http://localhost:9411/api/v1/traces"); | ||
expect(response.status).to.equal(200); | ||
}); | ||
}); | ||
|
||
describe("Span", () => { | ||
// it("should be able interact with the basic example", async () => { | ||
// const before = await getTraceAmount(); | ||
// cy.visit("/"); | ||
// cy.get("#Basic").click(); | ||
// cy.get("#buttonLabel").should($p => { | ||
// expect($p.first()).to.contain("Not-Pressed"); | ||
// }); | ||
// cy.get("#basicButton").click(); | ||
// cy.get("#buttonLabel").should(async $p => { | ||
// expect($p.first()).to.contain("Is-Pressed"); | ||
// }); | ||
// const after = await getTraceAmount(); | ||
// expect(after - before).to.equal(1); | ||
// }); | ||
|
||
it("should be able to get the right span name", async () => { | ||
const spanName = "span1-" + +new Date(); | ||
cy.visit("/"); | ||
cy.get("#Basic").click(); | ||
cy.get("#buttonLabel").should($p => { | ||
expect($p.first()).to.contain("Not-Pressed"); | ||
}); | ||
cy.get("#spanNameInput").type(spanName); | ||
cy.get("#basicButton").click(); | ||
|
||
cy.get("#buttonLabel").should(async $p => { | ||
expect($p.first()).to.contain("Is-Pressed"); | ||
}); | ||
|
||
cy.wait("@zipkinAPICall"); | ||
const span = await getSpan("basicservice", spanName); | ||
expect(span.name).to.equal(spanName); | ||
expect(JSON.stringify(span)).to.equal("asdas"); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+33.9 KB
.../react/cypress/screenshots/An uncaught error was detected outside of a test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
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,20 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import "./commands"; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
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
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
Oops, something went wrong.