-
Notifications
You must be signed in to change notification settings - Fork 50
/
types.ts
139 lines (121 loc) · 3.18 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
export type Action =
| RunCommand
| WriteToFile
| ModifyFile
| CompareToFile
| CompareFiles
| GoToUrl
| Wait
| Reload
| GetByLocatorAndSave
| ClickByRole
| ClickByTestId
| ClickByLocator
| ClickByLabel
| WriteBySelector
| WalletApprove
| WalletApproveConnect
| CheckIfIsIncremented
| CheckValue;
// runs a command
export type RunCommand = {
name: 'runCommand';
// the folder where the command should be run (relative to the root dir)
commandFolder?: string;
// append to the beginning of the command
// or can use <COMMAND> var to run the command inside the preCommand
// ex: pnpm pm2 start 'PORT=4000 BROWSER=none <COMMAND>'
preCommand?: string;
};
// creates a new file from the copied code
export type WriteToFile = {
name: 'writeToFile';
filepath: string;
};
// modifies an existing file
// atLine: insert the copied code at this line (index is from before lines are removed)
// removeLines: lines to remove (indexes are from before code in inserted)
// addSpacesBefore: add blank lines before
// addSpacesAfter: add blank lines after
// useSetData: instead of modifying the file with the copied code, use this code instead
export type ModifyFile = {
name: 'modifyFile';
filepath: string;
atLine?: number;
removeLines?: number[];
addSpacesBefore?: number;
addSpacesAfter?: number;
useSetData?: string;
};
// compares the code copied from the id to the file at th efilepath
export type CompareToFile = {
name: 'compareToFile';
filepath: string;
};
// compares two files from their filepaths
export type CompareFiles = {
name: 'compareFiles';
testPathName: string;
refPathName: string;
};
// goes to the url
export type GoToUrl = {
name: 'goToUrl';
url: string;
};
// waits for the timeout amount of milliseconds
export type Wait = {
name: 'wait';
timeout: number;
};
// reloads the page
export type Reload = { name: 'reload' };
// click an element by the locator
// refer to https://playwright.dev/
// you can remove text from the element's inner text before saving
export type GetByLocatorAndSave = {
name: 'getByLocator-save';
locator: string;
removeFromValue: string;
};
// click an element by the role/name
// refer to https://playwright.dev/docs/locators#locate-by-role
export type ClickByRole = {
name: 'clickByRole';
role: string;
elementName: string;
};
export type ClickByTestId = {
name: 'clickByTestId';
testId: string;
};
export type ClickByLocator = {
name: 'clickByLocator';
locator: string;
};
export type ClickByLabel = {
name: 'clickByLabel';
label: string;
};
export type WriteBySelector = {
name: 'writeBySelector';
selector: string;
value: string;
};
// approves a pending transaction
export type WalletApprove = { name: 'walletApprove' };
// approves a pending connection
export type WalletApproveConnect = { name: 'walletApproveConnect' };
// checks if the number in the finalIndex is
// equal to the initialIndex + 1
// the index is based on the order the values were saved by getByLocator-save
export type CheckIfIsIncremented = {
name: 'checkIfIsIncremented';
initialIndex: number;
finalIndex: number;
};
export type CheckValue = {
name: 'checkValue';
index: number;
value: string;
};