Skip to content

Commit ad16791

Browse files
committed
Add Cypress POs and commands
Signed-off-by: Francesco Torchia <[email protected]>
1 parent c02b4b6 commit ad16791

File tree

395 files changed

+42064
-0
lines changed

Some content is hidden

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

395 files changed

+42064
-0
lines changed

cypress/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
downloads
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// GET /v3/tokens - return empty tokens data
2+
const tokensGetResponseEmptySet = {
3+
type: 'collection',
4+
links: { self: 'https://yonasb29.qa.rancher.space/v3/tokens' },
5+
createTypes: { token: 'https://yonasb29.qa.rancher.space/v3/tokens' },
6+
actions: {},
7+
pagination: { limit: 1000 },
8+
resourceType: 'token',
9+
data: []
10+
};
11+
12+
// GET /v3/tokens - small set of tokens data
13+
const tokensGetResponseSmallSet = {
14+
type: 'collection',
15+
links: { self: 'https://yonasb29.qa.rancher.space/v3/tokens' },
16+
createTypes: { token: 'https://yonasb29.qa.rancher.space/v3/tokens' },
17+
actions: {},
18+
pagination: { limit: 1000 },
19+
sort: {
20+
order: 'asc',
21+
reverse: 'https://yonasb29.qa.rancher.space/v3/tokens?order=desc',
22+
links: {
23+
authProvider: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=authProvider',
24+
description: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=description',
25+
expiresAt: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=expiresAt',
26+
lastUpdateTime: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=lastUpdateTime',
27+
token: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=token',
28+
uuid: 'https://yonasb29.qa.rancher.space/v3/tokens?sort=uuid'
29+
}
30+
},
31+
filters: {
32+
authProvider: null,
33+
clusterId: null,
34+
created: null,
35+
creatorId: null,
36+
current: null,
37+
description: null,
38+
enabled: null,
39+
expired: null,
40+
expiresAt: null,
41+
isDerived: null,
42+
lastUpdateTime: null,
43+
name: null,
44+
removed: null,
45+
token: null,
46+
ttl: null,
47+
userId: null,
48+
userPrincipal: null,
49+
uuid: null
50+
},
51+
resourceType: 'token',
52+
data: [
53+
{
54+
authProvider: 'local',
55+
baseType: 'token',
56+
clusterId: null,
57+
created: '2024-06-17T17:32:07Z',
58+
createdTS: 1718645527000,
59+
creatorId: null,
60+
current: false,
61+
description: 'Kubeconfig token',
62+
enabled: true,
63+
expired: false,
64+
expiresAt: '2024-07-17T17:32:07Z',
65+
id: 'aaa-e2e-vai-test-token-name',
66+
isDerived: true,
67+
labels: {
68+
'authn.management.cattle.io/kind': 'kubeconfig',
69+
'authn.management.cattle.io/token-userId': 'user-btq9q',
70+
'cattle.io/creator': 'norman'
71+
},
72+
lastUpdateTime: '',
73+
links: {
74+
remove: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q8dl9x',
75+
self: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q8dl9x',
76+
update: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q8dl9x'
77+
},
78+
name: 'kubeconfig-user-btq9q8dl9x',
79+
ttl: 2592000000,
80+
type: 'token',
81+
userId: 'user-btq9q',
82+
userPrincipal: 'map[displayName:Default Admin loginName:admin me:true metadata:map[creationTimestamp:<nil> name:local://user-btq9q] principalType:user provider:local]',
83+
uuid: 'd801c997-fd36-4ed1-8835-7a741a302b26'
84+
},
85+
{
86+
authProvider: 'local',
87+
baseType: 'token',
88+
clusterId: null,
89+
created: '2024-06-17T17:29:05Z',
90+
createdTS: 1718645345000,
91+
creatorId: null,
92+
current: false,
93+
description: 'Kubeconfig token',
94+
enabled: true,
95+
expired: false,
96+
expiresAt: '2024-07-17T17:29:05Z',
97+
id: 'kubeconfig-user-btq9q98fn7',
98+
isDerived: true,
99+
labels: {
100+
'authn.management.cattle.io/kind': 'kubeconfig',
101+
'authn.management.cattle.io/token-userId': 'user-btq9q',
102+
'cattle.io/creator': 'norman'
103+
},
104+
lastUpdateTime: '',
105+
links: {
106+
remove: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q98fn7',
107+
self: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q98fn7',
108+
update: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q98fn7'
109+
},
110+
name: 'kubeconfig-user-btq9q98fn7',
111+
ttl: 2592000000,
112+
type: 'token',
113+
userId: 'user-btq9q',
114+
userPrincipal: 'map[displayName:Default Admin loginName:admin me:true metadata:map[creationTimestamp:<nil> name:local://user-btq9q] principalType:user provider:local]',
115+
uuid: 'f1003a82-8923-4a8c-831a-94e72f9576ff'
116+
},
117+
{
118+
authProvider: 'local',
119+
baseType: 'token',
120+
clusterId: null,
121+
created: '2024-06-17T17:32:06Z',
122+
createdTS: 1718645526000,
123+
creatorId: null,
124+
current: false,
125+
description: 'Kubeconfig token',
126+
enabled: true,
127+
expired: false,
128+
expiresAt: '2024-07-17T17:32:06Z',
129+
id: 'kubeconfig-user-btq9q9p8lv',
130+
isDerived: true,
131+
labels: {
132+
'authn.management.cattle.io/kind': 'kubeconfig',
133+
'authn.management.cattle.io/token-userId': 'user-btq9q',
134+
'cattle.io/creator': 'norman'
135+
},
136+
lastUpdateTime: '',
137+
links: {
138+
remove: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q9p8lv',
139+
self: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q9p8lv',
140+
update: 'https://yonasb29.qa.rancher.space/v3/tokens/kubeconfig-user-btq9q9p8lv'
141+
},
142+
name: 'kubeconfig-user-btq9q9p8lv',
143+
ttl: 2592000000,
144+
type: 'token',
145+
userId: 'user-btq9q',
146+
userPrincipal: 'map[displayName:Default Admin loginName:admin me:true metadata:map[creationTimestamp:<nil> name:local://user-btq9q] principalType:user provider:local]',
147+
uuid: '82a1bc74-51a6-4230-aaa8-bb308712fcb8'
148+
}
149+
]
150+
};
151+
152+
function reply(statusCode: number, body: any) {
153+
return (req) => {
154+
req.reply({
155+
statusCode,
156+
body
157+
});
158+
};
159+
}
160+
161+
export function tokensNoData(): Cypress.Chainable<Response> {
162+
return cy.intercept('GET', '/v3/tokens', reply(200, tokensGetResponseEmptySet)).as('tokensNoData');
163+
}
164+
165+
export function generateTokensDataSmall(): Cypress.Chainable<Response> {
166+
return cy.intercept('GET', '/v3/tokens', reply(200, tokensGetResponseSmallSet)).as('tokensDataSmall');
167+
}

0 commit comments

Comments
 (0)