Skip to content

Commit 3641ccf

Browse files
authored
Merge pull request #1 from wmde/feat/initial-commit-cypress-wikibase-tasks-20240819
Add first Cypress tasks for basic API functionality
2 parents 3e66e8b + 0db9b52 commit 3641ccf

File tree

8 files changed

+3607
-0
lines changed

8 files changed

+3607
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "wikimedia/server",
3+
"env": {
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"parserOptions": {
9+
"ecmaVersion": 2017
10+
},
11+
"rules": {
12+
"max-len": [ "error", 120 ]
13+
}
14+
}

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing
2+
3+
## How to make a new Release
4+
5+
1. Update version number in package.json (follow [Semantic Versioning](https://semver.org/)) in an extra commit
6+
1. Merge the Pull Request with that commit
7+
1. Tag the commit with the new version number on master locally and push the tag to GitHub
8+
1. On GitHub create a new "[Release](https://github.com/wmde/cypress-wikibase-api/releases)" for the tag with information on what changed
9+
1. GitHub actions will push the new Release to [npm](https://www.npmjs.com/package/cypress-wikibase-api)

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
11
# cypress-wikibase-api
22
Cypress plugin and utility functions for writing Cypress tests of Wikibase
3+
4+
This module contains Cypress tasks to be used in Cypress browser tests for Wikibase and its extensions.
5+
6+
## Usage example
7+
8+
For example, in the Cypress tests in WikibaseLexeme, we use the API to get data about an entity that we created during our testing:
9+
10+
```javascript
11+
lexemePage.headerId().then( ( lexemeId ) => {
12+
cy.task( 'MwApi:GetEntityData', { entityId: lexemeId } ).then( ( lexeme ) => {
13+
expect( lexeme.lemmas[ languageItemsLanguageCode ].value ).to.eq( lemma );
14+
expect( lexeme.language ).to.eq( languageId );
15+
expect( lexeme.lexicalCategory ).to.eq( lexicalCategoryId );
16+
} );
17+
});
18+
```
19+
20+
## Development
21+
22+
When testing changes locally, you can install the checked-out module from the project that you are working on:
23+
24+
```
25+
npm rm cypress-wikibase-api
26+
npm i -D ~/work/cypress-wikibase-api
27+
```
28+
29+
## Contributing
30+
31+
Please file any bugs or issues with our issue-tracker at [phabricator.wikimedia.org](https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?tags=Wikidata,Browser-Tests).
32+
33+
For instruction of how to create a new release, please see [CONTRIBUTING.md](CONTRIBUTING.md)

0 commit comments

Comments
 (0)