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

🐞 fix(cypress): bump to v10 #841

Merged
merged 4 commits into from
Jul 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generators/app/templates/specs/integration/landing_spec.js
generators/app/templates/specs/e2e/landing.cy.js
generators/app/templates/specs/mocha/rest_spec.js
generators/app/templates/specs/xqs/xqSuite.js

Expand Down
36 changes: 15 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ First, install [Yeoman](http://yeoman.io) and generator-exist using [npm](https:
To install a pre-release version:

```bash
npm i -g yo
npm i -g yo@4
npm i -g git://github.com/eXist-db/generator-exist.git
```

Expand All @@ -26,7 +26,7 @@ npm i -g git://github.com/eXist-db/generator-exist.git
To install a version published to npm:

```bash
npm i -g yo
npm i -g yo@4
npm i -g @existdb/generator-exist
```

Expand All @@ -35,7 +35,7 @@ npm i -g @existdb/generator-exist
Alternatively, if you have cloned this repo from GitHub. You can symlink your local clone into your global node environment. This is particularly useful during development. From inside the folder with the cloned repo:

```bash
npm install -g yo
npm install -g yo@4
npm i
npm link
```
Expand Down Expand Up @@ -105,7 +105,7 @@ Since if would be impractical to go through all possible combinations of option
├── build.xml
├── collection.xconf
├── controller.xq
├── cypress.json
├── cypress.config.js
├── error-page.html
├── expath-pkg.xml
├── icon.png
Expand Down Expand Up @@ -154,15 +154,13 @@ Since if would be impractical to go through all possible combinations of option
├── cypress
│   ├── fixtures
│   │   └── example.json
│   ├── integration
│   │   ├── landing_spec.js
│   ├── e2e
│   │   ├── landing.cy.js
│   │   ├── login-fail_spec.js
│   │   └── login-ok_spec.js
│   ├── plugins
│   │   └── index.js
│   └── support
│   ├── commands.js
│   └── index.js
│   └── e2e.js
├── mocha
│   ├── app_spec.js
│   └── rest_spec.js
Expand All @@ -183,7 +181,7 @@ Since if would be impractical to go through all possible combinations of option
├── build.xml
├── collection.xconf
├── controller.xq
├── cypress.json
├── cypress.config.js
├── error-page.html
├── expath-pkg.xml
├── icon.png
Expand Down Expand Up @@ -211,13 +209,11 @@ Since if would be impractical to go through all possible combinations of option
├── cypress
│   ├── fixtures
│   │   └── example.json
│   ├── integration
│   │   └── landing_spec.js
│   ├── plugins
│   │   └── index.js
│   ├── e2e
│   │   └── landing.cy.js
│   └── support
│   ├── commands.js
│   └── index.js
│   └── e2e.js
├── mocha
│   ├── app_spec.js
│   └── rest_spec.js
Expand All @@ -235,7 +231,7 @@ Since if would be impractical to go through all possible combinations of option
│   ├── empty_demo-1.0.0-dev.xar
│   └── empty_demo-1.0.0.xar
├── build.xml
├── cypress.json
├── cypress.config.js
├── expath-pkg.xml
├── icon.png
├── node_modules
Expand All @@ -250,13 +246,11 @@ Since if would be impractical to go through all possible combinations of option
├── cypress
│   ├── fixtures
│   │   └── example.json
│   ├── integration
│   │   └── landing_spec.js
│   ├── plugins
│   │   └── index.js
│   ├── e2e
│   │   └── landing.cy.js
│   └── support
│   ├── commands.js
│   └── index.js
│   └── e2e.js
├── mocha
│   ├── app_spec.js
│   └── rest_spec.js
Expand Down
22 changes: 15 additions & 7 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,15 @@ module.exports = class extends Generator {
},
repository: ''
}
this.npmInstall(['chai', 'chai-xml', 'fs-extra', 'mocha', 'supertest', 'xmldoc', 'yeoman-assert'], { 'save-dev': true })
this.env.options.nodePackageManager = 'npm'
// see https://github.com/yeoman/generator/issues/1294
this.npmInstall(['chai'], { 'save-dev': true })
this.npmInstall(['chai-xml'], { 'save-dev': true })
this.npmInstall(['fs-extra'], { 'save-dev': true })
this.npmInstall(['mocha'], { 'save-dev': true })
this.npmInstall(['supertest'], { 'save-dev': true })
this.npmInstall(['xmldoc'], { 'save-dev': true })
this.npmInstall(['yeoman-assert'], { 'save-dev': true })
// Applies to all (without prompts)
// TODO #56 html -> xhtml

