Skip to content

Commit b5a9709

Browse files
author
alexlee-dev
committed
🧪 Cypress
1 parent bc6cbb0 commit b5a9709

8 files changed

Lines changed: 103 additions & 1 deletion

File tree

website/cypress.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"video": false
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/// <reference types="cypress" />
2+
3+
context('create-cli-application', () => {
4+
beforeEach(() => {
5+
cy.visit('http://localhost:3000');
6+
});
7+
8+
it('Should display correct content', () => {
9+
cy.get('body').should('contain.text', 'create-cli-application');
10+
cy.get('body').should(
11+
'contain.text',
12+
'A bootstrapper for creating a cli application with Node.',
13+
);
14+
cy.get('body').should('contain.text', '15.6kb gzipped');
15+
cy.get('body').should('contain.text', 'View Documentation');
16+
});
17+
18+
it('Should step through demo', () => {
19+
cy.get('#create-application').click();
20+
cy.wait(10000);
21+
cy.get('#start-application').click();
22+
cy.wait(10000);
23+
cy.get('#view-documentation').should('exist');
24+
});
25+
});

website/cypress/plugins/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
module.exports = (on, config) => {
19+
// `on` is used to hook into various events Cypress emits
20+
// `config` is the resolved Cypress config
21+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add("login", (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

website/cypress/support/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands';
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

website/src/client/components/Demo.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const Demo: React.SFC<{}> = () => {
3131
{!applicationCreated && currentDemo === 'entry' && (
3232
<button
3333
className="button purple-bg"
34+
id="create-application"
3435
onClick={(): void =>
3536
createApplication({ setApplicationCreated, setCurrentDemo })
3637
}
@@ -42,6 +43,7 @@ const Demo: React.SFC<{}> = () => {
4243
{applicationCreated && currentDemo === 'create' && (
4344
<button
4445
className="button purple-bg"
46+
id="start-application"
4547
onClick={(): void =>
4648
startApplication({ setApplicationStarted, setCurrentDemo })
4749
}
@@ -53,6 +55,7 @@ const Demo: React.SFC<{}> = () => {
5355
{applicationStarted && (
5456
<button
5557
className="button purple-bg"
58+
id="view-documentation"
5659
onClick={(): void => {
5760
window.open(
5861
'https://github.com/alexlee-dev/create-cli-application',

website/src/client/components/Info.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Info: React.SFC<{}> = () => {
2020
<blockquote className="blue-quote">
2121
A bootstrapper for creating a cli application with Node.
2222
</blockquote>
23-
<span className="badge">
23+
<span className="badge margin-bottom-md">
2424
<FontAwesomeIcon icon={faBox} />
2525
<span className="margin-left-sm">15.6kb gzipped</span>
2626
</span>

0 commit comments

Comments
 (0)