Skip to content

Commit 2d717e6

Browse files
authored
UI Automation for Files Extension (#15)
* UI Automation for Files Extension UI Automation for Files Extension * UI Automation - adding missed file * Updated UI test added validation Updated UI test added validation * Updated automation script to work off master branch
1 parent 3992204 commit 2d717e6

File tree

16 files changed

+3350
-28
lines changed

16 files changed

+3350
-28
lines changed

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [openrefine]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: ['https://donorbox.org/open-refine']

.github/workflows/ci.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
release:
12+
types: [created]
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up JDK 11
22+
uses: actions/setup-java@v2
23+
with:
24+
java-version: '11'
25+
distribution: 'temurin'
26+
cache: maven
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Restore dependency cache
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
cypress/openrefine-*.tar.gz
38+
**/node_modules
39+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
40+
41+
- name: Build with Maven
42+
run: mvn -B package
43+
44+
- name: Install Cypress
45+
run: |
46+
cd ./cypress
47+
npm i -g yarn
48+
yarn install
49+
50+
- name: Run Cypress tests
51+
run: ./cypress/run_headless.sh
52+
53+
- name: Get release upload URL
54+
id: get_release_upload_url
55+
if: github.event_name == 'release'
56+
uses: bruceadams/[email protected]
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
60+
- name: Upload release asset
61+
id: upload-release-asset
62+
if: github.event_name == 'release'
63+
uses: shogo82148/[email protected]
64+
with:
65+
upload_url: ${{ steps.get_release_upload_url.outputs.upload_url }}
66+
asset_path: ./target/openrefine-files-extension-${{ env.VERSION_STRING }}.zip
67+
asset_name: openrefine-files-extension-${{ env.VERSION_STRING }}.zip
68+
asset_content_type: application/zip
69+

cypress/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.yarn/
3+
.yarnrc.yml
4+
openrefine*

cypress/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Files extension E2E tests
2+
3+
Inspired from [OpenRefine's own Cypress test suite](https://openrefine.org/docs/technical-reference/functional-tests)
4+
5+
Install the dependencies with `yarn install`.
6+
7+
Run the test suite with `yarn run cypress open`.
8+
9+
This requires a running instance of OpenRefine with the FilesExtension installed at `http://localhost:3333/`.

cypress/cypress.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
keystrokeDelay: 0,
5+
viewportWidth: 1280,
6+
viewportHeight: 768,
7+
retries: {
8+
runMode: 3,
9+
openMode: 0,
10+
},
11+
env: {
12+
OPENREFINE_URL: 'http://localhost:3333',
13+
DISABLE_PROJECT_CLEANUP: 0,
14+
},
15+
e2e: {
16+
experimentalRunAllSpecs: true,
17+
// We've imported your old cypress plugins here.
18+
// You may want to clean this up later by importing these.
19+
setupNodeEvents(on, config) {
20+
return require('./cypress/plugins/index.js')(on, config)
21+
},
22+
specPattern: './cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
23+
},
24+
})
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
describe(__filename, function () {
2+
afterEach(() => {
3+
cy.addProjectForDeletion();
4+
});
5+
6+
it('Test the create project using Files Extension', function () {
7+
cy.visitOpenRefine();
8+
cy.navigateTo('Create project');
9+
cy.get('#create-project-ui-source-selection-tabs > a')
10+
.contains('Files from local directory')
11+
.click();
12+
// enter a category name
13+
cy.get('#drive-selector'
14+
).select('/home');
15+
16+
17+
// Wait for the directory tree container to become visible
18+
cy.get('#directory-tree-container', { timeout: 10000 }) // Adjust timeout as needed
19+
.should('be.visible'); // Ensures the element is visible
20+
21+
// Interact with the "Home" option in the tree
22+
cy.get('#directory-tree').contains('home').click(); // Replace 'Home' with exact text if needed
23+
24+
25+
cy.get(
26+
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
27+
)
28+
.contains('Next')
29+
.click();
30+
31+
// then ensure we are on the preview page
32+
cy.get('.create-project-ui-panel').contains('Project name');
33+
34+
// preview and click next
35+
cy.get('button[bind="createProjectButton"]')
36+
.contains('Create Project »')
37+
.click();
38+
cy.waitForProjectTable();
39+
40+
cy.get('button[id="project-name-button"]')
41+
.should('have.text', 'folder-details_home');
42+
43+
});
44+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
const fixtures = {
3+
};
4+
5+
export default fixtures;

cypress/cypress/plugins/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// / <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
/**
15+
* @type {Cypress.PluginConfig}
16+
*/
17+
18+
module.exports = (on, config) => {
19+
// `on` is used to hook into various events Cypress emits
20+
// `config` is the resolved Cypress config
21+
return config;
22+
};

0 commit comments

Comments
 (0)