Skip to content

Commit a4bf625

Browse files
max-nextcloudsusnux
authored andcommitted
feat(e2e-test-server): Rename package and move to separate branch
Also update `README.md` to reflect the change. Remove `cypress` peer dependency to ease use in playwright. Signed-off-by: Max <max@nextcloud.com>
1 parent b09d5a4 commit a4bf625

8 files changed

Lines changed: 67 additions & 57 deletions

File tree

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
- SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
5-
# \@nextcloud/cypress
5+
# \@nextcloud/e2e-test-server
66

7-
[![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)
7+
[![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/e2e-test-server.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/e2e-test-server) ![Codecov](https://img.shields.io/codecov/c/github/nextcloud/nextcloud-cypress?style=flat-square)
88

9-
Nextcloud cypress helpers for Nextcloud apps and libraries
9+
Nextcloud e2e test server and utils for cypress and playwright.
1010

1111
## New package available
1212

@@ -16,47 +16,22 @@ that will work nicely with both cypress and playwright.
1616
It will eventually superseed `@nextcloud/cypress`.
1717
When starting a new project we recommend using `@nextcloud/e2e-test-server`.
1818

19-
## Commands
19+
## Status
2020

21-
You can import individual commands or all at once
22-
You can find [the list of all available commands here](https://nextcloud.github.io/nextcloud-cypress/modules/commands.html)
21+
This package is currently work in progress and will change significantly until version 1.0.
22+
In particular cypress specific utils such as selectors will be dropped unless they are widely used.
2323

24-
```js
25-
// cypress/support/commands.js
26-
import { addCommands } from '@nextcloud/cypress'
24+
## Starting Nextcloud Docker container
2725

28-
addCommands()
29-
```
26+
### Playwright
3027

31-
```js
32-
// cypress/support/commands.js
33-
import { getNc } from '@nextcloud/cypress/commands'
28+
This repository does not include playwritght configurations or examples yet.
3429

35-
Cypress.Commands.add('getNc', getNc)
36-
```
30+
Please take a look at the [forms app](https://github.com/nextcloud/forms) for an example of using `@nextlcloud/e2e-test-server` with playwright.
3731

38-
## Selectors
32+
### Cypress
3933

40-
You can find [the list of all available selectors here](https://nextcloud.github.io/nextcloud-cypress/modules/selectors.html)
41-
42-
```js
43-
import { UploadPicker as UploadPickerComponent} from '../../dist/index.js'
44-
import { UploadPicker, UploadPickerInput } from '@nextcloud/cypress/selectors'
45-
46-
describe('UploadPicker rendering', () => {
47-
it('Renders default UploadPicker', () => {
48-
cy.mount(UploadPickerComponent)
49-
cy.getNc(UploadPicker).should('exist')
50-
.should('have.class', 'upload-picker')
51-
cy.getNc(UploadPickerInput).should('exist')
52-
})
53-
})
54-
```
55-
56-
## Starting Nextcloud Docker container
57-
58-
It is possible to automatically start a docker container providing a Nextcloud instance for testing.
59-
Therefor adjust your `cypress.config.ts` (or `.js`):
34+
You can use the `cypress` folder and the `cypress.config.ts` in this repository as starting points or adjust your `cypress.config.ts` (or `.js`):
6035

6136
```js
6237
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'
@@ -89,3 +64,40 @@ export default defineConfig({
8964
},
9065
})
9166
```
67+
68+
## Cypress commands
69+
70+
You can import individual commands or all at once
71+
You can find [the list of all available commands here](https://nextcloud.github.io/nextcloud-cypress/modules/commands.html)
72+
73+
```js
74+
// cypress/support/commands.js
75+
import { addCommands } from '@nextcloud/cypress'
76+
77+
addCommands()
78+
```
79+
80+
```js
81+
// cypress/support/commands.js
82+
import { getNc } from '@nextcloud/cypress/commands'
83+
84+
Cypress.Commands.add('getNc', getNc)
85+
```
86+
87+
## Selectors (:warn: deprecated)
88+
89+
You can find [the list of all available selectors here](https://nextcloud.github.io/nextcloud-cypress/modules/selectors.html)
90+
91+
```js
92+
import { UploadPicker as UploadPickerComponent} from '../../dist/index.js'
93+
import { UploadPicker, UploadPickerInput } from '@nextcloud/cypress/selectors'
94+
95+
describe('UploadPicker rendering', () => {
96+
it('Renders default UploadPicker', () => {
97+
cy.mount(UploadPickerComponent)
98+
cy.getNc(UploadPicker).should('exist')
99+
.should('have.class', 'upload-picker')
100+
cy.getNc(UploadPickerInput).should('exist')
101+
})
102+
})
103+
```

REUSE.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
22
# SPDX-License-Identifier: AGPL-3.0-or-later
33
version = 1
4-
SPDX-PackageName = "nextcloud-cypress"
4+
SPDX-PackageName = "nextcloud-e2e-test-server"
55
SPDX-PackageSupplier = "Nextcloud <info@nextcloud.com>"
6-
SPDX-PackageDownloadLocation = "https://github.com/nextcloud-libraries/nextcloud-cypressg"
6+
SPDX-PackageDownloadLocation = "https://github.com/nextcloud-libraries/nextcloud-cypress"
77

88
[[annotations]]
99
path = ["package-lock.json", "package.json", "tsconfig.json", "__tests__/tsconfig.json", "cypress/tsconfig.json"]

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
// Making sure we're forcing the development mode
66
process.env.NODE_ENV = 'development'
7-
process.env.npm_package_name = 'nextcloud-cypress'
7+
process.env.npm_package_name = 'nextcloud-e2e-test-server'
88

99
/* eslint-disable import/first */
1010
import { configureNextcloud, createSnapshot, setupUsers, startNextcloud, stopNextcloud, waitOnNextcloud } from './lib/docker'

lib/commands/docker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function basename(path: string): string {
1111
function getContainerName(): Cypress.Chainable<string> {
1212
return cy.exec('pwd').then(({ stdout }) => {
1313
const name = basename(stdout).replace(' ', '')
14-
return cy.wrap(`nextcloud-cypress-tests_${name}`)
14+
return cy.wrap(`nextcloud-e2e-test-server_${name}`)
1515
})
1616
}
1717

lib/docker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let _serverBranch = 'master'
3636
export const getContainerName = function(): string {
3737
if (_containerName === null) {
3838
const app = basename(process.cwd()).replace(' ', '')
39-
_containerName = `nextcloud-cypress-tests_${app}`
39+
_containerName = `nextcloud-e2e-test-server_${app}`
4040
}
4141
return _containerName
4242
}

lib/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ declare global {
117117
* Register all existing commands provided by this library
118118
*
119119
* You can also manually register those commands by importing them
120-
* @example import { getNc } from '@nextcloud/cypress/commands'
121-
* Cypress.Commands.add('getNc', getNc)
120+
* @example import { login } from '@nextcloud/e2e-test-server/commands'
121+
* Cypress.Commands.add('login', login)
122122
*/
123123
export const addCommands = function() {
124124
Cypress.Commands.add('getNc', getNc)

package-lock.json

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@nextcloud/cypress",
3-
"version": "1.0.0-beta.15",
4-
"description": "Nextcloud cypress commands, utils and selectors library",
2+
"name": "@nextcloud/e2e-test-server",
3+
"version": "0.1.0",
4+
"description": "Nextcloud e2e test server and utils for cypress and playwright",
55
"main": "dist/index.cjs",
66
"module": "dist/index.js",
77
"types": "dist/index.d.ts",
@@ -35,7 +35,11 @@
3535
"license": "AGPL-3.0-or-later",
3636
"keywords": [
3737
"nextcloud",
38+
"docker",
39+
"e2e",
40+
"testing",
3841
"cypress",
42+
"playwright",
3943
"selector",
4044
"plugins",
4145
"library"
@@ -66,9 +70,6 @@
6670
"npm": "^10.0.0"
6771
},
6872
"homepage": "https://github.com/nextcloud/nextcloud-cypress",
69-
"peerDependencies": {
70-
"cypress": "^13.9.0"
71-
},
7273
"dependencies": {
7374
"dockerode": "^4.0.2",
7475
"fast-xml-parser": "^5.2.2",

0 commit comments

Comments
 (0)