Skip to content

Commit 73e5384

Browse files
authored
Merge pull request #2 from Visual-Regression-Tracker/9-testVariations
9 test variations
2 parents ee3b804 + 6a3bd11 commit 73e5384

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1476
-298
lines changed

.vscode/launch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
8-
97
{
108
"type": "node",
119
"request": "attach",
12-
"name": "Attach by Process ID",
10+
"name": "Attach NestJS WS",
1311
"port": 9229,
14-
"processId": "${command:PickProcess}"
15-
},
12+
"restart": true,
13+
"stopOnEntry": false,
14+
"protocol": "inspector"
15+
}
1616
]
1717
}

package-lock.json

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test:cov": "jest --coverage",
2020
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
2121
"test:e2e": "jest --config ./test/jest-e2e.json",
22-
"docker:build_api": "docker build -t visualregressiontracker/api:$npm_package_version -f ./Dockerfile . && docker push visualregressiontracker/api:$npm_package_version",
22+
"docker:build_api": "npm run test && npm run test:e2e && docker build -t visualregressiontracker/api:$npm_package_version -f ./Dockerfile . && docker push visualregressiontracker/api:$npm_package_version",
2323
"docker:build_migration": "docker build -t visualregressiontracker/migration:0.0.2 -f ./prisma/Dockerfile ./prisma"
2424
},
2525
"dependencies": {
@@ -53,6 +53,7 @@
5353
"@nestjs/schematics": "^7.0.0",
5454
"@nestjs/testing": "^7.0.0",
5555
"@prisma/cli": "^2.0.0-beta.5",
56+
"@types/bcryptjs": "^2.4.2",
5657
"@types/express": "^4.17.3",
5758
"@types/jest": "25.1.4",
5859
"@types/node": "^13.9.1",
@@ -61,6 +62,7 @@
6162
"@types/pixelmatch": "^5.1.0",
6263
"@types/pngjs": "^3.4.2",
6364
"@types/supertest": "^2.0.8",
65+
"@types/uuid-apikey": "^1.4.0",
6466
"@typescript-eslint/eslint-plugin": "^2.23.0",
6567
"@typescript-eslint/parser": "^2.23.0",
6668
"eslint": "^6.8.0",
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Migration `20200524162125-baseline-history`
2+
3+
This migration has been generated by Pavel Strunkin at 5/24/2020, 4:21:25 PM.
4+
You can check out the [state of the schema](./schema.prisma) after the migration.
5+
6+
## Database Steps
7+
8+
```sql
9+
CREATE TABLE "public"."Baseline" (
10+
"baselineName" text NOT NULL ,"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"testRunId" text ,"testVariationId" text NOT NULL ,"updatedAt" timestamp(3) NOT NULL ,
11+
PRIMARY KEY ("id"))
12+
13+
ALTER TABLE "public"."TestRun" ADD COLUMN "baselineName" text ,
14+
ADD COLUMN "browser" text ,
15+
ADD COLUMN "device" text ,
16+
ADD COLUMN "ignoreAreas" text NOT NULL DEFAULT '[]',
17+
ADD COLUMN "name" text NOT NULL DEFAULT '',
18+
ADD COLUMN "os" text ,
19+
ADD COLUMN "viewport" text ;
20+
21+
CREATE UNIQUE INDEX "Baseline_testRunId" ON "public"."Baseline"("testRunId")
22+
23+
ALTER TABLE "public"."Baseline" ADD FOREIGN KEY ("testVariationId")REFERENCES "public"."TestVariation"("id") ON DELETE CASCADE ON UPDATE CASCADE
24+
25+
ALTER TABLE "public"."Baseline" ADD FOREIGN KEY ("testRunId")REFERENCES "public"."TestRun"("id") ON DELETE SET NULL ON UPDATE CASCADE
26+
```
27+
28+
## Changes
29+
30+
```diff
31+
diff --git schema.prisma schema.prisma
32+
migration 20200503001556-init..20200524162125-baseline-history
33+
--- datamodel.dml
34+
+++ datamodel.dml
35+
@@ -3,9 +3,9 @@
36+
}
37+
datasource db {
38+
provider = "postgresql"
39+
- url = "***"
40+
+ url = env("DATABASE_URL")
41+
}
42+
model Build {
43+
id String @default(uuid()) @id
44+
@@ -14,12 +14,12 @@
45+
status String?
46+
testRuns TestRun[]
47+
projectId String
48+
project Project @relation(fields: [projectId], references: [id])
49+
- // userId String
50+
- // user User @relation(fields: [userId], references: [id])
51+
updatedAt DateTime @updatedAt
52+
createdAt DateTime @default(now())
53+
+ user User? @relation(fields: [userId], references: [id])
54+
+ userId String?
55+
}
56+
model Project {
57+
id String @default(uuid()) @id
58+
@@ -43,26 +43,48 @@
59+
testVariationId String
60+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
61+
updatedAt DateTime @updatedAt
62+
createdAt DateTime @default(now())
63+
+ // Test variation data
64+
+ name String @default("")
65+
+ browser String?
66+
+ device String?
67+
+ os String?
68+
+ viewport String?
69+
+ baselineName String?
70+
+ ignoreAreas String @default("[]")
71+
+ // Baseline
72+
+ baseline Baseline?
73+
}
74+
model TestVariation {
75+
- id String @default(uuid()) @id
76+
+ id String @default(uuid()) @id
77+
name String
78+
browser String?
79+
device String?
80+
os String?
81+
viewport String?
82+
baselineName String?
83+
- ignoreAreas String @default("[]")
84+
+ ignoreAreas String @default("[]")
85+
projectId String
86+
- project Project @relation(fields: [projectId], references: [id])
87+
+ project Project @relation(fields: [projectId], references: [id])
88+
testRuns TestRun[]
89+
- updatedAt DateTime @updatedAt
90+
- createdAt DateTime @default(now())
91+
+ baselines Baseline[]
92+
+ updatedAt DateTime @updatedAt
93+
+ createdAt DateTime @default(now())
94+
}
95+
+model Baseline {
96+
+ id String @default(uuid()) @id
97+
+ baselineName String
98+
+ testVariationId String
99+
+ testVariation TestVariation @relation(fields: [testVariationId], references: [id])
100+
+ testRunId String?
101+
+ testRun TestRun? @relation(fields: [testRunId], references: [id])
102+
+ updatedAt DateTime @updatedAt
103+
+ createdAt DateTime @default(now())
104+
+}
105+
+
106+
model User {
107+
id String @default(uuid()) @id
108+
email String @unique
109+
password String
110+
```
111+
112+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
5+
datasource db {
6+
provider = "postgresql"
7+
url = "***"
8+
}
9+
10+
model Build {
11+
id String @default(uuid()) @id
12+
number Int?
13+
branchName String?
14+
status String?
15+
testRuns TestRun[]
16+
projectId String
17+
project Project @relation(fields: [projectId], references: [id])
18+
updatedAt DateTime @updatedAt
19+
createdAt DateTime @default(now())
20+
user User? @relation(fields: [userId], references: [id])
21+
userId String?
22+
}
23+
24+
model Project {
25+
id String @default(uuid()) @id
26+
name String
27+
builds Build[]
28+
testVariations TestVariation[]
29+
updatedAt DateTime @updatedAt
30+
createdAt DateTime @default(now())
31+
}
32+
33+
model TestRun {
34+
id String @default(uuid()) @id
35+
imageName String
36+
diffName String?
37+
diffPercent Float?
38+
diffTollerancePercent Float @default(1.0)
39+
pixelMisMatchCount Int?
40+
status TestStatus
41+
buildId String
42+
build Build @relation(fields: [buildId], references: [id])
43+
testVariationId String
44+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
45+
updatedAt DateTime @updatedAt
46+
createdAt DateTime @default(now())
47+
// Test variation data
48+
name String @default("")
49+
browser String?
50+
device String?
51+
os String?
52+
viewport String?
53+
baselineName String?
54+
ignoreAreas String @default("[]")
55+
// Baseline
56+
baseline Baseline?
57+
}
58+
59+
model TestVariation {
60+
id String @default(uuid()) @id
61+
name String
62+
browser String?
63+
device String?
64+
os String?
65+
viewport String?
66+
baselineName String?
67+
ignoreAreas String @default("[]")
68+
projectId String
69+
project Project @relation(fields: [projectId], references: [id])
70+
testRuns TestRun[]
71+
baselines Baseline[]
72+
updatedAt DateTime @updatedAt
73+
createdAt DateTime @default(now())
74+
}
75+
76+
model Baseline {
77+
id String @default(uuid()) @id
78+
baselineName String
79+
testVariationId String
80+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
81+
testRunId String?
82+
testRun TestRun? @relation(fields: [testRunId], references: [id])
83+
updatedAt DateTime @updatedAt
84+
createdAt DateTime @default(now())
85+
}
86+
87+
model User {
88+
id String @default(uuid()) @id
89+
email String @unique
90+
password String
91+
firstName String?
92+
lastName String?
93+
apiKey String @unique
94+
isActive Boolean @default(true)
95+
builds Build[]
96+
updatedAt DateTime @updatedAt
97+
createdAt DateTime @default(now())
98+
}
99+
100+
enum TestStatus {
101+
failed
102+
new
103+
ok
104+
unresolved
105+
}

0 commit comments

Comments
 (0)