diff --git a/site/gatsby-site/cypress/e2e/integration/cset.cy.js b/site/gatsby-site/cypress/e2e/integration/cset.cy.js deleted file mode 100644 index 9f74d18a2c..0000000000 --- a/site/gatsby-site/cypress/e2e/integration/cset.cy.js +++ /dev/null @@ -1,57 +0,0 @@ -const { gql } = require('@apollo/client'); - -describe('The CSET taxonomy page', () => { - const urls = [ - { namespace: 'CSETv0', url: '/taxonomy/csetv0' }, - { namespace: 'CSETv1', url: '/taxonomy/csetv1' }, - ]; - - urls.forEach(({ namespace, url }) => { - it.skip(`successfully loads ${namespace}`, () => { - cy.visit(url); - }); - - it.skip(`Should render ${namespace} fields list and Searchable status`, () => { - cy.visit(url); - - cy.waitForStableDOM(); - - cy.query({ - query: gql` - { - taxa(query: { namespace_in: ["${namespace}"] }) { - namespace - field_list { - long_name - short_name - instant_facet - public - } - } - } - `, - }) - .then( - ({ - data: { - taxa: { field_list }, - }, - }) => { - return field_list.filter( - (entry) => (entry.public === null || entry.public) && entry.short_name !== 'Publish' - ); - } - ) - .then((field_list) => { - cy.get('[data-cy*="field-"]').should('have.length', field_list.length); - - field_list.forEach((field) => { - cy.contains('h3', field.long_name.replace(/\s{2,}/g, ' ')) - .should('exist') - .contains('span', 'Searchable in Discover App') - .should(field.instant_facet ? 'exist' : 'not.exist'); - }); - }); - }); - }); -}); diff --git a/site/gatsby-site/playwright/e2e/integration/cset.spec.ts b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts new file mode 100644 index 0000000000..2725b68961 --- /dev/null +++ b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts @@ -0,0 +1,56 @@ +import { expect, Page } from '@playwright/test'; +import { gql } from '@apollo/client'; +import { query, test } from '../../utils'; + +const urls = [ + { namespace: 'CSETv0', url: '/taxonomy/csetv0' }, + { namespace: 'CSETv1', url: '/taxonomy/csetv1' }, +]; + +urls.forEach(({ namespace, url }) => { + test(`successfully loads ${namespace}`, async ({ page }) => { + await page.goto(url); + }); + + if (namespace === 'CSETv0') { + test(`Should render ${namespace} fields list and Searchable status`, async ({ page }) => { + await page.goto(url); + + const fieldListQuery = gql` + { + taxa(query: { namespace_in: ["${namespace}"] }) { + namespace + field_list { + long_name + short_name + instant_facet + public + } + } + } + `; + + const result = await query({ + query: fieldListQuery, + }); + + const field_list = result.data.taxa.field_list.filter( + (entry) => (entry.public === null || entry.public) && entry.short_name !== 'Publish' + ); + + await expect(page.locator('[data-cy*="field-"]')).toHaveCount(field_list.length); + + for (const field of field_list) { + const fieldLocator = page.locator('h3', { hasText: field.long_name.replace(/\s{2,}/g, ' ') }); + await expect(fieldLocator).toBeVisible(); + + const searchableLocator = fieldLocator.locator('span', { hasText: 'Searchable in Discover App' }); + if (field.instant_facet) { + await expect(searchableLocator.first()).toBeVisible(); + } else { + await expect(searchableLocator.first()).not.toBeVisible(); + } + } + }); + } +});