1
0
mirror of synced 2025-12-19 18:10:59 -05:00

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:
Lucas Costi
2022-02-03 14:32:39 +10:00
committed by GitHub
parent a046b15fe8
commit a7860a720f
3 changed files with 10 additions and 9 deletions

View File

@@ -108,7 +108,7 @@ export const CodeExamples = () => {
<p className="my-3 f4"> <p className="my-3 f4">
{t('no_example')} <br /> {t('try_another')} {t('no_example')} <br /> {t('try_another')}
</p> </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 /> {t('learn')} <ArrowRightIcon />
</Link> </Link>
</div> </div>

View File

@@ -3,7 +3,7 @@
Pages that use the `product-landing` layout may optionally include an `Examples` section. Currently, we support three types of examples: Pages that use the `product-landing` layout may optionally include an `Examples` section. Currently, we support three types of examples:
1. Code 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 2. Community examples
See https://docs.github.com/en/discussions#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 ## 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 ### Versioning

View File

@@ -371,7 +371,7 @@ describe('tool specific content', () => {
describe('code examples', () => { describe('code examples', () => {
it('loads correctly', async () => { 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 shownCards = await page.$$('[data-testid=code-example-card]')
const shownNoResult = await page.$('[data-testid=code-examples-no-results]') const shownNoResult = await page.$('[data-testid=code-examples-no-results]')
expect(shownCards.length).toBeGreaterThan(0) expect(shownCards.length).toBeGreaterThan(0)
@@ -379,23 +379,24 @@ describe('code examples', () => {
}) })
it('filters cards', async () => { 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.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]') const shownCards = await page.$$('[data-testid=code-example-card]')
expect(shownCards.length).toBeGreaterThan(1) expect(shownCards.length).toBeGreaterThan(1)
}) })
it('shows more cards', async () => { 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]') const initialCards = await page.$$('[data-testid=code-example-card]')
await page.click('[data-testid=code-examples-show-more]') await page.click('[data-testid=code-examples-show-more]')
const moreCards = await page.$$('[data-testid=code-example-card]') 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 () => { 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.click('[data-testid=code-examples-input]')
await page.type('[data-testid=code-examples-input]', 'this should not work') await page.type('[data-testid=code-examples-input]', 'this should not work')
await page.click('[data-testid=code-examples-search-btn]') await page.click('[data-testid=code-examples-search-btn]')