Skip to content

Commit 547202b

Browse files
author
Yehudit Kerido
committed
feat(ws): Notebooks 2.0 // Frontend // Fetch workspaces
Signed-off-by: Yehudit Kerido <yehudit.kerido@nokia.com>
1 parent b3cd688 commit 547202b

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

workspaces/frontend/src/__tests__/cypress/cypress/support/commands/axe.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ declare global {
55
namespace Cypress {
66
interface Chainable {
77
testA11y: (context?: Parameters<cy['checkA11y']>[0]) => void;
8-
getDataTest(dataTestSelector: string): Chainable<JQuery<HTMLElement>>;
98
}
109
}
1110
}
1211

13-
Cypress.Commands.add('getDataTest', (dataTestSelector) => {
14-
return cy.get(`[data-test="${dataTestSelector}"]`);
15-
});
16-
1712
Cypress.Commands.add('testA11y', { prevSubject: 'optional' }, (subject, context) => {
1813
const test = (c: Parameters<typeof cy.checkA11y>[0]) => {
1914
cy.window({ log: false }).then((win) => {

workspaces/frontend/src/__tests__/cypress/cypress/tests/e2e/Workspaces.cy.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ import { mockBFFResponse } from '~/__mocks__/utils';
1010
// Helper function to validate the content of a single workspace row in the table
1111
const validateWorkspaceRow = (workspace: any, index: number) => {
1212
// Validate the workspace name
13-
cy.getDataTest(`workspace-row-${index}`)
14-
.find('[data-test="workspace-name"]')
13+
cy.findByTestId(`workspace-row-${index}`)
14+
.find('[data-testid="workspace-name"]')
1515
.should('have.text', workspace.name);
1616

1717
// Map workspace state to the expected label
1818
const expectedLabel = WorkspaceState[workspace.status.state];
1919

2020
// Validate the state label and pod configuration
21-
cy.getDataTest(`workspace-row-${index}`)
22-
.find('[data-test="state-label"]')
21+
cy.findByTestId(`workspace-row-${index}`)
22+
.find('[data-testid="state-label"]')
2323
.should('have.text', expectedLabel);
2424

25-
cy.getDataTest(`workspace-row-${index}`)
26-
.find('[data-test="pod-config"]')
25+
cy.findByTestId(`workspace-row-${index}`)
26+
.find('[data-testid="pod-config"]')
2727
.should('have.text', workspace.options.podConfig);
2828
};
2929

@@ -38,7 +38,7 @@ describe('Workspaces Tests', () => {
3838
});
3939

4040
it('should display the correct number of workspaces', () => {
41-
cy.getDataTest('workspaces-table')
41+
cy.findByTestId('workspaces-table')
4242
.find('tbody tr')
4343
.should('have.length', mockWorkspaces.length);
4444
});
@@ -54,7 +54,7 @@ describe('Workspaces Tests', () => {
5454
cy.intercept('GET', '/api/v1/workspaces', { statusCode: 200, body: { data: [] } });
5555
cy.visit('/');
5656

57-
cy.getDataTest('workspaces-table').find('tbody tr').should('not.exist');
57+
cy.findByTestId('workspaces-table').find('tbody tr').should('not.exist');
5858
});
5959
});
6060

@@ -81,7 +81,7 @@ describe('Workspace by namespace functionality', () => {
8181
it('should update workspaces when namespace changes', () => {
8282
// Verify initial state (default namespace)
8383
cy.wait('@getWorkspaces');
84-
cy.getDataTest('workspaces-table')
84+
cy.findByTestId('workspaces-table')
8585
.find('tbody tr')
8686
.should('have.length', mockWorkspaces.length);
8787

@@ -95,7 +95,7 @@ describe('Workspace by namespace functionality', () => {
9595
.should('include', '/api/v1/workspaces/kubeflow');
9696

9797
// Verify the length of workspaces list is updated
98-
cy.getDataTest('workspaces-table')
98+
cy.findByTestId('workspaces-table')
9999
.find('tbody tr')
100100
.should('have.length', mockWorkspacesByNS.length);
101101
});

0 commit comments

Comments
 (0)