-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #10 - Adds Cypress - Adds Cypress to CircleCI testing - Tests all examples - some changes were made to the themes in order to test those - tests ensure that all elements are showing correctly in the examples. the functionality around the theme options isn't tested yet
- Loading branch information
Showing
27 changed files
with
965 additions
and
56 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
typings.d.ts | ||
index.d.ts | ||
www/src/webgl/uniforms.js | ||
cypress/e2e/build | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
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 |
---|---|---|
|
@@ -64,4 +64,9 @@ public | |
|
||
.idea | ||
.vscode | ||
.DS_Store | ||
.DS_Store | ||
|
||
cypress/e2e/build | ||
results | ||
cypress/videos | ||
cypress/screenshots |
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,6 @@ | ||
{ | ||
"baseUrl": "http://localhost:8000", | ||
"integrationFolder": "cypress/e2e/build", | ||
"viewportHeight": 900, | ||
"viewportWidth": 1440 | ||
} |
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,32 @@ | ||
/// <reference types="../support/index" /> | ||
/// <reference types="cypress" /> | ||
/// <reference types="@testing-library/cypress/typings" /> | ||
|
||
describe(`gatsby-theme-cara`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/`).waitForRouteChange() | ||
}) | ||
it(`should render hero content`, () => { | ||
cy.getByText(/hi, i'm jane doe/i) | ||
}) | ||
it(`should render project content`, () => { | ||
cy.getByText(/freiheit/i).getByText(/this project is my entry to adobe's #challengeyourperspective contest./i) | ||
}) | ||
it(`should render project cards with links`, () => { | ||
cy.getByText(/freiheit/i) | ||
.parent() | ||
.should(`have.attr`, `href`, `https://www.behance.net/gallery/58937147/Freiheit`) | ||
}) | ||
it(`should render about content`, () => { | ||
cy.getByText(/winky face./i) | ||
}) | ||
it(`should render contact content`, () => { | ||
cy.getByText(/Dribbble/i) | ||
}) | ||
it(`should render the light/dark mode toggle`, () => { | ||
cy.getByLabelText(/toggle dark mode/i) | ||
}) | ||
it(`should render the footer`, () => { | ||
cy.getByText(/theme by lekoarts/i) | ||
}) | ||
}) |
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,48 @@ | ||
/// <reference types="../support/index" /> | ||
/// <reference types="cypress" /> | ||
/// <reference types="@testing-library/cypress/typings" /> | ||
|
||
describe(`gatsby-theme-emma`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/`).waitForRouteChange() | ||
}) | ||
it(`should render the site title`, () => { | ||
cy.getByLabelText(/emma, back to homepage/i) | ||
}) | ||
it(`should render additional page in navigation`, () => { | ||
cy.getByText(/about/i) | ||
}) | ||
it(`should render the light/dark mode toggle`, () => { | ||
cy.getByLabelText(/toggle dark mode/i) | ||
}) | ||
it(`should render social media icons in header`, () => { | ||
cy.getByLabelText(/instagram/i).getByLabelText(/dribbble/i) | ||
}) | ||
it(`should render the footer`, () => { | ||
cy.getByText(/theme by lekoarts/i) | ||
}) | ||
it(`should have item with all information`, () => { | ||
cy.getByLabelText(/view detail page of hermione granger/i).within(() => { | ||
cy.getByText(/hogwarts/i).getByText(/witchcraft/i) | ||
}) | ||
}) | ||
it(`should link and display the project page`, () => { | ||
cy.getByLabelText(/view detail page of hermione granger/i) | ||
.click() | ||
.waitForRouteChange() | ||
.assertRoute(`/hermione-granger`) | ||
.get(`h1`) | ||
.within(() => { | ||
cy.getByText(/hermione granger/i) | ||
}) | ||
.getByText(/hogwarts/i) | ||
.getByText(/10.06.2019/i) | ||
.getByText(/witchcraft/i) | ||
}) | ||
it(`should link and display the about page`, () => { | ||
cy.getByText(/about/i) | ||
.click() | ||
.waitForRouteChange() | ||
.assertRoute(`/about`) | ||
}) | ||
}) |
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 @@ | ||
/// <reference types="../support/index" /> | ||
/// <reference types="cypress" /> | ||
/// <reference types="@testing-library/cypress/typings" /> | ||
|
||
describe(`app`, () => { | ||
it(`should work`, () => { | ||
cy.visit(`/`).assertRoute(`/`) | ||
}) | ||
}) |
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,38 @@ | ||
/// <reference types="../support/index" /> | ||
/// <reference types="cypress" /> | ||
/// <reference types="@testing-library/cypress/typings" /> | ||
|
||
describe(`gatsby-theme-status-dashboard`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/`).waitForRouteChange() | ||
}) | ||
it(`should render the title`, () => { | ||
cy.get(`h1`).within(() => { | ||
cy.getByText(/status dashboard - lekoarts/i) | ||
}) | ||
}) | ||
it(`should render the description`, () => { | ||
cy.getByText(/showing the statuses of my netlify deploys & circleci tests./i) | ||
}) | ||
it(`should render the info`, () => { | ||
cy.getByText(/circleci projects/i) | ||
}) | ||
it(`should render the repository title`, () => { | ||
cy.getByText(/gatsby-themes-by-lekoarts/i) | ||
}) | ||
it(`should render the circleci icon`, () => { | ||
cy.getByLabelText(/view gatsby-themes-by-lekoarts on circleci/i) | ||
}) | ||
it(`should render the github icon`, () => { | ||
cy.getByLabelText(/view gatsby-themes-by-lekoarts source on github/i) | ||
}) | ||
it(`should render the netlify status badge`, () => { | ||
cy.getByAltText(/netlify deploy status of gatsby-themes-by-lekoarts/i) | ||
}) | ||
it(`should render the circleci status badge`, () => { | ||
cy.getByAltText(/circleci status of gatsby-themes-by-lekoarts/i) | ||
}) | ||
it(`should render the footer`, () => { | ||
cy.getByText(/theme by lekoarts/i) | ||
}) | ||
}) |
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": "[email protected]", | ||
"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,17 @@ | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
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,29 @@ | ||
// *********************************************** | ||
// 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) => { ... }) | ||
|
||
Cypress.Commands.add(`assertRoute`, route => { | ||
cy.url().should(`equal`, `${window.location.origin}${route}`) | ||
}) |
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,17 @@ | ||
/// <reference types="cypress" /> | ||
|
||
declare namespace Cypress { | ||
interface Chainable<Subject> { | ||
/** | ||
* Assert the current URL | ||
* @param route | ||
* @example cy.assertRoute('/page-2') | ||
*/ | ||
assertRoute(route: string): Chainable<any> | ||
|
||
/** | ||
* Waits for Gatsby to finish the route change, in order to ensure event handlers are properly setup | ||
*/ | ||
waitForRouteChange(): Chainable<any> | ||
} | ||
} |
Oops, something went wrong.