Skip to content

Commit 5cf652a

Browse files
committed
add cypress smoketest for scaffolded static crs...
1 parent a557447 commit 5cf652a

File tree

6 files changed

+83
-2
lines changed

6 files changed

+83
-2
lines changed

packages/cli/cypress.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
e2e: {
5+
baseUrl: 'http://localhost:5173', // Default Vite dev server port
6+
supportFile: 'cypress/support/e2e.js',
7+
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
8+
setupNodeEvents(on, config) {
9+
// implement node event listeners here
10+
},
11+
},
12+
// Increase the default timeout for slower operations
13+
defaultCommandTimeout: 10000,
14+
// Viewport configuration
15+
viewportWidth: 1280,
16+
viewportHeight: 800,
17+
});
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Test for CLI scaffolded application
2+
describe('CLI Scaffolded App - Study View', () => {
3+
it('should navigate to /study and render a card', () => {
4+
// Visit the study page
5+
cy.visit('/study');
6+
7+
// Wait for the application to load and render
8+
// Check for the presence of a card view
9+
// The cardView class is present on all rendered cards
10+
cy.get('.cardView', { timeout: 15000 })
11+
.should('exist')
12+
.and('be.visible');
13+
14+
// Additional validation: check that the card has a viewable data attribute
15+
// This indicates it's a properly rendered card component
16+
cy.get('[data-viewable]', { timeout: 15000 })
17+
.should('exist')
18+
.and('be.visible');
19+
20+
// Verify that the card container (v-card) is present
21+
cy.get('.v-card', { timeout: 15000 })
22+
.should('exist')
23+
.and('be.visible');
24+
});
25+
26+
it('should load the home page successfully', () => {
27+
cy.visit('/');
28+
29+
// Verify basic page load
30+
cy.get('body').should('be.visible');
31+
});
32+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands';

packages/cli/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"lint": "npx eslint .",
2727
"lint:fix": "npx eslint . --fix",
2828
"lint:check": "npx eslint . --max-warnings 0",
29-
"try:init": "node dist/cli.js init testproject --dangerously-clobber --no-interactive --data-layer static --import-course-data --import-server-url http://localhost:5984 --import-username admin --import-password password --import-course-ids 2aeb8315ef78f3e89ca386992d00825b && cd testproject && npm i && npm install --save-dev @vue-skuilder/cli@file:.. && npm install @vue-skuilder/db@file:../../db @vue-skuilder/courseware@file:../../courseware @vue-skuilder/common-ui@file:../../common-ui @vue-skuilder/express@file:../../express"
29+
"try:init": "node dist/cli.js init testproject --dangerously-clobber --no-interactive --data-layer static --import-course-data --import-server-url http://localhost:5984 --import-username admin --import-password password --import-course-ids 2aeb8315ef78f3e89ca386992d00825b && cd testproject && npm i && npm install --save-dev @vue-skuilder/cli@file:.. && npm install @vue-skuilder/db@file:../../db @vue-skuilder/courseware@file:../../courseware @vue-skuilder/common-ui@file:../../common-ui @vue-skuilder/express@file:../../express",
30+
"test:e2e": "cypress open",
31+
"test:e2e:headless": "cypress run"
3032
},
3133
"keywords": [
3234
"cli",
@@ -64,9 +66,11 @@
6466
"@types/serve-static": "^1.15.0",
6567
"@vitejs/plugin-vue": "^5.2.1",
6668
"@vue-skuilder/studio-ui": "workspace:*",
69+
"cypress": "14.1.0",
6770
"typescript": "~5.7.2",
6871
"vite": "^6.0.9",
69-
"vue-tsc": "^1.8.0"
72+
"vue-tsc": "^1.8.0",
73+
"wait-on": "8.0.2"
7074
},
7175
"engines": {
7276
"node": ">=18.0.0"

yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6502,6 +6502,7 @@ __metadata:
65026502
"@vue-skuilder/studio-ui": "workspace:*"
65036503
chalk: "npm:^5.3.0"
65046504
commander: "npm:^11.0.0"
6505+
cypress: "npm:14.1.0"
65056506
fs-extra: "npm:^11.2.0"
65066507
inquirer: "npm:^9.2.0"
65076508
leveldown: "npm:^6.1.1"
@@ -6514,6 +6515,7 @@ __metadata:
65146515
vue-router: "npm:^4.2.0"
65156516
vue-tsc: "npm:^1.8.0"
65166517
vuetify: "npm:^3.7.0"
6518+
wait-on: "npm:8.0.2"
65176519
bin:
65186520
skuilder: ./dist/cli.js
65196521
languageName: unknown

0 commit comments

Comments
 (0)