itemengine-cypress-automation 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,6 +1,6 @@
1
1
  // currents.config.js
2
2
  module.exports = {
3
- projectId: "yyy", // the projectId, can be any values for sorry-cypress users
4
- recordKey: "xxx", // the record key, can be any value for sorry-cypress users
5
- cloudServiceUrl: "http://0.0.0.0:1234", // Sorry Cypress users - set the director service URL
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
+ };
@@ -7,7 +7,7 @@ describe('template spec 1', () => {
7
7
  cy.wait(10000)
8
8
  })
9
9
 
10
- it('passes', () => {
10
+ it('fails', () => {
11
11
  cy.wait(10000)
12
12
  expect(true).to.be.eq(false)
13
13
  })
@@ -9,7 +9,7 @@ describe('template spec 2', () => {
9
9
 
10
10
  it('passes', () => {
11
11
  cy.wait(10000)
12
- expect(true).to.be.eq(false)
12
+ expect(true).to.be.eq(true)
13
13
  })
14
14
 
15
15
  it('passes', () => {
@@ -7,7 +7,7 @@ describe('template spec 3', () => {
7
7
  cy.wait(10000)
8
8
  })
9
9
 
10
- it('passes', () => {
10
+ it('fails', () => {
11
11
  cy.wait(10000)
12
12
  expect(true).to.be.eq(false)
13
13
  })
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/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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,3 @@
1
+ #!/bin/sh
2
+
3
+ npm run spinnaker
@@ -0,0 +1,3 @@
1
+ import {runSorryCypressLocal} from "./sorry-cypress.mjs";
2
+
3
+ runSorryCypressLocal();
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ import {runSorryCypressSpinnaker} from "./sorry-cypress.mjs";
2
+
3
+ runSorryCypressSpinnaker();