Skip to content

Commit 3b20ff9

Browse files
committed
add contributions
1 parent 15cfc2a commit 3b20ff9

8 files changed

Lines changed: 197 additions & 200 deletions

File tree

packages/cypress/cypress/fixtures/e2e/modelRegistry/testModelRegistry.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ ociTransferJobStartedNotification: "Model transfer job started"
8282
ociTransferJobFailedNotification: "Model transfer job failed"
8383
ociDestinationRegistry: "quay.io"
8484
ociDestinationUri: "quay.io/test-org/test-oci-model:v1"
85+
ociDestinationUsername: "dummy-oci-user"
86+
ociDestinationPassword: "dummy-oci-pass"
8587

8688
# OCI Register and Store — URI origin variant
8789
ociUriModelName: "test-oci-uri-model"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
name: {{PROJECT_NAME}}-rb
5+
namespace: {{NAMESPACE}}
6+
labels:
7+
opendatahub.io/dashboard: "true"
8+
opendatahub.io/rb-project-subject: "true"
9+
app: {{REGISTRY_NAME}}
10+
app.kubernetes.io/component: model-registry
11+
app.kubernetes.io/part-of: model-registry
12+
app.kubernetes.io/name: {{REGISTRY_NAME}}
13+
component: model-registry
14+
subjects:
15+
- kind: Group
16+
apiGroup: rbac.authorization.k8s.io
17+
name: system:serviceaccounts:{{PROJECT_NAME}}
18+
roleRef:
19+
apiGroup: rbac.authorization.k8s.io
20+
kind: Role
21+
name: registry-user-{{REGISTRY_NAME}}

packages/cypress/cypress/pages/modelRegistry.ts

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,21 @@ class ModelRegistry {
5858
this.waitLanding();
5959
}
6060

61-
visit() {
62-
this.visitWithRegistry('modelregistry-sample');
63-
}
64-
65-
visitWithRegistry(registryName: string) {
66-
cy.visitWithLogin(`/ai-hub/models/registry/${registryName}`);
67-
this.wait();
61+
visit(registryName = 'modelregistry-sample') {
62+
cy.visitWithLogin(`/ai-hub/registry/${registryName}`);
63+
cy.findByTestId('app-page-title', { timeout: 60000 }).should('exist');
6864
}
6965

7066
navigate() {
71-
appChrome.findNavItem({ name: 'Models', rootSection: 'AI hub' }).click();
67+
appChrome
68+
.findNavItem({ name: 'Registry', rootSection: 'AI hub', subSection: 'Models' })
69+
.click();
7270
this.wait();
7371
}
7472

7573
private wait() {
76-
cy.findByTestId('app-tab-page-title').should('exist');
77-
cy.findByText('Select a model registry to view and manage your registered models.', {
78-
exact: false,
79-
}).should('exist');
74+
cy.findByTestId('app-page-title').should('exist');
75+
cy.findByTestId('app-page-title').contains('Registry');
8076
cy.testA11y();
8177
}
8278

@@ -134,12 +130,16 @@ class ModelRegistry {
134130
}
135131

136132
tabEnabled() {
137-
appChrome.findNavItem({ name: 'Models', rootSection: 'AI hub' }).should('exist');
133+
appChrome
134+
.findNavItem({ name: 'Registry', rootSection: 'AI hub', subSection: 'Models' })
135+
.should('exist');
138136
return this;
139137
}
140138

141139
tabDisabled() {
142-
appChrome.findNavItem({ name: 'Models', rootSection: 'AI hub' }).should('not.exist');
140+
appChrome
141+
.findNavItem({ name: 'Registry', rootSection: 'AI hub', subSection: 'Models' })
142+
.should('not.exist');
143143
return this;
144144
}
145145

@@ -161,20 +161,16 @@ class ModelRegistry {
161161

162162
getRow(name: string) {
163163
return new ModelRegistryTableRow(() =>
164-
this.findTable().find(`[data-label="Model name"]`).contains(name).closest('tr'),
164+
this.findTable().find(`[data-label="Model name"]`).contains(name).parents('tr'),
165165
);
166166
}
167167

168-
findModelByName(name: string) {
169-
return this.getRow(name).findName();
170-
}
171-
172168
getModelVersionRow(name: string) {
173169
return new ModelRegistryTableRow(() =>
174170
this.findModelVersionsTable()
175171
.find(`[data-label="Version name"]`)
176172
.contains(name)
177-
.closest('tr'),
173+
.parents('tr'),
178174
);
179175
}
180176

@@ -183,34 +179,21 @@ class ModelRegistry {
183179
}
184180

185181
findModelRegistry() {
186-
return cy.findAllByTestId('model-registry-selector-dropdown').filter(':visible').first();
182+
return cy.findByTestId('model-registry-selector-dropdown');
187183
}
188184

189185
findSelectModelRegistry(registryName: string) {
190-
cy.url({ timeout: 30000 }).then((url) => {
191-
if (url.includes(`/registry/${registryName}`)) {
192-
return;
186+
// Check if the registry is already selected
187+
this.findModelRegistry().then(($dropdown) => {
188+
if (!$dropdown.text().includes(registryName)) {
189+
// Registry is not selected, perform click actions
190+
this.findModelRegistry().click();
191+
cy.findByTestId(registryName).click();
193192
}
194-
cy.findAllByTestId('model-registry-selector-dropdown').filter(':visible').first().click();
195-
cy.findAllByTestId(registryName).filter(':visible').first().click();
196193
});
197-
cy.url({ timeout: 30000 }).should('include', `/registry/${registryName}`);
198194
return this;
199195
}
200196

201-
/** Link button in the Model name column (navigates to registered model / overview). */
202-
findModelNameLinkButton(name: string) {
203-
return this.getRow(name).find().find('[data-testid="model-name"] button').first();
204-
}
205-
206-
findVersionDetailsBreadcrumbModel() {
207-
return cy.findByTestId('breadcrumb-model-version');
208-
}
209-
210-
findVersionDetailsBreadcrumbVersion() {
211-
return cy.findByTestId('breadcrumb-version-name');
212-
}
213-
214197
findModelVersionsTableHeaderButton(name: string) {
215198
return this.findModelVersionsTable().find('thead').findByRole('button', { name });
216199
}

packages/cypress/cypress/pages/modelRegistry/registerAndStorePage.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ class RegisterAndStorePage {
2222
return cy.findByTestId('namespace-form-group');
2323
}
2424

25-
findProjectSelectorToggle() {
26-
return cy.findByTestId('project-selector-toggle');
25+
findProjectSelectorToggle(timeout?: number) {
26+
return cy.findByTestId('project-selector-toggle', { timeout });
27+
}
28+
29+
findProjectSelectorSearch() {
30+
return cy.findByTestId('project-selector-search');
31+
}
32+
33+
findProjectSelectorMenuList() {
34+
return cy.findByTestId('project-selector-menuList');
2735
}
2836

2937
findNoAccessAlert() {

packages/cypress/cypress/pages/modelRegistry/registerModelPage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class RegisterModelPage {
8282
return cy.findByTestId('model-name-error');
8383
}
8484

85-
findRegistrationModeToggleGroup() {
86-
return cy.findByTestId('registration-mode-toggle-group');
85+
findRegistrationModeToggleGroup(timeout?: number) {
86+
return cy.findByTestId('registration-mode-toggle-group', { timeout });
8787
}
8888

8989
findRegisterToggle() {

0 commit comments

Comments
 (0)