-
Notifications
You must be signed in to change notification settings - Fork 168
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
Sadanand Pai
committed
Oct 4, 2023
1 parent
8c0244c
commit 467a232
Showing
17 changed files
with
1,801 additions
and
10 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 |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
run: | | ||
npm install | ||
npm test | ||
npm run e2e:test | ||
rm -rf dist | ||
npm run build | ||
git add dist -f | ||
|
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,10 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:5173', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
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,19 @@ | ||
const nativeInputValueSetter = Object.getOwnPropertyDescriptor( | ||
window.HTMLInputElement.prototype, | ||
'value' | ||
).set; | ||
|
||
describe('template spec', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('should verify sorting', () => { | ||
cy.get('[data-testid="navbar"]').should('be.visible'); | ||
|
||
cy.get('[data-testid="navbar"]').should( | ||
'contain.html', | ||
'Sorting visualizers' | ||
); | ||
}); | ||
}); |
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,70 @@ | ||
const nativeInputValueSetter = Object.getOwnPropertyDescriptor( | ||
window.HTMLInputElement.prototype, | ||
'value' | ||
).set; | ||
|
||
function verifySorting() { | ||
cy.get('#user-input').should('contain.value', '6, 8, 3, 5, 1, 9, 2, 7, 4'); | ||
cy.get('#user-input').type('{selectAll} 6, 8, 3, 5, 9, 2, 7'); | ||
|
||
cy.get('[data-testid="cell-values"]').should('contain.text', '6835927'); | ||
cy.get('#speed').then(($range) => { | ||
const range = $range[0]; | ||
nativeInputValueSetter.call(range, 20); | ||
range.dispatchEvent( | ||
new Event('change', { value: 20, bubbles: true } as EventInit) | ||
); | ||
}); | ||
|
||
const player = cy.get('[data-testid="player"]'); | ||
player.click(); | ||
|
||
player.should('be.disabled'); | ||
cy.get('[data-testid="cell-values"]').should('contain.text', '2356789'); | ||
} | ||
|
||
describe('template spec', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('should verify bubble sort', () => { | ||
cy.get('a').contains('bubble').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify selection sort', () => { | ||
cy.get('a').contains('selection').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify insertion sort', () => { | ||
cy.get('a').contains('insertion').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify heap sort', () => { | ||
cy.get('a').contains('heap').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify merge sort', () => { | ||
cy.get('a').contains('merge').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify quick sort', () => { | ||
cy.get('a').contains('quick').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify shell sort', () => { | ||
cy.get('a').contains('shell').click(); | ||
verifySorting(); | ||
}); | ||
|
||
it('should verify cocktail sort', () => { | ||
cy.get('a').contains('cocktail').click(); | ||
verifySorting(); | ||
}); | ||
}); |
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,37 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
// This example commands.ts shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } |
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,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
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,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "http://localhost:5173", | ||
"target": "ES2015", | ||
"lib": ["ES2015", "dom"], | ||
"types": ["cypress", "node"], | ||
"moduleResolution": "NodeNext", | ||
"module": "NodeNext", | ||
"paths": { | ||
"@/*": ["../src/*"] | ||
} | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
Oops, something went wrong.