Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: e2e tests #1362

Merged
merged 9 commits into from Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -67,14 +67,16 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'

- name: Install deps
run: pnpm install

- name: Run E2E
- name: Build docs
run: pnpm run docs:build:ci

- name: Run e2e
run: pnpm run docs:test:e2e:run

lint:
runs-on: ubuntu-latest
name: 'Lint: node-18, ubuntu-latest'
Expand Down
43 changes: 43 additions & 0 deletions cypress/e2e/api.cy.ts
@@ -0,0 +1,43 @@
describe('API Test', () => {
it('navigates to the api index search', () => {
// given
cy.visit('/');

// when
cy.get('a').contains('API').click();

// then
cy.url().should('include', '/api/');
cy.contains('API Reference');
});

describe('API Reference', () => {
beforeEach(() => {
// given
cy.visit('/api/');
});

it('should at least list more than 7 modules', () => {
cy.get('.api-group').should('have.length.above', 7);
});

it('should include at least 1 element in each module', () => {
cy.get('.api-group').each(($el) => {
cy.wrap($el).get('li a[href]').should('have.length.above', 0);
});
});

it('should not have dead links', () => {
cy.get('.api-group li').each(($el) => {
const text = $el.find('a').text();
const link = $el.find('a').attr('href');

cy.visit(`/api/${link}`);

cy.get('h2').should('include.text', text);
cy.get('h1').should('not.include.text', 'PAGE NOT FOUND');
cy.go('back');
});
});
});
});
13 changes: 13 additions & 0 deletions cypress/e2e/guide.cy.ts
@@ -0,0 +1,13 @@
describe('Guide Test', () => {
it('navigates to the getting started section', () => {
// given
cy.visit('/');

// when
cy.get('a').contains('Get Started').click();

// then
cy.url().should('include', '/guide/');
cy.contains('Getting Started');
});
});
26 changes: 0 additions & 26 deletions cypress/e2e/smoke.cy.ts

This file was deleted.

7 changes: 5 additions & 2 deletions cypress/tsconfig.json
@@ -1,8 +1,11 @@
{
"compilerOptions": {
"target": "ES5",
"lib": ["ES5", "DOM"],
"types": ["cypress"]
"lib": ["ES2015", "DOM"],
"types": ["cypress"],
"esModuleInterop": true,
"noEmit": true,
"resolveJsonModule": true
},
"include": ["**/*.ts"]
}
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -15,7 +15,8 @@
// "noImplicitAny": true,
// "noImplicitThis": true,
"useUnknownInCatchVariables": true,
"stripInternal": true
"stripInternal": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
Expand Down