-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,398 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Sample workflow for building and deploying a VitePress site to GitHub Pages | ||
# | ||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the `main` branch. Change this to `master` if you're | ||
# using the `master` branch as the default branch. | ||
push: | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Not needed if lastUpdated is not enabled | ||
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm | ||
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Build with VitePress | ||
run: | | ||
yarn docs:build | ||
touch docs/.vitepress/dist/.nojekyll | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: docs/.vitepress/dist | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
|
||
.vitepress/dist | ||
.vitepress/cache |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineConfig } from 'vitepress' | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "Documenté", | ||
description: "A literate testing framework to generate automated tests from documentation files", | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
logo: '/logo.svg', | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
{ text: 'Guide', link: '/guide' }, | ||
{ text: 'Language', link: '/language-overview' }, | ||
], | ||
|
||
sidebar: [ | ||
{ | ||
text: 'Introduction', | ||
items: [ | ||
{ text: 'What is Documenté', link: '/guide' }, | ||
{ text: 'Get started', link: '/get-started' }, | ||
{ text: 'Language overview', link: '/language-overview' }, | ||
] | ||
} | ||
], | ||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/documente' } | ||
] | ||
} | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// https://vitepress.dev/guide/custom-theme | ||
import { h } from 'vue' | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import './style.css' | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout: () => { | ||
return h(DefaultTheme.Layout, null, { | ||
// https://vitepress.dev/guide/extending-default-theme#layout-slots | ||
}) | ||
}, | ||
enhanceApp({ app, router, siteData }) { | ||
// ... | ||
} | ||
} satisfies Theme |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/** | ||
* Customize default theme styling by overriding CSS variables: | ||
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css | ||
*/ | ||
|
||
/** | ||
* Colors | ||
* | ||
* Each colors have exact same color scale system with 3 levels of solid | ||
* colors with different brightness, and 1 soft color. | ||
* | ||
* - `XXX-1`: The most solid color used mainly for colored text. It must | ||
* satisfy the contrast ratio against when used on top of `XXX-soft`. | ||
* | ||
* - `XXX-2`: The color used mainly for hover state of the button. | ||
* | ||
* - `XXX-3`: The color for solid background, such as bg color of the button. | ||
* It must satisfy the contrast ratio with pure white (#ffffff) text on | ||
* top of it. | ||
* | ||
* - `XXX-soft`: The color used for subtle background such as custom container | ||
* or badges. It must satisfy the contrast ratio when putting `XXX-1` colors | ||
* on top of it. | ||
* | ||
* The soft color must be semi transparent alpha channel. This is crucial | ||
* because it allows adding multiple "soft" colors on top of each other | ||
* to create a accent, such as when having inline code block inside | ||
* custom containers. | ||
* | ||
* - `default`: The color used purely for subtle indication without any | ||
* special meanings attched to it such as bg color for menu hover state. | ||
* | ||
* - `brand`: Used for primary brand colors, such as link text, button with | ||
* brand theme, etc. | ||
* | ||
* - `tip`: Used to indicate useful information. The default theme uses the | ||
* brand color for this by default. | ||
* | ||
* - `warning`: Used to indicate warning to the users. Used in custom | ||
* container, badges, etc. | ||
* | ||
* - `danger`: Used to show error, or dangerous message to the users. Used | ||
* in custom container, badges, etc. | ||
* -------------------------------------------------------------------------- */ | ||
|
||
:root { | ||
--vp-c-default-1: var(--vp-c-gray-1); | ||
--vp-c-default-2: var(--vp-c-gray-2); | ||
--vp-c-default-3: var(--vp-c-gray-3); | ||
--vp-c-default-soft: var(--vp-c-gray-soft); | ||
|
||
--vp-c-brand-1: var(--vp-c-indigo-1); | ||
--vp-c-brand-2: var(--vp-c-indigo-2); | ||
--vp-c-brand-3: var(--vp-c-indigo-3); | ||
--vp-c-brand-soft: var(--vp-c-indigo-soft); | ||
|
||
--vp-c-tip-1: var(--vp-c-brand-1); | ||
--vp-c-tip-2: var(--vp-c-brand-2); | ||
--vp-c-tip-3: var(--vp-c-brand-3); | ||
--vp-c-tip-soft: var(--vp-c-brand-soft); | ||
|
||
--vp-c-warning-1: var(--vp-c-yellow-1); | ||
--vp-c-warning-2: var(--vp-c-yellow-2); | ||
--vp-c-warning-3: var(--vp-c-yellow-3); | ||
--vp-c-warning-soft: var(--vp-c-yellow-soft); | ||
|
||
--vp-c-danger-1: var(--vp-c-red-1); | ||
--vp-c-danger-2: var(--vp-c-red-2); | ||
--vp-c-danger-3: var(--vp-c-red-3); | ||
--vp-c-danger-soft: var(--vp-c-red-soft); | ||
} | ||
|
||
/** | ||
* Component: Button | ||
* -------------------------------------------------------------------------- */ | ||
|
||
:root { | ||
--vp-button-brand-border: transparent; | ||
--vp-button-brand-text: var(--vp-c-white); | ||
--vp-button-brand-bg: var(--vp-c-brand-3); | ||
--vp-button-brand-hover-border: transparent; | ||
--vp-button-brand-hover-text: var(--vp-c-white); | ||
--vp-button-brand-hover-bg: var(--vp-c-brand-2); | ||
--vp-button-brand-active-border: transparent; | ||
--vp-button-brand-active-text: var(--vp-c-white); | ||
--vp-button-brand-active-bg: var(--vp-c-brand-1); | ||
} | ||
|
||
/** | ||
* Component: Home | ||
* -------------------------------------------------------------------------- */ | ||
|
||
:root { | ||
--vp-home-hero-name-color: transparent; | ||
--vp-home-hero-name-background: -webkit-linear-gradient( | ||
120deg, | ||
#4dfa98 50%, | ||
#55f62a | ||
); | ||
|
||
--vp-home-hero-image-background-image: linear-gradient( | ||
-45deg, | ||
#4dfa9880 50%, | ||
#55f62a80 50% | ||
); | ||
--vp-home-hero-image-filter: blur(96px); | ||
} | ||
|
||
@media (min-width: 640px) { | ||
:root { | ||
--vp-home-hero-image-filter: blur(96px); | ||
} | ||
} | ||
|
||
@media (min-width: 960px) { | ||
:root { | ||
--vp-home-hero-image-filter: blur(68px); | ||
} | ||
} | ||
|
||
.VPHero .image img { | ||
max-width: 380px; | ||
} | ||
|
||
/** | ||
* Component: Custom Block | ||
* -------------------------------------------------------------------------- */ | ||
|
||
:root { | ||
--vp-custom-block-tip-border: transparent; | ||
--vp-custom-block-tip-text: var(--vp-c-text-1); | ||
--vp-custom-block-tip-bg: var(--vp-c-brand-soft); | ||
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); | ||
} | ||
|
||
/** | ||
* Component: Algolia | ||
* -------------------------------------------------------------------------- */ | ||
|
||
.DocSearch { | ||
--docsearch-primary-color: var(--vp-c-brand-1) !important; | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Get started | ||
|
||
## Set up your project | ||
|
||
### Prerequisites | ||
|
||
Documenté integrates into projects with a end-to-end testing framework installed. You can refer to [Cypress](https://docs.cypress.io/guides/getting-started/installing-cypress) or [Playwright](https://playwright.dev/docs/intro) installation instructions to get started. | ||
|
||
### Installation | ||
|
||
Install Documenté as a dev dependency: | ||
|
||
```bash | ||
yarn add --dev @documente/documente | ||
``` | ||
|
||
Or with npm: | ||
|
||
```bash | ||
npm install --save-dev @documente/documente | ||
``` | ||
|
||
You can also install Documenté globally: | ||
|
||
```bash | ||
npm install --global @documente/documente | ||
``` | ||
|
||
### Configuration | ||
|
||
Create a `documente.config.yml` file at the root of your project: | ||
|
||
```yaml | ||
runner: playwright # either "playwright" or "cypress" | ||
input: docs/**/*.md # location of documentation to extract tests from | ||
outputDir: tests # directory in which tests should be generated | ||
selectors: documente/selectors.yaml # path to selectors file | ||
``` | ||
## Write your first specification | ||
### Describing your application with a selectors file | ||
Documenté expects a YAML file with a tree-like representation of your application. | ||
Here is an example selectors file, describing a login form containing a login field, a password field and a confirm button, as well as error and welcome message containers. | ||
Documenté uses the [standard HTML5 selectors](https://drafts.csswg.org/selectors/) which allow you to locate HTML elements by type, class, ID, attribute... | ||
```yaml | ||
login form: | ||
_selector: .login-form | ||
login field: input[type="text"] | ||
password field: input[type="password"] | ||
confirm button: button[type="submit"] | ||
login error message: .error-message | ||
welcome message: .welcome-message | ||
``` | ||
### Writing specifications | ||
Specifications are written in Markdown files, using the [Phrasé](https://github.com/documente/phrase) syntax. | ||
Here is an example of a specification file: | ||
````markdown | ||
# How to use my awesome application | ||
Login into the application to be greeted by a cool welcome message. | ||
```phrase | ||
when I login | ||
then welcome message should be visible | ||
and it should have text "Welcome, user01!" | ||
done | ||
``` | ||
|
||
In order to login, simply type your username and password in the login form and click on the login button. | ||
|
||
```phrase | ||
In order to login: | ||
- I type "user01" on login form login field | ||
- I type "password" on password field | ||
- I click on login form confirm button | ||
done | ||
``` | ||
```` | ||
You can place the specifications in any folder you want, as long as you specify the correct path in the `input` property of the `documente.config.yml` file. | ||
A good practice is to place the specifications in a `docs` folder at the root of your project. | ||
Take a look at the [Phrasé repository](https://github.com/documente/phrase) for more information about the test syntax. | ||
The [example project](https://github.com/documente/example-sut) will also give you a good idea of how to write specifications. | ||
## Run your first tests | ||
### Extracting the specifications | ||
To extract the specifications from the documentation files, run `documente` from the root of your project: | ||
```bash | ||
documente | ||
``` | ||
This will generate test files in the output folder. | ||
### Running the tests | ||
You can run the tests just like you would run other Cypress or Playwright tests. | ||
With Cypress: | ||
```bash | ||
cypress open | ||
``` | ||
Or with Playwright: | ||
```bash | ||
playwright test --ui | ||
``` | ||
## Example project | ||
You can find an example repository [here](https://github.com/documente/example-sut) with a simple application and a set of specifications. |
Oops, something went wrong.