This commit is contained in:
2022-03-05 15:35:54 +01:00
commit 7d99958156
13 changed files with 4542 additions and 0 deletions

8
.eslintrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"plugins": [
"cypress"
],
"extends": [
"plugin:cypress/recommended"
]
}

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/

1
cypress.json Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -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"
}

View File

@@ -0,0 +1,12 @@
describe("initial load", () => {
before(() => {
cy.visit("http://localhost:8000")
})
it("the typing input is in focus", () => {
cy.visit("http://localhost:8000")
expect(cy.get("#typing-input").should('have.focus'))
})
it("there is a word to match displayed", () => {
cy.get("#current-word").should('be.visible')
})
})

22
cypress/plugins/index.js Normal file
View File

@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// 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)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@@ -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 will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

20
cypress/support/index.js Normal file
View File

@@ -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')

17
index.html Normal file
View File

@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Typing Game</title>
<style>
@import 'styles.css';
</style>
</head>
<body>
<div id="current-word" class="fade-in">Burger</div>
<div id="typing-input-container">
<input type="text" id="typing-input" autofocus>
</div>
<script type="module" src="index.js"></script>
</body>
</html>

0
index.js Normal file
View File

4377
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

16
package.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "typegame",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start_cypress": "cypress open",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Zev Averbach",
"license": "MIT",
"devDependencies": {
"cypress": "^9.5.0",
"eslint-plugin-cypress": "^2.12.1"
}
}

38
styles.css Normal file
View File

@@ -0,0 +1,38 @@
body {
font-family: Helvetica, Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
}
.fade-in {
/* animation-name: FadeIn; */
/* animation-duration: 3s; */
transition-timing-function: linear;
opacity: 1;
}
#typing-input {
outline: none;
border: none;
font-size: 15vh;
caret-color: red;
}
.container, #typing-input-container {
width: 15vw;
margin-top: 15vh;
}
#current-word {
width: 15vw;
}
@keyframes FadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}