Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codedownio/sandwich
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Jan 2, 2025
2 parents a06d061 + 20cd44c commit 1aef807
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 159 deletions.
2 changes: 2 additions & 0 deletions sandwich-site/docs/context-libraries/sandwich-contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ This test will log the various binaries that are available, such as `emacs`, `em
## File contexts

The [Test.Sandwich.Contexts.Files](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Files.html) module allows you to introduce named files as contexts.

## PostgreSQL contexts
41 changes: 38 additions & 3 deletions sandwich-site/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,44 @@ sidebar_label: Introduction
slug: /
---

import useBaseUrl from '@docusaurus/useBaseUrl';

Sandwich is a test framework for Haskell, inspired by and (almost) a drop-in replacement for [Hspec](http://hspec.github.io/). This section will show some of its features.
import useBaseUrl from "@docusaurus/useBaseUrl";
import "react-responsive-carousel/lib/styles/carousel.min.css";
import { Carousel } from "react-responsive-carousel";

import styles from "../src/pages/styles.module.css";

Sandwich is a test framework for Haskell, inspired by and (almost) a drop-in replacement for [Hspec](http://hspec.github.io/).

Sandwich has a number of powerful features and integrations, such as:
* Interactive terminal UI interface for viewing test progress and results.
* Built-in [profiling](/docs/profiling) support.
* Integrations such as [Hedgehog](/docs/extensions/sandwich-hedgehog), [QuickCheck](/docs/extensions/sandwich-quickcheck), and [Selenium](/docs/extensions/sandwich-webdriver).
* Context libraries that allow you to introduce things like [databases](/docs/context-libraries/sandwich-contexts#postgresql-contexts), [Docker containers](#TODO), or even full [Kubernetes clusters](/docs/context-libraries/sandwich-contexts-kubernetes).

<div className={styles.carouselContainer}>
<Carousel showThumbs={false}
dynamicHeight={true}
statusFormatter={(current, total) => `${current} of ${total}`}>
<div>
<div className={styles.carouselHeading}>Terminal UI interface</div>
<img src={useBaseUrl("/img/basic.gif")}
style={{ paddingBottom: "2.05em" }} />
</div>
<div>
<div className={styles.carouselHeading}>Jump to failure in editor</div>
<img src={useBaseUrl("/img/jump_to_error.gif")}
style={{ paddingBottom: "2.05em" }} />
</div>
<div>
<div className={styles.carouselHeading}>Slack integration</div>
<img src={useBaseUrl("/img/slack.gif")} />
</div>
<div>
<div className={styles.carouselHeading}>Timing and flamegraphs</div>
<img src={useBaseUrl("/img/timing_landing.gif")} />
</div>
</Carousel>
</div>

## Basic tests

Expand Down
1 change: 1 addition & 0 deletions sandwich-site/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const config: Config = {
'@docusaurus/preset-classic',
{
docs: {
// routeBasePath: "sandwich",
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
Expand Down
148 changes: 2 additions & 146 deletions sandwich-site/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,159 +1,15 @@

import React from "react";
import clsx from "clsx";
import Layout from "@theme/Layout";
import Link from "@docusaurus/Link";
import { Redirect } from "@docusaurus/router";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";
import Typist from "react-typist";

import styles from "./styles.module.css";

import "react-responsive-carousel/lib/styles/carousel.min.css";
import { Carousel } from "react-responsive-carousel";


const features = [
{
title: "Powerful formatters",
imageUrl: "img/print_formatter.png",
description: (
<>
Use the terminal UI formatter to inspect test results, re-run selected tests, or jump straight to test sources in your editor. Or, choose one of the more traditional formatters.
</>
),
}, {
title: "Easy profiling",
imageUrl: "img/speedscope.png",
description: (
<>
Automatically record timing data for every test suite and visualize it as a flamegraph.
</>
),
}, {
title: "Zero-config Selenium tests",
imageUrl: "img/selenium_logo.png",
description: (
<>
Automatically obtain Selenium driver binaries to match your Chrome or Firefox version, run tests in graphical or headless mode, and even record videos.
</>
),
},
];

function Feature({imageUrl, title, description}) {
const imgUrl = useBaseUrl(imageUrl);
return (
<div className={clsx("col col--4", styles.feature)}>
{imgUrl && (
<div className="text--center">
<img className={styles.featureImage} src={imgUrl} alt={title} />
</div>
)}
<h3>{title}</h3>
<p>{description}</p>
</div>
);
}

function Home() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout title={`Hello from ${siteConfig.title}`}
description="Yet another test framework for Haskell.">
<header className={styles.heroBanner}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>

<div className={styles.carouselContainer}>
<Carousel showThumbs={false}
dynamicHeight={true}>
<div>
<div className={styles.carouselHeading}>Terminal UI interface</div>
<img src={useBaseUrl("/img/basic.gif")}
style={{
paddingBottom: "2.05em"
}} />
</div>
<div>
<div className={styles.carouselHeading}>Jump to failure in editor</div>
<img src={useBaseUrl("/img/jump_to_error.gif")}
style={{
paddingBottom: "2.05em"
}} />
</div>
<div>
<div className={styles.carouselHeading}>Slack integration</div>
<img src={useBaseUrl("/img/slack.gif")} />
</div>
<div>
<div className={styles.carouselHeading}>Timing and flamegraphs</div>
<img src={useBaseUrl("/img/timing_landing.gif")} />
</div>
</Carousel>
</div>

<div className={styles.buttons}>
<Link
className={clsx(
"button button--outline button--secondary button--lg",
styles.getStarted,
)}
to={useBaseUrl("docs/")}>
Read the docs
</Link>

<span className={styles.indexCtasGitHubButtonWrapper}>
<iframe className={styles.indexCtasGitHubButton}
src="https://ghbtns.com/github-btn.html?user=codedownio&amp;repo=sandwich&amp;type=star&amp;count=true&amp;size=large"
width={160}
height={30}
title="GitHub Stars" />
</span>
</div>
</div>
</header>

<div className={"section " + styles.section}>
<div className={styles.container}>
<span className={styles.heading}>
Run the demo from the landing page:
</span>

<div className={styles.code}>
<Typist avgTypingDelay={20}
hideWhenDone={true}>
git clone [email protected]:codedownio/sandwich.git
<br />
cd sandwich
<br />
stack run demo-landing -- --tui
</Typist>
</div>

<span className={styles.heading}>
Or, try one of the other <a className={styles.sectionLink}
href="https://github.com/codedownio/sandwich/tree/master/demos">demos</a> with <code className={styles.codeInline}>stack run demo-[demoname]</code>.
</span>
</div>
</div>

<main>
{features && features.length > 0 && (
<section className={styles.features}>
<div className="container">
<div className="row">
{features.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
)}
</main>
</Layout>
);
return <Redirect to={siteConfig.baseUrl + "docs"} />;
}

export default Home;
6 changes: 1 addition & 5 deletions sandwich-site/src/pages/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
}

.carouselContainer {
width: 80%;
margin-left: auto;
margin-right: auto;
margin-bottom: 2em;

}

.buttons {
Expand All @@ -46,7 +43,6 @@
.carouselHeading {
font-size: 1.2em;
font-weight: bold;
color: white;
}

.section {
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

resolver: lts-22.27
resolver: lts-22.43

# ghc-options:
# "$locals": >-
Expand Down
8 changes: 4 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ packages:
subdir: x509-validation
snapshots:
- completed:
sha256: bc144ddf301a5c99f2cf51c7de50279ba144fd4486cb3c66f87ed761d6bbf6e9
size: 719131
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/27.yaml
original: lts-22.27
sha256: 08bd13ce621b41a8f5e51456b38d5b46d7783ce114a50ab604d6bbab0d002146
size: 720271
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/43.yaml
original: lts-22.43

0 comments on commit 1aef807

Please sign in to comment.