Change code-example test to not use Actions (#24979)
* Change code-example test to not use Actions * Use discussions instead * Use code-security, but make the 'more' test not an exact number * Removed references to actions/code-examples.yml * Update tests/browser/browser.js Co-authored-by: Robert Sese <robert.sese@gmail.com> Co-authored-by: Martin Lopes <martin389@github.com> Co-authored-by: Robert Sese <robert.sese@gmail.com>
This commit is contained in:
@@ -108,7 +108,7 @@ export const CodeExamples = () => {
|
||||
<p className="my-3 f4">
|
||||
{t('no_example')} <br /> {t('try_another')}
|
||||
</p>
|
||||
<Link href="https://github.com/github/docs/blob/main/data/product-examples/actions/code-examples.yml">
|
||||
<Link href="https://github.com/github/docs/tree/main/data/product-examples">
|
||||
{t('learn')} <ArrowRightIcon />
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Pages that use the `product-landing` layout may optionally include an `Examples` section. Currently, we support three types of examples:
|
||||
|
||||
1. Code examples
|
||||
See https://docs.github.com/en/actions#code-examples.
|
||||
See https://docs.github.com/en/codespaces#code-examples.
|
||||
|
||||
2. Community examples
|
||||
See https://docs.github.com/en/discussions#community-examples.
|
||||
@@ -13,7 +13,7 @@ Pages that use the `product-landing` layout may optionally include an `Examples`
|
||||
|
||||
## How it works
|
||||
|
||||
Example data for each product is defined in `data/product-landing-examples`, in a subdirectory named for the **product** and a YML file named for the **example type** (e.g., `data/product-examples/sponsors/user-examples.yml` or `data/product-examples/actions/code-examples.yml`). We currently only support one type of example per product.
|
||||
Example data for each product is defined in `data/product-landing-examples`, in a subdirectory named for the **product** and a YML file named for the **example type** (e.g., `data/product-examples/sponsors/user-examples.yml` or `data/product-examples/codespaces/code-examples.yml`). We currently only support one type of example per product.
|
||||
|
||||
### Versioning
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ describe('tool specific content', () => {
|
||||
|
||||
describe('code examples', () => {
|
||||
it('loads correctly', async () => {
|
||||
await page.goto('http://localhost:4001/en/actions')
|
||||
await page.goto('http://localhost:4001/en/code-security')
|
||||
const shownCards = await page.$$('[data-testid=code-example-card]')
|
||||
const shownNoResult = await page.$('[data-testid=code-examples-no-results]')
|
||||
expect(shownCards.length).toBeGreaterThan(0)
|
||||
@@ -379,23 +379,24 @@ describe('code examples', () => {
|
||||
})
|
||||
|
||||
it('filters cards', async () => {
|
||||
await page.goto('http://localhost:4001/en/actions')
|
||||
await page.goto('http://localhost:4001/en/code-security')
|
||||
await page.click('[data-testid=code-examples-input]')
|
||||
await page.type('[data-testid=code-examples-input]', 'issues')
|
||||
await page.type('[data-testid=code-examples-input]', 'policy')
|
||||
await page.click('[data-testid=code-examples-search-btn]')
|
||||
const shownCards = await page.$$('[data-testid=code-example-card]')
|
||||
expect(shownCards.length).toBeGreaterThan(1)
|
||||
})
|
||||
|
||||
it('shows more cards', async () => {
|
||||
await page.goto('http://localhost:4001/en/actions')
|
||||
await page.goto('http://localhost:4001/en/code-security')
|
||||
const initialCards = await page.$$('[data-testid=code-example-card]')
|
||||
await page.click('[data-testid=code-examples-show-more]')
|
||||
const moreCards = await page.$$('[data-testid=code-example-card]')
|
||||
expect(moreCards.length).toBe(initialCards.length * 2)
|
||||
expect(moreCards.length).toBeGreaterThan(initialCards.length)
|
||||
})
|
||||
|
||||
it('displays no result message', async () => {
|
||||
await page.goto('http://localhost:4001/en/actions')
|
||||
await page.goto('http://localhost:4001/en/code-security')
|
||||
await page.click('[data-testid=code-examples-input]')
|
||||
await page.type('[data-testid=code-examples-input]', 'this should not work')
|
||||
await page.click('[data-testid=code-examples-search-btn]')
|
||||
|
||||
Reference in New Issue
Block a user