Skip to content
Permalink
Browse files

Start testing

  • Loading branch information
mpourismaiel committed Dec 1, 2019
1 parent 388019e commit aa3ad0548e330386ffaf7940b9c6e57ff95447de
@@ -1,3 +1,7 @@
node_modules
yarn-error.log
exampleSite/public/*
cypress/videos
cypress/plugins
cypress/screenshots
cypress/support
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:1313"
}
@@ -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"
}
@@ -0,0 +1,23 @@
describe("Fragment structure", () => {
it("should display fragments from global", () => {
cy.visit("/dev/fragment-fallthrough");
cy.get("#nav").should("have.length", 1);
cy.get("#hero").should("have.length", 1);
cy.get("#content").should("have.length", 1);
cy.get("#copyright").should("have.length", 1);
cy.get("#footer").should("have.length", 1);
});

it("should support fragment falltrough", () => {
cy.visit("/dev/fragment-fallthrough");
cy.get("#hero .hero-subtitle").should(
"contain",
"If you see this, directory fragment fallthrough is working"
);
cy.get("#content h2").should("contain", "Content fragment from Page");
cy.get("#copyright .copyright-notice").should(
"contain",
"This is loaded from globals of the current section"
);
});
});
@@ -0,0 +1,8 @@
describe("List fragment", () => {
it("should display pages from same, specific section, with subsections and with subsection leaves", () => {
cy.visit("/dev/list");
cy.get("#upper-leaves article").should("have.length", 4);
cy.get("#branches article").should("have.length", 6);
cy.get("#leaves article").should("have.length", 10);
});
});
@@ -0,0 +1,14 @@
describe("Navbar", () => {
it("should display proper breadcrumb", () => {
cy.visit("/dev");
cy.get(".breadcrumb li").should("have.length", 1);
cy.get(".breadcrumb li").should("contain", "Dev section");
cy.get(".breadcrumb li a").should("have.length", 0);

cy.visit("/dev/blog");
cy.get(".breadcrumb li").should("have.length", 2);
cy.get(".breadcrumb li:nth-child(1) a").should("have.length", 1);
cy.get(".breadcrumb li:nth-child(2)").should("contain", "Blog");
cy.get(".breadcrumb li:nth-child(2) a").should("have.length", 0);
});
});
@@ -0,0 +1,28 @@
describe("Image Fallthrough", () => {
it("should display image from fragment", () => {
cy.visit("/dev/resource-fallthrough/fragment/");
cy.get("#hero .header-image").should(
"have.css",
"background-image",
'url("http://localhost:1313/dev/resource-fallthrough/fragment/hero/resource_logo.svg")'
);
});

it("should display image from page", () => {
cy.visit("/dev/resource-fallthrough/page/");
cy.get("#hero .header-image").should(
"have.css",
"background-image",
'url("http://localhost:1313/dev/resource-fallthrough/page/resource_logo.svg")'
);
});

it("should display image from global", () => {
cy.visit("/dev/resource-fallthrough/global/");
cy.get("#hero .header-image").should(
"have.css",
"background-image",
'url("http://localhost:1313/images/resource_logo.svg")'
);
});
});
@@ -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
}
@@ -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) => { ... })
@@ -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')

This file was deleted.

@@ -16,14 +16,17 @@
"start": "npm run watch-js",
"build": "npm run build-js && npm run build-hugo",
"test:colors": "node _tests/colors-generator/index.js",
"test:alignments": "node _tests/align-generator/index.js"
"test:alignments": "node _tests/align-generator/index.js",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"concurrently": "^3.5.1",
"cypress": "^3.6.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"node-sass": "^4.8.3",
"style-loader": "^0.20.3",

0 comments on commit aa3ad05

Please sign in to comment.
You can’t perform that action at this time.