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 Dashboard Service #3683

Merged
merged 15 commits into from
Apr 9, 2019
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
COMPOSE_FILE: .circleci/docker-compose.cypress.yml
COMPOSE_PROJECT_NAME: cypress
PERCY_TOKEN_ENCODED: ZGRiY2ZmZDQ0OTdjMzM5ZWE0ZGQzNTZiOWNkMDRjOTk4Zjg0ZjMxMWRmMDZiM2RjOTYxNDZhOGExMjI4ZDE3MA==
CYPRESS_PROJECT_ID_ENCODED: OTI0Y2th
CYPRESS_RECORD_KEY_ENCODED: YzA1OTIxMTUtYTA1Yy00NzQ2LWEyMDMtZmZjMDgwZGI2ODgx
docker:
- image: circleci/node:8
steps:
Expand Down
2 changes: 2 additions & 0 deletions .circleci/docker-compose.cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ services:
PERCY_BRANCH: ${CIRCLE_BRANCH}
PERCY_COMMIT: ${CIRCLE_SHA1}
PERCY_PULL_REQUEST: ${CIRCLE_PR_NUMBER}
CYPRESS_PROJECT_ID: ${CYPRESS_PROJECT_ID}
CYPRESS_RECORD_KEY: ${CYPRESS_RECORD_KEY}
redis:
image: redis:3.0-alpine
restart: unless-stopped
Expand Down
26 changes: 20 additions & 6 deletions client/cypress/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,27 @@ function stopServer() {
}

function runCypressCI() {
const { PERCY_TOKEN_ENCODED, CIRCLE_REPOSITORY_URL } = process.env;
const {
PERCY_TOKEN_ENCODED,
CYPRESS_PROJECT_ID_ENCODED,
CYPRESS_RECORD_KEY_ENCODED,
CIRCLE_REPOSITORY_URL,
} = process.env;

if (PERCY_TOKEN_ENCODED && CIRCLE_REPOSITORY_URL && CIRCLE_REPOSITORY_URL.includes('getredash/redash')) {
process.env.PERCY_TOKEN = atob(`${PERCY_TOKEN_ENCODED}`);
if (CIRCLE_REPOSITORY_URL && CIRCLE_REPOSITORY_URL.includes('getredash/redash')) {
if (PERCY_TOKEN_ENCODED) {
process.env.PERCY_TOKEN = atob(`${PERCY_TOKEN_ENCODED}`);
}
if (CYPRESS_PROJECT_ID_ENCODED) {
process.env.CYPRESS_PROJECT_ID = atob(`${CYPRESS_PROJECT_ID_ENCODED}`);
}
if (CYPRESS_RECORD_KEY_ENCODED) {
process.env.CYPRESS_RECORD_KEY = atob(`${CYPRESS_RECORD_KEY_ENCODED}`);
}
}

execSync(
'docker-compose run cypress ./node_modules/.bin/percy exec -- ./node_modules/.bin/cypress run --browser chrome',
'docker-compose run cypress ./node_modules/.bin/percy exec -- ./node_modules/.bin/cypress run --record',
{ stdio: 'inherit' },
);
}
Expand All @@ -54,7 +68,7 @@ switch (command) {
seedDatabase(seedData);
break;
case 'run':
execSync('cypress run --browser chrome', { stdio: 'inherit' });
execSync('cypress run', { stdio: 'inherit' });
break;
case 'open':
execSync('cypress open', { stdio: 'inherit' });
Expand All @@ -68,7 +82,7 @@ switch (command) {
case 'all':
startServer();
seedDatabase(seedData);
execSync('cypress run --browser chrome', { stdio: 'inherit' });
execSync('cypress run', { stdio: 'inherit' });
stopServer();
break;
default:
Expand Down
3 changes: 2 additions & 1 deletion client/cypress/integration/query/create_query_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ describe('Create Query', () => {
cy.visit('/queries/new');
});

it('executes the query', () => {
// https://github.com/getredash/redash/issues/3688
it.skip('executes the query', () => {
cy.getByTestId('SelectDataSource')
.click()
.contains('Test PostgreSQL').click();
Expand Down
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"baseUrl": "http://localhost:5000",
"video": false,
"video": true,
"videoUploadOnPasses": false,
"fixturesFolder": "client/cypress/fixtures",
"integrationFolder": "client/cypress/integration",
"pluginsFile": "client/cypress/plugins/index.js",
Expand Down