mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
Run prettier on cypress folder (#4510)
* Run prettier on cypress folder
* Test Restyled
* Revert "Test Restyled"
This reverts commit 13d43968fe.
This commit is contained in:
committed by
Arik Fraimovich
parent
329e85987c
commit
29582e3212
@@ -1,18 +1,18 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies, no-console */
|
||||
const atob = require('atob');
|
||||
const { execSync } = require('child_process');
|
||||
const { post } = require('request').defaults({ jar: true });
|
||||
const { seedData } = require('./seed-data');
|
||||
const atob = require("atob");
|
||||
const { execSync } = require("child_process");
|
||||
const { post } = require("request").defaults({ jar: true });
|
||||
const { seedData } = require("./seed-data");
|
||||
|
||||
const baseUrl = process.env.CYPRESS_baseUrl || 'http://localhost:5000';
|
||||
const baseUrl = process.env.CYPRESS_baseUrl || "http://localhost:5000";
|
||||
|
||||
function seedDatabase(seedValues) {
|
||||
const request = seedValues.shift();
|
||||
const data = request.type === 'form' ? { formData: request.data } : { json: request.data };
|
||||
const data = request.type === "form" ? { formData: request.data } : { json: request.data };
|
||||
|
||||
post(baseUrl + request.route, data, (err, response) => {
|
||||
const result = response ? response.statusCode : err;
|
||||
console.log('POST ' + request.route + ' - ' + result);
|
||||
console.log("POST " + request.route + " - " + result);
|
||||
if (seedValues.length) {
|
||||
seedDatabase(seedValues);
|
||||
}
|
||||
@@ -20,16 +20,16 @@ function seedDatabase(seedValues) {
|
||||
}
|
||||
|
||||
function startServer() {
|
||||
console.log('Starting the server...');
|
||||
console.log("Starting the server...");
|
||||
|
||||
execSync('docker-compose -p cypress build --build-arg skip_ds_deps=true', { stdio: 'inherit' });
|
||||
execSync('docker-compose -p cypress up -d', { stdio: 'inherit' });
|
||||
execSync('docker-compose -p cypress run server create_db', { stdio: 'inherit' });
|
||||
execSync("docker-compose -p cypress build --build-arg skip_ds_deps=true", { stdio: "inherit" });
|
||||
execSync("docker-compose -p cypress up -d", { stdio: "inherit" });
|
||||
execSync("docker-compose -p cypress run server create_db", { stdio: "inherit" });
|
||||
}
|
||||
|
||||
function stopServer() {
|
||||
console.log('Stopping the server...');
|
||||
execSync('docker-compose -p cypress down', { stdio: 'inherit' });
|
||||
console.log("Stopping the server...");
|
||||
execSync("docker-compose -p cypress down", { stdio: "inherit" });
|
||||
}
|
||||
|
||||
function runCypressCI() {
|
||||
@@ -40,7 +40,7 @@ function runCypressCI() {
|
||||
CIRCLE_REPOSITORY_URL,
|
||||
} = process.env;
|
||||
|
||||
if (CIRCLE_REPOSITORY_URL && CIRCLE_REPOSITORY_URL.includes('getredash/redash')) {
|
||||
if (CIRCLE_REPOSITORY_URL && CIRCLE_REPOSITORY_URL.includes("getredash/redash")) {
|
||||
if (PERCY_TOKEN_ENCODED) {
|
||||
process.env.PERCY_TOKEN = atob(`${PERCY_TOKEN_ENCODED}`);
|
||||
}
|
||||
@@ -53,39 +53,39 @@ function runCypressCI() {
|
||||
}
|
||||
|
||||
execSync(
|
||||
'docker-compose run cypress ./node_modules/.bin/percy exec -t 300 -- ./node_modules/.bin/cypress run --record',
|
||||
{ stdio: 'inherit' },
|
||||
"docker-compose run cypress ./node_modules/.bin/percy exec -t 300 -- ./node_modules/.bin/cypress run --record",
|
||||
{ stdio: "inherit" }
|
||||
);
|
||||
}
|
||||
|
||||
const command = process.argv[2] || 'all';
|
||||
const command = process.argv[2] || "all";
|
||||
|
||||
switch (command) {
|
||||
case 'start':
|
||||
case "start":
|
||||
startServer();
|
||||
break;
|
||||
case 'db-seed':
|
||||
case "db-seed":
|
||||
seedDatabase(seedData);
|
||||
break;
|
||||
case 'run':
|
||||
execSync('cypress run', { stdio: 'inherit' });
|
||||
case "run":
|
||||
execSync("cypress run", { stdio: "inherit" });
|
||||
break;
|
||||
case 'open':
|
||||
execSync('cypress open', { stdio: 'inherit' });
|
||||
case "open":
|
||||
execSync("cypress open", { stdio: "inherit" });
|
||||
break;
|
||||
case 'run-ci':
|
||||
case "run-ci":
|
||||
runCypressCI();
|
||||
break;
|
||||
case 'stop':
|
||||
case "stop":
|
||||
stopServer();
|
||||
break;
|
||||
case 'all':
|
||||
case "all":
|
||||
startServer();
|
||||
seedDatabase(seedData);
|
||||
execSync('cypress run', { stdio: 'inherit' });
|
||||
execSync("cypress run", { stdio: "inherit" });
|
||||
stopServer();
|
||||
break;
|
||||
default:
|
||||
console.log('Usage: npm run cypress [start|db-seed|open|run|stop]');
|
||||
console.log("Usage: npm run cypress [start|db-seed|open|run|stop]");
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user