docs: use sapper/cypress for e2e testing

This commit is contained in:
Eric Liu 2020-07-19 11:41:15 -07:00
commit ccdf6af78d
36 changed files with 4373 additions and 26 deletions

View file

@ -0,0 +1,11 @@
describe("Button", () => {
beforeEach(() => {
cy.examples("Button");
});
it("renders correctly", () => {
cy.get("button").then(($) => {
expect($.length).to.eql(4);
});
});
});

View file

@ -0,0 +1,21 @@
/// <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}
*/
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,3 @@
Cypress.Commands.add("examples", (component) => {
cy.visit(`/examples/${component}`);
});

View file

@ -0,0 +1 @@
import "./commands";