Expand Down Expand Up @@ -498,8 +506,8 @@ module.exports = class extends Generator {
)

this.fs.copy(
this.templatePath('specs/cypress.json'),
this.destinationPath('cypress.json')
this.templatePath('specs/cypress.config.js'),
this.destinationPath('cypress.config.js')
)

this.fs.copy(
Expand All @@ -513,8 +521,8 @@ module.exports = class extends Generator {
)

this.fs.copyTpl(
this.templatePath('specs/integration/landing_spec.js'),
this.destinationPath('test/cypress/integration/landing_spec.js'), {
this.templatePath('specs/e2e/landing.cy.js'),
this.destinationPath('test/cypress/e2e/landing.cy.js'), {
apptype: this.props.apptype[0],
short: this.props.short,
defcoll: this.props.defcoll,
Expand Down Expand Up @@ -681,8 +689,8 @@ module.exports = class extends Generator {
this.destinationPath('templates/')
)
this.fs.copyTpl(
this.templatePath('specs/integration/login-*_spec.js'),
this.destinationPath('test/cypress/integration/'), {
this.templatePath('specs/e2e/login-*.cy.js'),
this.destinationPath('test/cypress/e2e/'), {
defcoll: this.props.defcoll,
short: this.props.short
})
Expand Down
16 changes: 16 additions & 0 deletions generators/app/templates/specs/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
screenshotsFolder: 'reports/screenshots',
videosFolder: 'reports/videos',
fixturesFolder: 'test/cypress/fixtures',
e2e: {
setupNodeEvents (on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:8080',
includeShadowDom: true,
specPattern: 'test/cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'test/cypress/support/e2e.js'
}
})
9 changes: 0 additions & 9 deletions generators/app/templates/specs/cypress.json

This file was deleted.

17 changes: 0 additions & 17 deletions generators/app/templates/specs/cypress/plugins/index.js

This file was deleted.

10 changes: 5 additions & 5 deletions generators/app/templates/specs/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ***********************************************************
// This example support/index.js is processed and
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
Expand Down
2 changes: 1 addition & 1 deletion test/generated-pkg/app-eXide-plain.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('eXide plain app', function () {
admin: 'admin',
adminpw: 'pw123'
})
assert.noFile(['resources/images/bold.gif', 'pre-install.xq', 'test/cypress/integration/secure_spec.js', '.travis.yml', 'resources/css/exist-2.2.css'])
assert.noFile(['resources/images/bold.gif', 'pre-install.xq', 'test/cypress/e2e/secure.cy.js', '.travis.yml', 'resources/css/exist-2.2.css'])
})

describe('plain package has', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/generated-pkg/app-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('empty package', function () {
github: false,
atom: false
})
assert.noFile(['modules/app.xqm', 'templates/page.html', 'test/cypress/integration/login-ok_spec.js', 'index.html'])
assert.noFile(['modules/app.xqm', 'templates/page.html', 'test/cypress/e2e/login-ok.cy.js', 'index.html'])
})

describe('empty has', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/generated-pkg/app-mysec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('eXide style …', function () {

describe('secure exist design has …', function () {
it('default files and restricted area', function (done) {
assert.file(['admin/controller.xq', 'admin/index.html', 'templates/login-panel.html', 'pre-install.xq', 'test/cypress/integration/login-ok_spec.js'])
assert.file(['admin/controller.xq', 'admin/index.html', 'templates/login-panel.html', 'pre-install.xq', 'test/cypress/e2e/login-ok.cy.js'])
done()
})

Expand Down
2 changes: 1 addition & 1 deletion test/util/meta-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.metaTest = function () {
})

it('integration-tests', function (done) {
assert.file(['cypress.json', 'test/cypress/integration/landing_spec.js', 'reports/videos/.gitkeep'])
assert.file(['cypress.config.js', 'test/cypress/e2e/landing.cy.js', 'reports/videos/.gitkeep'])
done()
})
}