diff --git a/cypress/e2e/theming/admin-settings_background.cy.ts b/cypress/e2e/theming/admin-settings_background.cy.ts index e4ec661486f..52c27aaed8a 100644 --- a/cypress/e2e/theming/admin-settings_background.cy.ts +++ b/cypress/e2e/theming/admin-settings_background.cy.ts @@ -175,9 +175,15 @@ describe('Remove the default background with a bright color', function() { }) it('See the header being inverted', function() { + // Probe the Nextcloud logo: it carries the same + // `var(--background-image-invert-if-bright)` filter and is always + // present in the header. The waffle launcher's current-app icon only + // renders when an app is active, which isn't the case on settings, + // and the in-popover tiles use a fixed brightness/invert filter + // regardless of theme so they're not a valid inversion probe. cy.waitUntil(() => navigationHeader - .getNavigationEntries() - .find('img') + .logo() + .find('.logo') .then((el) => { let ret = true el.each(function() { diff --git a/cypress/e2e/theming/user-settings_app-order.cy.ts b/cypress/e2e/theming/user-settings_app-order.cy.ts index 3db1a17ac4e..5098b9af431 100644 --- a/cypress/e2e/theming/user-settings_app-order.cy.ts +++ b/cypress/e2e/theming/user-settings_app-order.cy.ts @@ -35,9 +35,14 @@ describe('User theming set app order', () => { const appOrder = ['Dashboard', 'Files'] appOrderList.assertAppOrder(appOrder) - // Check the top app menu order - navigationHeader.getNavigationEntries() - .each((entry, index) => expect(entry).contain.text(appOrder[index]!)) + // Check the top app menu order. The launcher grid appends a synthetic + // "More apps" / "App store" tile to the user's apps, so iterate + // positionally only over the real-app prefix. + navigationHeader.getNavigationEntries().then(($entries) => { + appOrder.forEach((name, index) => { + expect($entries.eq(index)).to.contain.text(name) + }) + }) }) it('Change the app order', () => { @@ -59,9 +64,14 @@ describe('User theming set app order', () => { .scrollIntoView() appOrderList.assertAppOrder(appOrder) - // Check the top app menu order - navigationHeader.getNavigationEntries() - .each((entry, index) => expect(entry).contain.text(appOrder[index]!)) + // Check the top app menu order. Idempotent open in the page object + // re-opens the popover after the reload above. The synthetic trailing + // tile is ignored by iterating only over the expected app names. + navigationHeader.getNavigationEntries().then(($entries) => { + appOrder.forEach((name, index) => { + expect($entries.eq(index)).to.contain.text(name) + }) + }) }) }) @@ -140,9 +150,13 @@ describe('User theming set app order with default app', () => { cy.reload() const appOrder = ['Files', 'Test App', 'Dashboard', 'Test App 2'] - // Check the top app menu order - navigationHeader.getNavigationEntries() - .each((entry, index) => expect(entry).contain.text(appOrder[index]!)) + // Check the top app menu order. See note above: the launcher appends + // a synthetic tile that we skip by iterating positionally. + navigationHeader.getNavigationEntries().then(($entries) => { + appOrder.forEach((name, index) => { + expect($entries.eq(index)).to.contain.text(name) + }) + }) }) }) @@ -219,9 +233,12 @@ describe('User theming reset app order', () => { const appOrder = ['Dashboard', 'Files'] appOrderList.assertAppOrder(appOrder) - // Check the top app menu order - navigationHeader.getNavigationEntries() - .each((entry, index) => expect(entry).contain.text(appOrder[index]!)) + // Check the top app menu order. See note above on the synthetic tile. + navigationHeader.getNavigationEntries().then(($entries) => { + appOrder.forEach((name, index) => { + expect($entries.eq(index)).to.contain.text(name) + }) + }) }) it('See the reset button is disabled', () => { @@ -263,9 +280,12 @@ describe('User theming reset app order', () => { it('See the app order is restored', () => { const appOrder = ['Dashboard', 'Files'] appOrderList.assertAppOrder(appOrder) - // Check the top app menu order - navigationHeader.getNavigationEntries() - .each((entry, index) => expect(entry).contain.text(appOrder[index]!)) + // Check the top app menu order. See note above on the synthetic tile. + navigationHeader.getNavigationEntries().then(($entries) => { + appOrder.forEach((name, index) => { + expect($entries.eq(index)).to.contain.text(name) + }) + }) }) it('See the reset button is disabled again', () => { diff --git a/cypress/e2e/theming/user-settings_background.cy.ts b/cypress/e2e/theming/user-settings_background.cy.ts index 639de55f571..2ad00230472 100644 --- a/cypress/e2e/theming/user-settings_background.cy.ts +++ b/cypress/e2e/theming/user-settings_background.cy.ts @@ -131,7 +131,13 @@ describe('User select a bright custom color and remove background', function() { }) it('See the header being inverted', function() { - cy.waitUntil(() => navigationHeader.getNavigationEntries().find('img').then((el) => { + // Probe the Nextcloud logo: it carries the same + // `var(--background-image-invert-if-bright)` filter and is always + // present in the header. The waffle launcher's current-app icon only + // renders when an app is active, which isn't the case on settings, + // and the in-popover tiles use a fixed brightness/invert filter + // regardless of theme so they're not a valid inversion probe. + cy.waitUntil(() => navigationHeader.logo().find('.logo').then((el) => { let ret = true el.each(function() { ret = ret && window.getComputedStyle(this).filter === 'invert(1)' @@ -157,7 +163,9 @@ describe('User select a bright custom color and remove background', function() { }) it('See the header NOT being inverted this time', function() { - cy.waitUntil(() => navigationHeader.getNavigationEntries().find('img').then((el) => { + // Probe the Nextcloud logo: see the inverted-header test above for + // why we don't probe the menu icons. + cy.waitUntil(() => navigationHeader.logo().find('.logo').then((el) => { let ret = true el.each(function() { ret = ret && window.getComputedStyle(this).filter === 'none' diff --git a/cypress/pages/NavigationHeader.ts b/cypress/pages/NavigationHeader.ts index 330dc58eefc..e911a597ce4 100644 --- a/cypress/pages/NavigationHeader.ts +++ b/cypress/pages/NavigationHeader.ts @@ -4,7 +4,11 @@ */ /** - * Page object model for the Nextcloud navigation header + * Page object model for the Nextcloud navigation header. + * + * The app launcher (waffle menu) is an NcPopover whose content is teleported + * to
, so the menu items do not live inside the