import { And, Then, When } from 'cypress-cucumber-preprocessor/steps';
+const expandedRow = () => cy.get('[data-testid="datatable-row-detail"]');
+
// When you are clicking on an action in the table actions dropdown button
When('I click on {string} button from the table actions', (button: string) => {
cy.get(`[aria-label="${button}"]`).click({ force: true });
});
When('I select a row {string} in the expanded row', (row: string) => {
- cy.get('[data-testid="datatable-row-detail"]').within(() => {
+ expandedRow().within(() => {
cy.get('.cds--search-input').first().clear().type(row);
- cy.contains(`[cdstablerow] [cdstabledata]`, row).click();
+ cy.contains('[cdstablerow] [cdstabledata]', row).should('exist').click();
+ });
+});
+
+/**
+ * Waits for an expanded-row cd-table to finish loading before row search/selection.
+ */
+And('the table in the expanded row is ready', () => {
+ expandedRow().within(() => {
+ cy.get('cd-loading-panel').should('not.exist');
+ cy.get('cd-table').should('exist');
+ cy.get('.cds--search-input').should('be.visible');
});
});
});
Then('I should not see a row with {string} in the expanded row', (row: string) => {
- cy.get('[data-testid="datatable-row-detail"]').within(() => {
+ expandedRow().within(() => {
+ cy.get('cd-loading-panel').should('not.exist');
+ cy.get('cds-icon-button.toolbar-action').first().click();
+ cy.get('cd-loading-panel').should('not.exist');
cy.get('.cds--search-input').first().clear().type(row);
cy.contains(`[cdstablerow] [cdstabledata]`, row).should('not.exist');
});
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Snapshots" tab
+ And the table in the expanded row is ready
And I click on "Create" button from the expanded row
And enter "snapshotName" "test_snapshot" in the carbon modal
And I click on "Create Snapshot" button
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Snapshots" tab
- And I select a row "test_snapshot" in the expanded row
+ And the table in the expanded row is ready
+ Then I should see a row with "test_snapshot" in the expanded row
+ When I select a row "test_snapshot" in the expanded row
And I click on "Clone" button from the table actions in the expanded row
And enter "cloneName" "test_clone" in the carbon modal
And I click on "Create Clone" button
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Subvolumes" tab
+ And the table in the expanded row is ready
And I select a row "test_clone" in the expanded row
And I click on "Remove" button from the table actions in the expanded row
And I confirm the resource "test_clone"
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Snapshots" tab
- And I select a row "test_snapshot" in the expanded row
+ And the table in the expanded row is ready
+ When I select a row "test_snapshot" in the expanded row
And I click on "Remove" button from the table actions in the expanded row
And I confirm the resource "test_snapshot"
And I click on "Remove Snapshot" button