Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change page loading function #367

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/clusters/update-cluster.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('Update cluster', () => {
},
"created_at": "2023-03-08T02:39:03Z",
"updated_at": "2023-03-08T02:39:03Z",
"is_default": true
"is_default": false
},
});
},
Expand Down
8 changes: 2 additions & 6 deletions cypress/e2e/schedulers/scheduler.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@ describe('Scheduler', () => {
it('click the hostname', () => {
cy.visit('/clusters/1');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
).should('have.text', 'scheduler-7');
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2) > .MuiTypography-root').should('have.text', 'scheduler-7');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
).click();
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2) > .MuiTypography-root').click();

// Then I see that the current page is the clusters/1/schedulers/7!
cy.url().should('include', '/clusters/1/schedulers/7');
Expand Down
91 changes: 23 additions & 68 deletions cypress/e2e/schedulers/schedulers.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,12 @@ describe('Schedulers', () => {

it('can display schedulers table', () => {
// Show hostname.
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2) > .MuiTypography-root')
.should('be.visible')
.and('contain', 'scheduler-7');

// Show ip.
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(3) > .show_ipContainer__pzOmv',
)
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(3) > .show_ipContainer__pzOmv')
.should('be.visible')
.and('contain', '30.44.98.202');

Expand All @@ -82,27 +78,21 @@ describe('Schedulers', () => {
.and('have.css', 'background-color', 'rgb(46, 143, 121)');

// Show features.
cy.get(':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(6)')
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(6)')
.should('be.visible')
.and('contain', 'Schedule')
.and('contain', 'Preheat');

// Show scheduler-5 information.
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(2) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(2) > :nth-child(2) > .MuiTypography-root')
.should('be.visible')
.and('contain', 'scheduler-5');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(2) > :nth-child(3) > .show_ipContainer__pzOmv',
)
cy.get('#scheduler-table-body > :nth-child(2) > :nth-child(3)')
.should('be.visible')
.and('contain', '20.14.28.202');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(5) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(5) > :nth-child(2)')
.scrollIntoView()
.should('be.visible')
.and('contain', 'scheduler-10');
Expand Down Expand Up @@ -141,9 +131,7 @@ describe('Schedulers', () => {
});

it('there should be a message indicating that there is no scheduler', () => {
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', `You don't have scheduler cluster.`);
});
Expand Down Expand Up @@ -180,9 +168,7 @@ describe('Schedulers', () => {
});

it('there should be a message indicating that there is no scheduler', () => {
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', `You don't have scheduler cluster.`);
});
Expand All @@ -204,19 +190,14 @@ describe('Schedulers', () => {
.and('have.text', 'scheduler-7');

// Go to next page.
cy.get(':nth-child(7) > .MuiPagination-root > .MuiPagination-ul > :nth-child(3) > .MuiButtonBase-root').click();

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableHead-root > .MuiTableRow-root > :nth-child(2)',
).scrollIntoView();
cy.get('#scheduler-pagination > .MuiPagination-ul > :nth-child(3) > .MuiButtonBase-root').click();

// Check the current page number.
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '2');

// Show scheduler information.
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2)')
.scrollIntoView()
.should('be.visible')
.and('contain', 'scheduler-11');

Expand All @@ -230,9 +211,7 @@ describe('Schedulers', () => {
// Check the current page number.
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '3');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > :nth-child(2)')
.should('be.visible')
.and('contain', 'scheduler-2');
});
Expand All @@ -244,9 +223,7 @@ describe('Schedulers', () => {
// Check the current page number.
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '3');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', 'scheduler-2');

Expand All @@ -270,9 +247,7 @@ describe('Schedulers', () => {
// Check the current page number.
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '3');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', 'scheduler-2');

Expand All @@ -288,9 +263,7 @@ describe('Schedulers', () => {
// Check the current page number.
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '3');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', 'scheduler-2');
});
Expand All @@ -313,19 +286,15 @@ describe('Schedulers', () => {

cy.get('#scheduler-table-body').children().should('have.length', 5);

cy.get(
':nth-child(6) > .show_searchContainer__6kD-7 > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root',
).type('scheduler-8{enter}');
cy.get('#free-solo-demo').type('scheduler-8{enter}');

cy.get('#scheduler-table-body').children().should('have.length', 1);

// Pagination has been hidden.
cy.get('#scheduler-pagination > .MuiPagination-ul').should('not.exist');

// Clear search box.
cy.get(
':nth-child(6) > .show_searchContainer__6kD-7 > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root',
).clear();
cy.get('#free-solo-demo').clear();

// If the search is empty, all schedulers will be displayed.
cy.get('#scheduler-button').click();
Expand All @@ -348,14 +317,10 @@ describe('Schedulers', () => {
},
);

cy.get(
':nth-child(6) > .show_searchContainer__6kD-7 > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root',
).type('scheduler-12{enter}');
cy.get('#free-solo-demo').type('scheduler-12{enter}');

// No scheduler.
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root',
)
cy.get('#scheduler-table-body > .MuiTableRow-root > .MuiTableCell-root')
.should('be.visible')
.and('contain', `You don't have scheduler cluster.`);

Expand All @@ -376,9 +341,7 @@ describe('Schedulers', () => {
},
);

cy.get(
':nth-child(6) > .show_searchContainer__6kD-7 > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root',
).type('scheduler-12{enter}');
cy.get('#free-solo-demo').type('scheduler-12{enter}');

// Show error message.
cy.get('.MuiAlert-message').should('have.text', 'Failed to fetch');
Expand Down Expand Up @@ -446,11 +409,7 @@ describe('Schedulers', () => {
// Go to next page.
cy.get('#scheduler-pagination > .MuiPagination-ul > :nth-child(3) > .MuiButtonBase-root').click();
cy.get('#scheduler-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '2');
cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(5) > :nth-child(2) > .MuiTypography-root',
)
.should('be.visible')
.and('contain', 'scheduler-4');
cy.get('#scheduler-table-body > :nth-child(5) > :nth-child(2)').should('be.visible').and('contain', 'scheduler-4');
cy.get('#scheduler-4').click();

// Check if the total number of pages is 5.
Expand Down Expand Up @@ -515,9 +474,7 @@ describe('Schedulers', () => {
},
).as('delete');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2)')
.should('be.visible')
.and('contain', 'scheduler-7');

Expand All @@ -542,9 +499,7 @@ describe('Schedulers', () => {
},
).as('delete');

cy.get(
':nth-child(6) > .css-8atqhb > .MuiTable-root > .MuiTableBody-root > :nth-child(1) > :nth-child(2) > .MuiTypography-root',
)
cy.get('#scheduler-table-body > :nth-child(1) > :nth-child(2)')
.should('be.visible')
.and('contain', 'scheduler-7');

Expand Down
Loading