Get rid of cypress

This commit is contained in:
Misode
2023-10-02 18:46:16 +02:00
parent 0c3504ca5b
commit 427294ad3b
8 changed files with 7 additions and 2977 deletions

View File

@@ -1 +0,0 @@
{}

View File

@@ -1,64 +0,0 @@
describe('Generators', () => {
beforeEach(() => {
cy.visit('/loot-table/')
cy.contains('h1', 'Loot Table Generator').should('exist')
cy.contains('label', 'Pools').should('exist')
})
it('can change an input field', () => {
cy.get('label:contains("Rolls") ~ input').clear().type('4').blur()
cy.get('[data-cy=import-area]').should('contain.value', '"rolls": 4')
})
it('can change a dropdown', () => {
cy.get('label:contains("Type") ~ select').first().select('minecraft:entity')
cy.get('[data-cy=import-area]').should('contain.value', '"type": "minecraft:entity"')
})
it('can add an element to an array', () => {
cy.get('label:contains("Pools") ~ button').click()
cy.get('[data-cy=tree]')
.find('label:contains("Rolls")').should('have.length', 2)
})
it('can remove an element from an array', () => {
cy.contains('label', 'Pools')
.get('button[aria-label="Remove"]').first().click()
cy.get('label:contains("Rolls")').should('not.exist')
})
it('can change a boolean field', () => {
cy.get('label:contains("Functions") ~ button').first().click()
cy.get('label:contains("Function") ~ select').should('have.value', 'minecraft:set_count')
cy.get('label:contains("Add") ~ button:contains("False")').click()
cy.get('[data-cy=import-area]').should('contain.value', '"add": false')
cy.get('label:contains("Add") ~ button:contains("False")').click()
cy.get('[data-cy=import-area]').should('not.contain.value', '"add": false')
cy.get('label:contains("Add") ~ button:contains("True")').click()
cy.get('[data-cy=import-area]').should('contain.value', '"add": true')
})
it('can collapse an element', () => {
cy.contains('label', 'Pools')
.get('button[aria-label^="Collapse"]').first().click()
cy.get('label:contains("Rolls")').should('not.exist')
cy.contains('label', 'Pools')
.get('button[aria-label^="Expand"]').first().click()
cy.get('[data-cy=tree]')
.find('label:contains("Rolls")').should('have.length', 1)
})
it('can move elements in an array', () => {
cy.get('label:contains("Rolls") ~ input').clear().type('4').blur()
cy.get('[data-cy=import-area]').should('contain.value', '"rolls": 4')
cy.get('label:contains("Rolls") ~ input').first().should('have.value', '4')
cy.get('label:contains("Pools") ~ button').click()
cy.get('[data-cy=tree]')
.find('label:contains("Rolls")').should('have.length', 2)
cy.get('label:contains("Rolls") ~ input').first().should('have.value', '1')
cy.get('button[aria-label="Move down"]').first().click()
cy.get('label:contains("Rolls") ~ input').first().should('have.value', '4')
cy.get('button[aria-label="Move up"]').last().click()
cy.get('label:contains("Rolls") ~ input').first().should('have.value', '1')
})
})

View File

@@ -1,86 +0,0 @@
describe('Settings and navigation', () => {
describe('Homepage', () => {
beforeEach(() => {
cy.visit('/')
cy.contains('h1', 'Data Pack Generators').should('exist')
})
it('can switch themes', () => {
cy.get('[data-cy=theme-switcher]').click()
.contains('Light').click()
cy.get('html').invoke('attr', 'data-theme').should('eq', 'light')
})
it('can switch languages', () => {
cy.get('[data-cy=language-switcher]').click()
.contains('Deutsch').click()
cy.contains('h1', 'Datenpaketgeneratoren').should('exist')
})
it('can open a generator', () => {
cy.contains('Loot Table').click()
cy.url().should('contain', '/loot-table')
cy.contains('h1', 'Loot Table Generator').should('exist')
cy.contains('label', 'Pools').should('exist')
})
})
describe('Generators', () => {
beforeEach(() => {
cy.visit('/loot-table/')
cy.contains('h1', 'Loot Table Generator').should('exist')
cy.contains('label', 'Pools').should('exist')
})
it('can switch between generators', () => {
cy.get('[data-cy=generator-switcher]').click()
.contains('Predicate').click()
cy.url().should('contain', '/predicate')
cy.contains('h1', 'Predicate Generator').should('exist')
})
it('can switch schema versions', () => {
cy.contains('Constant').should('exist')
cy.contains('Exact').should('not.exist')
cy.get('[data-cy=version-switcher]').click()
.contains('1.16').click()
cy.contains('Exact').should('exist')
cy.contains('Constant').should('not.exist')
})
it('can load a preset', () => {
cy.contains('Presets').click()
cy.contains('blocks/acacia_log').click()
cy.get('label:contains("Name") ~ input').should('have.value', 'minecraft:acacia_log')
})
it('can import JSON', () => {
cy.contains('Import').click()
cy.get('[data-cy=import-area]')
.type('{"pools":[{"rolls":2,"entries":[{"type":"minecraft:item","name":"minecraft:diamond"}]}]}', { parseSpecialCharSequences: false })
.blur()
cy.get('label:contains("Name") ~ input').should('have.value', 'minecraft:diamond')
cy.get('label:contains("Rolls") ~ input').should('have.value', '2')
})
it('can output YAML', () => {
cy.get('[data-cy=source-controls]').click()
.contains('YAML').click()
cy.get('[data-cy=import-area]').should('have.value', "pools:\n - rolls: 1\n entries:\n - type: 'minecraft:item'\n name: 'minecraft:stone'\n")
})
it('can output minified', () => {
cy.get('[data-cy=source-controls]').click()
.contains('Minified').click()
cy.get('[data-cy=import-area]').should('have.value', '{"pools":[{"rolls":1,"entries":[{"type":"minecraft:item","name":"minecraft:stone"}]}]}\n')
})
it('can go back to the homepage', () => {
cy.get('[data-cy=home-link]').click()
cy.url().should('not.contain', '/loot-table')
cy.contains('h1', 'Data Pack Generators').should('exist')
})
})
})

View File

@@ -1,2 +0,0 @@
export default (on, config) => {
}

View File

@@ -1,8 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}

2822
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,6 @@
"@types/seedrandom": "^2.4.28", "@types/seedrandom": "^2.4.28",
"@typescript-eslint/eslint-plugin": "^5.28.0", "@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0", "@typescript-eslint/parser": "^5.28.0",
"cypress": "^9.2.0",
"eslint": "^8.17.0", "eslint": "^8.17.0",
"fast-glob": "^3.2.11", "fast-glob": "^3.2.11",
"preact": "^10.8.0", "preact": "^10.8.0",