Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress eslint fixes and config #3636

Merged
merged 10 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build/*.js
config/*.js
node_modules
client/dist
6 changes: 5 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
extends: ["airbnb", "plugin:jest/recommended"],
plugins: ["jest", "cypress"],
plugins: ["jest", "cypress", "chai-friendly"],
settings: {
"import/resolver": "webpack"
},
Expand Down Expand Up @@ -56,5 +56,9 @@ module.exports = {
}],
"no-else-return": ["error", {"allowElseIf": true}],
"object-curly-newline": ["error", {"consistent": true}],
// needed for cypress tests
"func-names": "off",
"no-unused-expressions": 0,
"chai-friendly/no-unused-expressions": 2
}
};
1 change: 1 addition & 0 deletions client/app/components/dashboards/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const WidgetDialog = {
},
};


const EditTextBoxComponent = {
template: editTextBoxTemplate,
bindings: {
Expand Down
4 changes: 3 additions & 1 deletion client/cypress/integration/dashboard/dashboard_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function addQueryByAPI(data, shouldPublish = true) {
schedule: null,
}, data);

// eslint-disable-next-line cypress/no-assigning-return-values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cypress/recommended seemed nice 😕. As we can't use it, should those cypress eslint-disable be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's cause the cypress package isn't a required installation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be 🤔

const request = cy.request('POST', '/api/queries', merged);
if (shouldPublish) {
request.then(({ body }) => cy.request('POST', `/api/queries/${body.id}`, { is_draft: false }));
Expand Down Expand Up @@ -106,7 +107,7 @@ describe('Dashboard', () => {
});
});

it('archives dashboard', function () {
it('archives dashboard', () => {
createNewDashboardByAPI('Foo Bar').then(({ slug }) => {
cy.visit(`/dashboard/${slug}`);

Expand Down Expand Up @@ -176,6 +177,7 @@ describe('Dashboard', () => {
});
});

// eslint-disable-next-line jest/no-disabled-tests
it.skip('allows opening menu after removal', function () {
let elTestId1;
addTextboxByAPI('txb 1', this.dashboardId)
Expand Down
22 changes: 11 additions & 11 deletions client/cypress/integration/query/search_query_spec.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
describe("Search Query", () => {
describe('Search Query', () => {
beforeEach(() => {
cy.login();

cy.request("POST", "api/queries", {
name: "Users Count",
cy.request('POST', 'api/queries', {
name: 'Users Count',
data_source_id: 1,
query: "SELECT 1"
query: 'SELECT 1',
});

cy.request("POST", "api/queries", {
name: "Dashboards Count",
cy.request('POST', 'api/queries', {
name: 'Dashboards Count',
data_source_id: 1,
query: "SELECT 1"
query: 'SELECT 1',
});

cy.visit("/");
cy.visit('/');
});

it("finds queries by name", () => {
cy.getByTestId("AppHeaderSearch").type("Users{enter}");
cy.contains("Users Count");
it('finds queries by name', () => {
cy.getByTestId('AppHeaderSearch').type('Users{enter}');
cy.contains('Users Count');
});
});
2 changes: 1 addition & 1 deletion client/cypress/integration/user/login_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Login', () => {
it('greets the user and take a screenshot', () => {
cy.contains('h3', 'Login to Redash');

cy.wait(1000);
cy.wait(1000); // eslint-disable-line cypress/no-unnecessary-waiting
cy.percySnapshot('Login');
});

Expand Down
2 changes: 1 addition & 1 deletion client/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@percy/cypress'; // eslint-disable-line import/no-extraneous-dependencies
import '@percy/cypress'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved

Cypress.Commands.add('login', (email = 'admin@redash.io', password = 'password') => cy.request({
url: '/login',
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"watch": "webpack --watch --progress --colors -d",
"analyze": "npm run clean && BUNDLE_ANALYZER=on webpack",
"analyze:build": "npm run clean && NODE_ENV=production BUNDLE_ANALYZER=on webpack",
"lint": "npm run lint:base -- --ext .js --ext .jsx ./client/app",
"lint:base": "eslint --config ./client/.eslintrc.js",
"lint": "npm run lint:base -- --ext .js --ext .jsx ./client",
"lint:base": "eslint --config ./client/.eslintrc.js --ignore-path ./client/.eslintignore",
"test": "TZ=Africa/Khartoum jest",
"test:watch": "jest --watch",
"cypress:install": "npm install --no-save cypress@^3.1.5 @percy/cypress@^0.2.3 atob@2.1.2",
Expand Down Expand Up @@ -102,6 +102,7 @@
"eslint-config-airbnb": "^17.1.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-loader": "^2.1.1",
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-cypress": "^2.0.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.2.2",
Expand Down Expand Up @@ -159,7 +160,6 @@
"npm run lint:base",
"npm run test -- --bail --findRelatedTests"
]
},
"ignore": ["client/dist/*"]
}
}
}