Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nextcloud-libraries/nextcloud-cypress
Nextcloud cypress commands, utils and selectors library https://npmjs.org/@nextcloud/cypress
https://github.com/nextcloud-libraries/nextcloud-cypress
javascript-library
Last synced: about 10 hours ago
JSON representation
Nextcloud cypress commands, utils and selectors library https://npmjs.org/@nextcloud/cypress
- Host: GitHub
- URL: https://github.com/nextcloud-libraries/nextcloud-cypress
- Owner: nextcloud-libraries
- License: agpl-3.0
- Created: 2022-06-23T15:30:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T20:03:39.000Z (4 months ago)
- Last Synced: 2024-05-22T20:55:22.729Z (4 months ago)
- Topics: javascript-library
- Language: TypeScript
- Homepage: https://nextcloud-libraries.github.io/nextcloud-cypress/
- Size: 7.36 MB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# \@nextcloud/cypress
[![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/nextcloud-cypress)](https://api.reuse.software/info/github.com/nextcloud-libraries/nextcloud-cypress) [![npm last version](https://img.shields.io/npm/v/@nextcloud/cypress.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/cypress) ![Codecov](https://img.shields.io/codecov/c/github/nextcloud/nextcloud-cypress?style=flat-square)
Nextcloud cypress helpers for Nextcloud apps and libraries
## Commands
You can import individual commands or all at once
You can find [the list of all available commands here](https://nextcloud.github.io/nextcloud-cypress/modules/commands.html)```js
// cypress/support/commands.js
import { addCommands } from '@nextcloud/cypress'addCommands()
``````js
// cypress/support/commands.js
import { getNc } from '@nextcloud/cypress/commands'Cypress.Commands.add('getNc', getNc)
```## Selectors
You can find [the list of all available selectors here](https://nextcloud.github.io/nextcloud-cypress/modules/selectors.html)
```js
import { UploadPicker as UploadPickerComponent} from '../../dist/index.js'
import { UploadPicker, UploadPickerInput } from '@nextcloud/cypress/selectors'describe('UploadPicker rendering', () => {
it('Renders default UploadPicker', () => {
cy.mount(UploadPickerComponent)
cy.getNc(UploadPicker).should('exist')
.should('have.class', 'upload-picker')
cy.getNc(UploadPickerInput).should('exist')
})
})
```## Starting Nextcloud Docker container
It is possible to automatically start a docker container providing a Nextcloud instance for testing.
Therefor adjust your `cypress.config.ts` (or `.js`):```js
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'export default defineConfig({
// ...
e2e: {
// other configurationsetupNodeEvents(on, config) {
// Remove container after run
on('after:run', () => {
stopNextcloud()
})// starting Nextcloud testing container with specified server branch
return startNextcloud(process.env.BRANCH)
.then((ip) => {
// Setting container's IP as base Url
config.baseUrl = `http://${ip}/index.php`
return ip
})
.then(waitOnNextcloud)
// configure Nextcloud, also install and enable the `viewer` app
.then(() => configureNextcloud(['viewer']))
.then(() => {
return config
})
},
},
})
```