diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index cefa5e6cc..f1212e63f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -130,6 +130,11 @@ jobs: npm i -g yarn yarn install + - name: Lint with Prettier + run: | + cd ./main/tests/cypress + yarn check-lint + - name: Test with Cypress on ${{ matrix.browser }} run: | echo REFINE_MIN_MEMORY=1400M >> ./refine.ini diff --git a/main/tests/cypress/cypress/integration/project/grid/column/sort.spec.js b/main/tests/cypress/cypress/integration/project/grid/column/sort.spec.js index efdb65300..6f73488a2 100644 --- a/main/tests/cypress/cypress/integration/project/grid/column/sort.spec.js +++ b/main/tests/cypress/cypress/integration/project/grid/column/sort.spec.js @@ -13,9 +13,9 @@ describe(__filename, function () { 'BUTTER,WHIPPED,WITH SALT' ) cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT') - + cy.columnActionClick('Shrt_Desc', ['Sort', 'Reverse']) - + cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT') cy.getCell(1, 'Shrt_Desc').should( 'to.contain', @@ -33,7 +33,7 @@ describe(__filename, function () { it('Perform a number sort + Reverse + Remove', function () { cy.loadAndVisitProject('food.sort') - cy.castColumnTo('NDB_No','number') + cy.castColumnTo('NDB_No', 'number') cy.columnActionClick('NDB_No', ['Sort']) cy.waitForDialogPanel() @@ -54,7 +54,7 @@ describe(__filename, function () { it('Perform a date sort + Reverse + Remove', function () { cy.loadAndVisitProject('food.sort') - cy.castColumnTo('Date','date') + cy.castColumnTo('Date', 'date') cy.columnActionClick('Date', ['Sort']) cy.waitForDialogPanel() @@ -65,7 +65,7 @@ describe(__filename, function () { // ensure sorting is active cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z') cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z') - + cy.columnActionClick('Date', ['Sort', 'Reverse']) cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z') @@ -74,7 +74,6 @@ describe(__filename, function () { cy.columnActionClick('Date', ['Sort', 'Remove sort']) cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z') cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z') - }) it('Perform a bool sort + Reverse + Remove', function () { cy.loadAndVisitProject('food.sort') diff --git a/main/tests/cypress/cypress/integration/project/grid/viewpanel-header/sort.spec.js b/main/tests/cypress/cypress/integration/project/grid/viewpanel-header/sort.spec.js index ecfeff8de..68ba18296 100644 --- a/main/tests/cypress/cypress/integration/project/grid/viewpanel-header/sort.spec.js +++ b/main/tests/cypress/cypress/integration/project/grid/viewpanel-header/sort.spec.js @@ -31,7 +31,7 @@ describe(__filename, function () { it('Ensure it reverses and reorders number sort', function () { cy.loadAndVisitProject('food.sort') - cy.castColumnTo('NDB_No','number') + cy.castColumnTo('NDB_No', 'number') cy.columnActionClick('NDB_No', ['Sort']) cy.waitForDialogPanel() @@ -56,7 +56,7 @@ describe(__filename, function () { it('Ensure it reverses and reorders date sort', function () { cy.loadAndVisitProject('food.sort') - cy.castColumnTo('Date','date') + cy.castColumnTo('Date', 'date') cy.columnActionClick('Date', ['Sort']) cy.waitForDialogPanel() diff --git a/main/tests/cypress/cypress/support/openrefine_api.js b/main/tests/cypress/cypress/support/openrefine_api.js index b762291b6..ffd587ff4 100644 --- a/main/tests/cypress/cypress/support/openrefine_api.js +++ b/main/tests/cypress/cypress/support/openrefine_api.js @@ -69,7 +69,24 @@ Cypress.Commands.add('loadProject', (fixture, projectName, tagName) => { // the following code can be used to inject tags in created projects // It's conflicting though, breaking up the CSV files // It is a hack to parse out CSV files in the openrefine while creating a project with tags - const options = {"encoding":"US-ASCII","separator":",","ignoreLines":-1,"headerLines":1,"skipDataLines":0,"limit":-1,"storeBlankRows":true,"guessCellValueTypes":false,"processQuotes":true,"quoteCharacter":"\"","storeBlankCellsAsNulls":true,"includeFileSources":false,"includeArchiveFileName":false,"trimStrings":false,"projectName":openRefineProjectName,"projectTags": [tagName]} + const options = { + encoding: 'US-ASCII', + separator: ',', + ignoreLines: -1, + headerLines: 1, + skipDataLines: 0, + limit: -1, + storeBlankRows: true, + guessCellValueTypes: false, + processQuotes: true, + quoteCharacter: '"', + storeBlankCellsAsNulls: true, + includeFileSources: false, + includeArchiveFileName: false, + trimStrings: false, + projectName: openRefineProjectName, + projectTags: [tagName], + } var postData if (tagName == undefined) { postData = diff --git a/main/tests/cypress/package.json b/main/tests/cypress/package.json index 8364d646a..45eeaf67a 100644 --- a/main/tests/cypress/package.json +++ b/main/tests/cypress/package.json @@ -5,6 +5,11 @@ "license": "BSD-3-Clause", "author": "OpenRefine", "private": true, + "scripts": { + "test": "cypress run --browser electron --headless --quiet", + "lint": "prettier --write .", + "check-lint": "prettier --check ." + }, "dependencies": { "cypress": "6.2.1", "cypress-file-upload": "^5.0.2",