LP1989195: Update nightwatch selectors
authorJane Sandberg <js7389@princeton.edu>
Wed, 22 Feb 2023 15:17:13 +0000 (07:17 -0800)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 9 May 2023 14:54:25 +0000 (10:54 -0400)
Also, remove flakey test for now

Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/eg2/nightwatch/pages/staff/admin/orgUnitAdmin.ts [deleted file]
Open-ILS/src/eg2/nightwatch/pages/staff/cat/authority.ts
Open-ILS/src/eg2/nightwatch/pages/staff/cat/vandelay.ts
Open-ILS/src/eg2/nightwatch/src/staff/acq/provider.spec.ts
Open-ILS/src/eg2/nightwatch/src/staff/admin/org_unit.spec.ts [deleted file]
Open-ILS/src/eg2/nightwatch/src/staff/cat/authority.spec.ts
Open-ILS/src/eg2/nightwatch/src/staff/cat/vandelay.spec.ts

diff --git a/Open-ILS/src/eg2/nightwatch/pages/staff/admin/orgUnitAdmin.ts b/Open-ILS/src/eg2/nightwatch/pages/staff/admin/orgUnitAdmin.ts
deleted file mode 100644 (file)
index 64acac0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-import {PageObjectModel} from 'nightwatch';
-
-const orgUnitAdmin: PageObjectModel = {
-    elements: {
-        system2expand: {
-            selector: '//div[@class = "eg-tree"]/div[./div/a[text()="Example System 2 -- SYS2"]]/div[@class="eg-tree-node-expandy"]/div/span[text()="expand_more"]',
-            locateStrategy: 'xpath'
-        },
-        br3: {
-            selector: '//a[text()="Example Branch 3 -- BR3"]',
-            locateStrategy: 'xpath'
-        },
-        saveButton: {
-            selector: '//button[text()="Save"]',
-            locateStrategy: 'xpath'
-        }
-    }
-};
-
-export default orgUnitAdmin;
index 028deed..27c9e6a 100644 (file)
@@ -16,8 +16,12 @@ const authority: PageObjectModel = {
         searchResult: {
             selector: '//a[contains(text(), "Philosophy, Chinese")]',
             locateStrategy: 'xpath'
+        },
+        editTab: {
+            selector: '//a[text()="Edit" and contains(@class, "nav-link")]',
+            locateStrategy: 'xpath'
         }
     }
 };
 
-export default authority;
\ No newline at end of file
+export default authority;
index 37b7880..82595a2 100644 (file)
@@ -41,8 +41,12 @@ const vandelay: PageObjectModel = {
         authorityRecordType: {
             selector: '//button/span[text()="Authority Records"]',
             locateStrategy: 'xpath'
+        },
+        authorityAttributesTab: {
+            selector: '//a[text()="Authority Attributes" and contains(@class, "nav-link")]',
+            locateStrategy: 'xpath'
         }
     }
 };
 
-export default vandelay;
\ No newline at end of file
+export default vandelay;
index e80a31e..393595d 100644 (file)
@@ -16,21 +16,19 @@ module.exports = {
                          .assert.textContains('div.lead.alert', 'Providers');
   },
   'Can navigate via tabs': (browser: NightwatchBrowser) => {
-    const tabIds = ['purchase_orders', 'invoices', 'details'];
     navigateToEgUrl('eg2/en-US/staff/acq/provider/4/details', browser);
-    for (const tabId of tabIds) {
-      const selector = '#' + tabId;
-      browser.click(selector)
-             .waitForElementVisible(selector + '-panel')
-             .assert.hasClass(selector, 'active')
-             .assert.attributeEquals(selector, 'aria-selected', 'true');
-    }
+    browser.click('link text', 'POs')
+           .assert.textContains('.tab-content', 'Purchase Order ID');
+    browser.click('link text', 'Invoices')
+           .assert.textContains('.tab-content', 'Invoice Type');
+    browser.click('link text', 'Provider')
+           .assert.textContains('.tab-content', 'SAN');
   },
   'Warning displayed when moving to a different tab, but holdings tab has unsaved changes':
     (browser: NightwatchBrowser) => {
       navigateToEgUrl('eg2/en-US/staff/acq/provider/4/holdings', browser);
       browser.setValue('#holdings-tag', '981')
-             .click('#details')
+             .click('link text', 'Provider')
              .assert.textMatches('h4.modal-title', 'Unsaved Changes Warning');
   }
 };
diff --git a/Open-ILS/src/eg2/nightwatch/src/staff/admin/org_unit.spec.ts b/Open-ILS/src/eg2/nightwatch/src/staff/admin/org_unit.spec.ts
deleted file mode 100644 (file)
index 6cfc330..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-import {NightwatchBrowser} from 'nightwatch';
-import {navigateToEgUrl, fmEditorFieldSelector} from '../../utils';
-
-module.exports = {
-    before: (browser: NightwatchBrowser) => {
-        // System administrator housed at BR3
-        browser.page.login().loginToWebClient(browser, 'br3cmartin', 'carlm1234');
-    },
-
-    after: (browser: NightwatchBrowser) => {
-        browser.end();
-    },
-
-    'Can edit an org unit address': (browser: NightwatchBrowser) => {
-        navigateToEgUrl('/eg2/en-US/staff/admin/server/actor/org_unit', browser);
-        const orgUnitAdmin = browser.page.orgUnitAdmin();
-        // Sometimes this part of the org tree is already expanded, sometimes not...
-        orgUnitAdmin.api.element('@system2expand', (result) => {
-            if (result.status != -1) {
-                orgUnitAdmin.click('@system2expand');
-            }
-        });
-        orgUnitAdmin.click('@br3')
-                    .click('#addresses')
-                    .click('#ill_address')
-                    .setValue(fmEditorFieldSelector('Street1'), 'Apartment 221B')
-                    .click('@saveButton')
-                    .assert.visible('#eg-toast-container')
-                    .assert.containsText('#eg-toast-container', 'Update Succeeded');
-    }
-};
index 16c7b1d..caca4cf 100644 (file)
@@ -17,7 +17,7 @@ module.exports = {
                  .click('@authorityTypeInput')
                  .click('@subjectAuthorityType')
                  .click('@searchResult')
-                 .click('#edit');
+                 .click('@editTab');
         const marcEdit = browser.page.marcEdit();
         marcEdit.waitForElementVisible('@marcTag450', 15_000)
                 .setValue('@marcTag450', '550')
index c7cf07c..bc11df4 100644 (file)
@@ -24,7 +24,7 @@ module.exports = {
         const vandelay = browser.page.vandelay();
         navigateToMarcBatchImport(vandelay);
         vandelay.click('@recordDisplayAttributes')
-                .click('#authority')
+                .click('@authorityAttributesTab')
                 .click('@newVqradButton')
                 .setValue('@codeInput', 'lccn')
                 .setValue('@descriptionInput', 'LC control number')