Skip to content

Commit e60f25d

Browse files
authored
215 project config (#127)
* Project config via frontend closes Visual-Regression-Tracker/Visual-Regression-Tracker#215
1 parent 252995c commit e60f25d

28 files changed

+1064
-378
lines changed

.env

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ POSTGRES_DB=vrt_db_dev
1515
# optional
1616
#HTTPS_KEY_PATH='./secrets/ssl.key'
1717
#HTTPS_CERT_PATH='./secrets/ssl.cert'
18-
19-
# features
20-
AUTO_APPROVE_BASED_ON_HISTORY=true
21-
ALLOW_DIFF_DIMENSIONS=true
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Migration `20210425191116-github_215_project_config`
2+
3+
This migration has been generated by Pavel Strunkin at 4/25/2021, 10:11:16 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 TYPE "public"."ImageComparison" AS ENUM ('pixelmatch', 'lookSame', 'odiff')
10+
11+
ALTER TABLE "Project" ADD COLUMN "autoApproveFeature" BOOLEAN NOT NULL DEFAULT false,
12+
ADD COLUMN "diffDimensionsFeature" BOOLEAN NOT NULL DEFAULT false,
13+
ADD COLUMN "ignoreAntialiasing" BOOLEAN NOT NULL DEFAULT true,
14+
ADD COLUMN "threshold" DECIMAL(65,30) NOT NULL DEFAULT 0.1,
15+
ADD COLUMN "imageComparison" "ImageComparison" NOT NULL DEFAULT E'pixelmatch'
16+
17+
```
18+
19+
## Changes
20+
21+
```diff
22+
diff --git schema.prisma schema.prisma
23+
migration 20210405171118-github_243-set-empty-test-variation-tags-instead-of-null..20210425191116-github_215_project_config
24+
--- datamodel.dml
25+
+++ datamodel.dml
26+
@@ -3,9 +3,9 @@
27+
}
28+
datasource db {
29+
provider = "postgresql"
30+
- url = "***"
31+
+ url = "***"
32+
}
33+
model Build {
34+
id String @id @default(uuid())
35+
@@ -25,16 +25,22 @@
36+
@@unique([projectId, ciBuildId])
37+
}
38+
model Project {
39+
- id String @id @default(uuid())
40+
- name String
41+
- mainBranchName String @default("master")
42+
- builds Build[]
43+
- buildsCounter Int @default(0)
44+
- testVariations TestVariation[]
45+
- updatedAt DateTime @updatedAt
46+
- createdAt DateTime @default(now())
47+
+ id String @id @default(uuid())
48+
+ name String
49+
+ mainBranchName String @default("master")
50+
+ builds Build[]
51+
+ buildsCounter Int @default(0)
52+
+ testVariations TestVariation[]
53+
+ updatedAt DateTime @updatedAt
54+
+ createdAt DateTime @default(now())
55+
+ // config
56+
+ autoApproveFeature Boolean @default(false)
57+
+ diffDimensionsFeature Boolean @default(false)
58+
+ ignoreAntialiasing Boolean @default(true)
59+
+ threshold Float @default(0.1)
60+
+ imageComparison ImageComparison @default(pixelmatch)
61+
@@unique([name])
62+
}
63+
@@ -120,4 +126,10 @@
64+
unresolved
65+
approved
66+
autoApproved
67+
}
68+
+
69+
+enum ImageComparison {
70+
+ pixelmatch
71+
+ lookSame
72+
+ odiff
73+
+}
74+
```
75+
76+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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 @id @default(uuid())
12+
ciBuildId String?
13+
number Int?
14+
branchName String?
15+
status String?
16+
testRuns TestRun[]
17+
projectId String
18+
project Project @relation(fields: [projectId], references: [id])
19+
updatedAt DateTime @updatedAt
20+
createdAt DateTime @default(now())
21+
user User? @relation(fields: [userId], references: [id])
22+
userId String?
23+
isRunning Boolean?
24+
25+
@@unique([projectId, ciBuildId])
26+
}
27+
28+
model Project {
29+
id String @id @default(uuid())
30+
name String
31+
mainBranchName String @default("master")
32+
builds Build[]
33+
buildsCounter Int @default(0)
34+
testVariations TestVariation[]
35+
updatedAt DateTime @updatedAt
36+
createdAt DateTime @default(now())
37+
// config
38+
autoApproveFeature Boolean @default(false)
39+
diffDimensionsFeature Boolean @default(false)
40+
ignoreAntialiasing Boolean @default(true)
41+
threshold Float @default(0.1)
42+
imageComparison ImageComparison @default(pixelmatch)
43+
44+
@@unique([name])
45+
}
46+
47+
model TestRun {
48+
id String @id @default(uuid())
49+
imageName String
50+
diffName String?
51+
diffPercent Float?
52+
diffTollerancePercent Float @default(0)
53+
pixelMisMatchCount Int?
54+
status TestStatus
55+
buildId String
56+
build Build @relation(fields: [buildId], references: [id])
57+
testVariationId String?
58+
testVariation TestVariation? @relation(fields: [testVariationId], references: [id])
59+
merge Boolean @default(false)
60+
updatedAt DateTime @updatedAt
61+
createdAt DateTime @default(now())
62+
// Test variation data
63+
name String @default("")
64+
browser String?
65+
device String?
66+
os String?
67+
viewport String?
68+
baselineName String?
69+
comment String?
70+
baseline Baseline?
71+
branchName String @default("master")
72+
baselineBranchName String?
73+
ignoreAreas String @default("[]")
74+
tempIgnoreAreas String @default("[]")
75+
}
76+
77+
model TestVariation {
78+
id String @id @default(uuid())
79+
name String
80+
branchName String @default("master")
81+
browser String @default("")
82+
device String @default("")
83+
os String @default("")
84+
viewport String @default("")
85+
baselineName String?
86+
ignoreAreas String @default("[]")
87+
projectId String
88+
project Project @relation(fields: [projectId], references: [id])
89+
testRuns TestRun[]
90+
baselines Baseline[]
91+
comment String?
92+
updatedAt DateTime @updatedAt
93+
createdAt DateTime @default(now())
94+
95+
@@unique([projectId, name, browser, device, os, viewport, branchName])
96+
}
97+
98+
model Baseline {
99+
id String @id @default(uuid())
100+
baselineName String
101+
testVariationId String
102+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
103+
testRunId String?
104+
testRun TestRun? @relation(fields: [testRunId], references: [id])
105+
updatedAt DateTime @updatedAt
106+
createdAt DateTime @default(now())
107+
}
108+
109+
model User {
110+
id String @id @default(uuid())
111+
email String @unique
112+
password String
113+
firstName String?
114+
lastName String?
115+
apiKey String @unique
116+
isActive Boolean @default(true)
117+
builds Build[]
118+
updatedAt DateTime @updatedAt
119+
createdAt DateTime @default(now())
120+
}
121+
122+
enum TestStatus {
123+
failed
124+
new
125+
ok
126+
unresolved
127+
approved
128+
autoApproved
129+
}
130+
131+
enum ImageComparison {
132+
pixelmatch
133+
lookSame
134+
odiff
135+
}
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
{
2+
"version": "0.3.14-fixed",
3+
"steps": [
4+
{
5+
"tag": "CreateEnum",
6+
"enum": "ImageComparison",
7+
"values": [
8+
"pixelmatch",
9+
"lookSame",
10+
"odiff"
11+
]
12+
},
13+
{
14+
"tag": "CreateField",
15+
"model": "Project",
16+
"field": "autoApproveFeature",
17+
"type": "Boolean",
18+
"arity": "Required"
19+
},
20+
{
21+
"tag": "CreateDirective",
22+
"location": {
23+
"path": {
24+
"tag": "Field",
25+
"model": "Project",
26+
"field": "autoApproveFeature"
27+
},
28+
"directive": "default"
29+
}
30+
},
31+
{
32+
"tag": "CreateArgument",
33+
"location": {
34+
"tag": "Directive",
35+
"path": {
36+
"tag": "Field",
37+
"model": "Project",
38+
"field": "autoApproveFeature"
39+
},
40+
"directive": "default"
41+
},
42+
"argument": "",
43+
"value": "false"
44+
},
45+
{
46+
"tag": "CreateField",
47+
"model": "Project",
48+
"field": "diffDimensionsFeature",
49+
"type": "Boolean",
50+
"arity": "Required"
51+
},
52+
{
53+
"tag": "CreateDirective",
54+
"location": {
55+
"path": {
56+
"tag": "Field",
57+
"model": "Project",
58+
"field": "diffDimensionsFeature"
59+
},
60+
"directive": "default"
61+
}
62+
},
63+
{
64+
"tag": "CreateArgument",
65+
"location": {
66+
"tag": "Directive",
67+
"path": {
68+
"tag": "Field",
69+
"model": "Project",
70+
"field": "diffDimensionsFeature"
71+
},
72+
"directive": "default"
73+
},
74+
"argument": "",
75+
"value": "false"
76+
},
77+
{
78+
"tag": "CreateField",
79+
"model": "Project",
80+
"field": "ignoreAntialiasing",
81+
"type": "Boolean",
82+
"arity": "Required"
83+
},
84+
{
85+
"tag": "CreateDirective",
86+
"location": {
87+
"path": {
88+
"tag": "Field",
89+
"model": "Project",
90+
"field": "ignoreAntialiasing"
91+
},
92+
"directive": "default"
93+
}
94+
},
95+
{
96+
"tag": "CreateArgument",
97+
"location": {
98+
"tag": "Directive",
99+
"path": {
100+
"tag": "Field",
101+
"model": "Project",
102+
"field": "ignoreAntialiasing"
103+
},
104+
"directive": "default"
105+
},
106+
"argument": "",
107+
"value": "true"
108+
},
109+
{
110+
"tag": "CreateField",
111+
"model": "Project",
112+
"field": "threshold",
113+
"type": "Float",
114+
"arity": "Required"
115+
},
116+
{
117+
"tag": "CreateDirective",
118+
"location": {
119+
"path": {
120+
"tag": "Field",
121+
"model": "Project",
122+
"field": "threshold"
123+
},
124+
"directive": "default"
125+
}
126+
},
127+
{
128+
"tag": "CreateArgument",
129+
"location": {
130+
"tag": "Directive",
131+
"path": {
132+
"tag": "Field",
133+
"model": "Project",
134+
"field": "threshold"
135+
},
136+
"directive": "default"
137+
},
138+
"argument": "",
139+
"value": "0.1"
140+
},
141+
{
142+
"tag": "CreateField",
143+
"model": "Project",
144+
"field": "imageComparison",
145+
"type": "ImageComparison",
146+
"arity": "Required"
147+
},
148+
{
149+
"tag": "CreateDirective",
150+
"location": {
151+
"path": {
152+
"tag": "Field",
153+
"model": "Project",
154+
"field": "imageComparison"
155+
},
156+
"directive": "default"
157+
}
158+
},
159+
{
160+
"tag": "CreateArgument",
161+
"location": {
162+
"tag": "Directive",
163+
"path": {
164+
"tag": "Field",
165+
"model": "Project",
166+
"field": "imageComparison"
167+
},
168+
"directive": "default"
169+
},
170+
"argument": "",
171+
"value": "pixelmatch"
172+
}
173+
]
174+
}

0 commit comments

Comments
 (0)