Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const Assert = require('chai').assert;
const request = require('../support/request');
const { Before, Given, Then } = require('cucumber');
const TIMEOUT = 240 * 1000;
Before('@events', function hook() {
this.repoName = 'functional-events';
// Reset shared information
this.pipelineId = null;
this.eventId = null;
this.jwt = null;
});
Given(/^an existing pipeline with the workflow:$/, { timeout: TIMEOUT }, function step(table) {
return this.ensurePipelineExists({ repoName: this.repoName })
.then(() => table);
});
Given(/^"calvin" has admin permission to the pipeline$/, () => null);
Then(/^an event is created$/, { timeout: TIMEOUT }, function step() {
'use strict';
const Assert = require('chai').assert;
const request = require('../support/request');
const { Before, Given, When, Then } = require('cucumber');
const TIMEOUT = 240 * 1000;
Before({
tags: '@sd-cmd'
}, function hook() {
this.repoOrg = this.testOrg;
this.repoName = 'functional-commands';
this.pipelineId = null;
this.configPipelineId = null;
this.buildPipelineIds = {};
this.jwt = null;
this.image = null;
this.command = null;
this.commandNamespace = 'screwdriver-cd-test';
return request({ // TODO : perform this in the before-hook for all func tests
method: 'GET',
url: `${this.instance}/${this.namespace}/auth/token?api_token=${this.apiToken}`,
followAllRedirects: true,
'use strict';
const Assert = require('chai').assert;
const request = require('../support/request');
const jwt = require('jsonwebtoken');
const TIMEOUT = 240 * 1000;
const { Before, Given, Then } = require('cucumber');
Before('@auth', function hook() {
this.repoOrg = this.testOrg;
this.repoName = 'functional-auth';
this.pipelineId = null;
});
Given(/^an existing repository with these users and permissions:$/, table => table);
Given(/^an existing pipeline with that repository$/, () => null);
Given(/^"([^"]*)" is logged in$/, { timeout: TIMEOUT }, function step(user) {
if (!(this.apiToken)) {
throw new Error('insufficient set up, missing access key');
}
return this.getJwt(this.apiToken).then((response) => {
const accessToken = response.body.token;
'use strict';
const Assert = require('chai').assert;
const request = require('../support/request');
const sdapi = require('../support/sdapi');
const { Before, Given, Then } = require('cucumber');
const TIMEOUT = 240 * 1000;
Before({
tags: '@metadata'
}, function hook() {
this.repoOrg = this.testOrg;
this.repoName = 'functional-metadata';
this.pipelineId = null;
this.eventId = null;
this.meta = null;
this.jwt = null;
});
Given(/^a metadata starts with an empty object$/, { timeout: TIMEOUT }, () => null);
Then(/^the "(BAR|BAZ)" job is started$/, { timeout: TIMEOUT }, function step(jobName) {
switch (jobName) {
case 'BAR':
this.jobName = 'second';
'use strict';
const Assert = require('chai').assert;
const github = require('../support/github');
const sdapi = require('../support/sdapi');
const { Before, Given, When, Then } = require('cucumber');
const TIMEOUT = 240 * 1000;
const WAIT_TIME = 3;
Before({
tags: '@workflow'
}, function hook() {
this.repoOrg = this.testOrg;
this.repoName = 'functional-workflow';
this.pipelineId = null;
this.builds = null;
});
Given(/^an existing pipeline on "(.*)" branch with the workflow jobs:$/, {
timeout: TIMEOUT
}, function step(branch, table) {
return this.getJwt(this.apiToken)
.then((response) => {
this.jwt = response.body.token;
return github.createBranch(branch, this.repoOrg, this.repoName);