-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add initial Cypress test suite * ci: Run Cypress tests * Rename CI workflow to match reality * Add missing Cypress install step * Add Cache action to avoid downloading too many things
- Loading branch information
Showing
13 changed files
with
3,280 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: Java CI with Maven | ||
name: CI | ||
|
||
on: | ||
push: | ||
|
@@ -25,20 +25,38 @@ jobs: | |
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
cypress/openrefine-*.tar.gz | ||
**/node_modules | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Build with Maven | ||
run: mvn -B package | ||
|
||
- name: Install Cypress | ||
run: | | ||
cd ./cypress | ||
npm i -g yarn | ||
yarn install | ||
- name: Run Cypress tests | ||
run: ./cypress/run_headless.sh | ||
|
||
- name: Get release upload URL | ||
id: get_release_upload_url | ||
if: github.event_name == 'release' | ||
uses: bruceadams/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Extract version string | ||
id: version_string_variable | ||
run: echo "VERSION_STRING=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | ||
|
||
- name: Upload release asset | ||
id: upload-release-asset | ||
if: github.event_name == 'release' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
.yarn/ | ||
.yarnrc.yml | ||
openrefine* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Commons extension E2E tests | ||
|
||
Inspired from [OpenRefine's own Cypress test suite](https://openrefine.org/docs/technical-reference/functional-tests) | ||
|
||
Install the dependencies with `yarn install`. | ||
|
||
Run the test suite with `yarn run cypress open`. | ||
|
||
This requires a running instance of OpenRefine with the CommonsExtension installed at `http://localhost:3333/`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
keystrokeDelay: 0, | ||
viewportWidth: 1280, | ||
viewportHeight: 768, | ||
retries: { | ||
runMode: 3, | ||
openMode: 0, | ||
}, | ||
env: { | ||
OPENREFINE_URL: 'http://localhost:3333', | ||
DISABLE_PROJECT_CLEANUP: 0, | ||
}, | ||
e2e: { | ||
experimentalRunAllSpecs: true, | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
specPattern: './cypress/e2e/**/*.cy.{js,jsx,ts,tsx}', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
describe(__filename, function () { | ||
afterEach(() => { | ||
cy.addProjectForDeletion(); | ||
}); | ||
|
||
it('Test the create project from a Commons category', function () { | ||
cy.visitOpenRefine(); | ||
cy.navigateTo('Create project'); | ||
cy.get('#create-project-ui-source-selection-tabs > a') | ||
.contains('Wikimedia Commons') | ||
.click(); | ||
// enter a category name | ||
cy.get( | ||
'input.category-input-box' | ||
).type('Official OpenRefine logos'); | ||
cy.get( | ||
'.fbs-item-name' | ||
) | ||
.contains('Official OpenRefine logos') | ||
.click(); | ||
|
||
cy.get( | ||
'.create-project-ui-source-selection-tab-body.selected button.button-primary' | ||
) | ||
.contains('Next »') | ||
.click(); | ||
|
||
// then ensure we are on the preview page | ||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options'); | ||
|
||
// preview and click next | ||
cy.get('button[bind="createProjectButton"]') | ||
.contains('Create Project »') | ||
.click(); | ||
cy.waitForProjectTable(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
const fixtures = { | ||
}; | ||
|
||
export default fixtures; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// / <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
return config; | ||
}; |
Oops, something went wrong.