This file contains hidden or 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
| describe("Cypress Tutorial", function() { | |
| it("works", function() { | |
| cy.server(); | |
| // alias the network request | |
| cy.route("/200?**").as("fakeNetworkRequest"); | |
| cy.visit("http://localhost:3000"); | |
| // wait for the network request to complete |
This file contains hidden or 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
| import React, { useState, useEffect } from "react"; | |
| import axios from "axios"; | |
| import logo from "./logo.svg"; | |
| import "./App.css"; | |
| function App() { | |
| const [loaded, setLoaded] = useState(false); | |
| useEffect(() => { | |
| const secondsToWait = 5; |
This file contains hidden or 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
| describe("Cypress Tutorial", function() { | |
| it("Makes sure the app is working", function() { | |
| cy.visit("http://localhost:3000"); | |
| cy.findByText("Learn React"); | |
| }); | |
| }); |
This file contains hidden or 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
| describe("Cypress Tutorial", function() { | |
| it("works", function() { | |
| cy.visit("http://localhost:3000"); | |
| cy.get("a").contains("Learn React"); | |
| }); | |
| }); |
This file contains hidden or 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
| const axios = require("axios"); | |
| const moment = require("moment"); | |
| module.exports = async function() { | |
| const devs = [ | |
| "gaearon", | |
| "addyosmani", | |
| "paulirish", | |
| "thefoxis", | |
| "umaar", |
This file contains hidden or 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
| import React from "react"; | |
| import { Route, Switch, Redirect } from "react-router-dom"; | |
| import Login from "./Login"; | |
| const ROUTES = [ | |
| { path: "/", key: "ROOT", exact: true, component: Login }, | |
| { | |
| path: "/app", | |
| key: "APP", | |
| component: props => { |
This file contains hidden or 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
| import React from "react"; | |
| import { Link, useHistory } from "react-router-dom"; | |
| import ROUTES, { RenderRoutes } from "./routes"; | |
| function App() { | |
| const history = useHistory(); | |
| function logout() { | |
| localStorage.removeItem("user"); | |
| history.push("/"); |
This file contains hidden or 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
| import React from "react"; | |
| import { Route, Switch } from "react-router-dom"; | |
| import Login from "./Login" | |
| const ROUTES = [ | |
| { path: "/", key: "ROOT", exact: true, component: Login }, //here's the update | |
| { | |
| path: "/app", | |
| key: "APP", | |
| component: RenderRoutes, |
This file contains hidden or 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
| import React from "react"; | |
| import { Link } from "react-router-dom"; | |
| import ROUTES, { RenderRoutes } from "./routes"; | |
| function App() { | |
| return ( | |
| <div style={{ display: "flex", height: "100vh", alignItems: "stretch" }}> | |
| <div style={{ flex: 0.3, backgroundColor: "#f2f2f2" }}> | |
| {displayRouteMenu(ROUTES)} | |
| </div> |
This file contains hidden or 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
| import React, { useState } from "react"; | |
| import { Redirect, useHistory } from "react-router-dom"; | |
| export default function Login() { | |
| const [user, updateUser] = useState(""); | |
| const history = useHistory(); | |
| // "log in" a user | |
| function handleLogin() { | |
| localStorage.setItem("user", user); |