]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/e2e/block/mirroring.po.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / e2e / block / mirroring.po.ts
index f4a8baebde11223421ffd13fd3c34b0705b5d3f1..d27a1dc6e3afee400f1c922748866298ddb25432 100644 (file)
@@ -1,7 +1,33 @@
-import { browser } from 'protractor';
+import { $, by, element } from 'protractor';
+import { PageHelper } from '../page-helper.po';
 
-export class MirroringPage {
-  navigateTo() {
-    return browser.get('/#/block/mirroring');
+const pages = { index: '/#/block/mirroring' };
+
+export class MirroringPageHelper extends PageHelper {
+  pages = pages;
+
+  /**
+   * Goes to the mirroring page and edits a pool in the Pool table. Clicks on the
+   * pool and chooses an option (either pool, image, or disabled)
+   */
+  @PageHelper.restrictTo(pages.index)
+  async editMirror(name: string, option: string) {
+    // Clicks the pool in the table
+    await this.waitClickableAndClick(this.getFirstTableCellWithText(name));
+
+    // Clicks the Edit Mode button
+    const editModeButton = element(by.cssContainingText('button', 'Edit Mode'));
+    await this.waitClickableAndClick(editModeButton);
+    // Clicks the drop down in the edit pop-up, then clicks the Update button
+    await this.waitVisibility($('.modal-content'));
+    await this.selectOption('mirrorMode', option);
+
+    // Clicks update button and checks if the mode has been changed
+    await element(by.cssContainingText('button', 'Update')).click();
+    await this.waitStaleness(
+      element(by.cssContainingText('.modal-dialog', 'Edit pool mirror mode'))
+    );
+    const val = option.toLowerCase(); // used since entries in table are lower case
+    await this.waitVisibility(this.getFirstTableCellWithText(val));
   }
 }