itemengine-cypress-automation 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/DockerFile +21 -0
- package/currents.config.js +4 -4
- package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +1 -1
- package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +1 -1
- package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +1 -1
- package/cypress.config.js +2 -4
- package/deploy.yaml +21 -0
- package/package.json +3 -2
- package/run.sh +3 -0
- package/scripts/local.mjs +3 -0
- package/scripts/sorry-cypress.mjs +48 -0
- package/scripts/spinnaker.mjs +3 -0
package/DockerFile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#use Cypress base image from https://github.com/cypress-io/cypress-docker-images
|
2
|
+
FROM cypress/base:14.19.0
|
3
|
+
FROM cypress/browsers:node14.19.0-chrome100-ff99-edge
|
4
|
+
|
5
|
+
RUN node --version
|
6
|
+
RUN npm --version
|
7
|
+
|
8
|
+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
|
9
|
+
&& unzip awscliv2.zip \
|
10
|
+
&& ./aws/install
|
11
|
+
|
12
|
+
WORKDIR /ie-e2e
|
13
|
+
COPY . ./
|
14
|
+
|
15
|
+
#ENV CI=1
|
16
|
+
|
17
|
+
RUN chmod +x ./run.sh
|
18
|
+
|
19
|
+
RUN npm ci
|
20
|
+
|
21
|
+
RUN $(npm bin)/cypress verify
|
package/currents.config.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// currents.config.js
|
2
2
|
module.exports = {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
projectId: "ImagineLearning/itemengine-cypress-automation", // the projectId, can be any values for sorry-cypress users
|
4
|
+
recordKey: "ImagineLearning/itemengine-cypress-automation", // the record key, can be any value for sorry-cypress users
|
5
|
+
cloudServiceUrl: "https://cypress-director.imaginelearning.engineering/"//"http://0.0.0.0:1234", // Sorry Cypress users - set the director service URL
|
6
|
+
};
|
package/cypress.config.js
CHANGED
@@ -6,13 +6,11 @@ const { cloudPlugin } = require("cypress-cloud/plugin");
|
|
6
6
|
|
7
7
|
async function getConfigurationByFile(file, theme) {
|
8
8
|
const pathToConfigFile = path.resolve(
|
9
|
-
'
|
10
|
-
'ilc-next-gen-item-engine-ui-test-cypress/cypress/config-files',
|
9
|
+
'./cypress/config-files',
|
11
10
|
`${file}.json`
|
12
11
|
);
|
13
12
|
const pathToThemeFile = path.resolve(
|
14
|
-
'
|
15
|
-
'ilc-next-gen-item-engine-ui-test-cypress/cypress/fixtures/theme',
|
13
|
+
'./cypress/fixtures/theme',
|
16
14
|
`${theme}.json`
|
17
15
|
);
|
18
16
|
const envVariables = await fs.readJson(pathToConfigFile);
|
package/deploy.yaml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
global:
|
2
|
+
team: itemengine
|
3
|
+
name: itemengine-cypress-automation
|
4
|
+
type: integration_test
|
5
|
+
|
6
|
+
deployment:
|
7
|
+
job:
|
8
|
+
activeDeadlineSeconds: 7200
|
9
|
+
parallelism: 3
|
10
|
+
completions: 3
|
11
|
+
|
12
|
+
image:
|
13
|
+
cmd: /ie-e2e/run.sh
|
14
|
+
|
15
|
+
resources:
|
16
|
+
limits:
|
17
|
+
cpu: "2"
|
18
|
+
memory: 8096Mi
|
19
|
+
requests:
|
20
|
+
cpu: "2"
|
21
|
+
memory: 8096Mi
|
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "itemengine-cypress-automation",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"description": "",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
7
|
"build": "echo 'building'",
|
8
|
-
"test": "echo 'success'"
|
8
|
+
"test": "echo 'success'",
|
9
|
+
"spinnaker": "node scripts/spinnaker.mjs"
|
9
10
|
},
|
10
11
|
"repository": {
|
11
12
|
"type": "git",
|
package/run.sh
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
import {execSync} from "child_process";
|
2
|
+
import * as OS from "os";
|
3
|
+
// import "dotenv/config";
|
4
|
+
|
5
|
+
let ciBuildId;
|
6
|
+
let startTime;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @param {string} user
|
10
|
+
* @param {string} startTime
|
11
|
+
*/
|
12
|
+
function setCiBuildId(user, startTime) {
|
13
|
+
let env = 'staging'//process.env.CYPRESS_ENV;
|
14
|
+
let tagName = process.argv.slice(2).length > 0 ? process.argv.slice(2) : "--";
|
15
|
+
return `${user}[E2E][env:${env}][tags:${tagName}][${startTime}]`
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @method runSorryCypress
|
20
|
+
* @param {string} ciBuildId
|
21
|
+
*/
|
22
|
+
function runSorryCypress(ciBuildId) {
|
23
|
+
process.env.CYPRESS_grepTags = process.argv.slice(2) ?? "";
|
24
|
+
let command = `cypress-cloud run --parallel --browser chrome --record --key ImagineLearning/itemengine-cypress-automation --ci-build-id ${ciBuildId}`;
|
25
|
+
execSync(command, {stdio: "inherit"});
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @method runSorryCypressSpinnaker
|
30
|
+
*/
|
31
|
+
export function runSorryCypressSpinnaker() {
|
32
|
+
//startTime = process.env.START_TIME;
|
33
|
+
//ciBuildId = setCiBuildId("spinnaker", startTime);
|
34
|
+
startTime = Math.round(Date.now() / 100000);
|
35
|
+
console.log(startTime)
|
36
|
+
runSorryCypress(startTime);
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @method runSorryCypressLocal
|
41
|
+
*/
|
42
|
+
export function runSorryCypressLocal() {
|
43
|
+
process.env.CYPRESS_API_URL = "https://cypress-director.imaginelearning.engineering/";
|
44
|
+
const user = OS.userInfo().username;
|
45
|
+
startTime = Math.round(Date.now() / 1000);
|
46
|
+
ciBuildId = setCiBuildId(user, startTime);
|
47
|
+
runSorryCypress(ciBuildId);
|
48
|
+
}
|