fix(api): links and headings in local API refs.

- Fix broken links reported by the e2e link checker.
- Add an e2e test for checking internal and external links in API reference docs. Low effort, big win.
pull/5870/head
Jason Stirnaman 2025-02-26 16:20:14 -06:00
parent b9de8b4947
commit 4887aa5b66
9 changed files with 364 additions and 485 deletions

View File

@ -237,7 +237,7 @@ InfluxDB Cloud releases are frequent and not versioned, so the Cloud API spec is
We regenerate API reference docs from `influxdata/openapi`
**master** branch as features are released.
### InfluxDB OSS version
### InfluxDB OSS v2 version
Given that
`influxdata/openapi` **master** may contain OSS spec changes not implemented

View File

@ -414,7 +414,7 @@ paths:
Specifies an authorization by its `token` property value
and returns the authorization.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter,
applies other parameters, and then returns the result.
@ -441,11 +441,11 @@ paths:
token used in the request has `read-user` permission for the users (`userID` property value)
in those authorizations.
#### InfluxDB OSS
#### InfluxDB OSS v2
- **Warning**: The response body contains authorizations with their
[API token](/influxdb/cloud/reference/glossary/#token) values in clear text.
- If the request uses an _[operator token](/influxdb/latest/security/tokens/#operator-token)_,
- If the request uses an _[operator token](/influxdb/v2/security/tokens/#operator-token)_,
InfluxDB OSS returns authorizations for all organizations in the instance.
'400':
$ref: '#/components/responses/GeneralServerError'
@ -597,11 +597,11 @@ paths:
Use this endpoint to retrieve information about an API token, including
the token's permissions and the user that the token is scoped to.
#### InfluxDB OSS
#### InfluxDB OSS v2
- InfluxDB OSS returns
[API token](/influxdb/cloud/reference/glossary/#token) values in authorizations.
- If the request uses an _[operator token](/influxdb/latest/security/tokens/#operator-token)_,
- If the request uses an _[operator token](/influxdb/v2/security/tokens/#operator-token)_,
InfluxDB OSS returns authorizations for all organizations in the instance.
#### Related guides
@ -714,7 +714,7 @@ paths:
If no query parameters are passed, InfluxDB returns all buckets up to the
default `limit`.
#### InfluxDB OSS
#### InfluxDB OSS v2
- If you use an _[operator token](/influxdb/cloud/security/tokens/#operator-token)_
to authenticate your request, InfluxDB retrieves resources for _all
@ -746,7 +746,7 @@ paths:
- Doesn't use the `org` parameter or `orgID` parameter.
- Lists buckets for the organization associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Lists buckets for the specified organization.
in: query
@ -761,7 +761,7 @@ paths:
- Doesn't use the `org` parameter or `orgID` parameter.
- Lists buckets for the organization associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or `orgID` parameter.
- Lists buckets for the specified organization.
@ -846,7 +846,7 @@ paths:
[retention period](/influxdb/cloud/reference/glossary/#retention-period)
is 30 days.
#### InfluxDB OSS
#### InfluxDB OSS v2
- A single InfluxDB OSS instance supports active writes or queries for
approximately 20 buckets across all organizations at a given time.
@ -989,7 +989,7 @@ paths:
2. Returns an HTTP `204` status code if queued; _error_ otherwise.
3. Handles the delete asynchronously.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Validates the request, handles the delete synchronously,
and then responds with success or failure.
@ -1020,7 +1020,7 @@ paths:
#### InfluxDB Cloud
- The bucket is queued for deletion.
#### InfluxDB OSS
#### InfluxDB OSS v2
- The bucket is deleted.
'400':
content:
@ -1157,7 +1157,7 @@ paths:
- Requires the `retentionRules` property in the request body. If you don't
provide `retentionRules`, InfluxDB responds with an HTTP `403` status code.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't require `retentionRules`.
@ -3861,7 +3861,7 @@ paths:
Because writes and deletes are asynchronous, your change might not yet be readable
when you receive the response.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Validates the request, handles the delete synchronously,
and then responds with success or failure.
@ -3895,7 +3895,7 @@ paths:
- Deletes data from the bucket in the organization
associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or the `orgID` parameter.
- Deletes data from the bucket in the specified organization.
@ -3923,7 +3923,7 @@ paths:
- Deletes data from the bucket in the organization
associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or the `orgID` parameter.
- Deletes data from the bucket in the specified organization.
@ -3977,7 +3977,7 @@ paths:
Because writes are asynchronous, data might not yet be written
when you receive the response.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Deleted the data.
'400':
@ -3995,7 +3995,7 @@ paths:
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization.
'401':
@ -4035,16 +4035,12 @@ paths:
1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve
feature flags and their values.
2. Follow the instructions to [enable, disable, or override values for feature flags](/influxdb/cloud/reference/config-options/#feature-flags).
2. Follow the instructions to enable, disable, or override values for feature flags.
3. **Optional**: To confirm that your change is applied, do one of the following:
- Send a request to this endpoint to retrieve the current feature flag values.
- Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the
current runtime server configuration.
#### Related guides
- [InfluxDB configuration options](/influxdb/cloud/reference/config-options/)
operationId: GetFlags
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -4266,7 +4262,7 @@ paths:
#### Related guides
- [InfluxDB Cloud - Change your password](/influxdb/cloud/account-management/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/latest/users/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/v2/users/change-password/)
operationId: PutMePassword
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -4302,7 +4298,7 @@ paths:
- Doesn't let you manage user passwords through the API; always responds with this status.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't understand a value passed in the request.
'401':
@ -5115,7 +5111,7 @@ paths:
2. Returns an HTTP `204` status code if queued; _error_ otherwise.
3. Handles the delete asynchronously.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Validates the request, handles the delete synchronously,
and then responds with success or failure.
@ -5145,7 +5141,7 @@ paths:
#### InfluxDB Cloud
- The organization is queued for deletion.
#### InfluxDB OSS
#### InfluxDB OSS v2
- The organization is deleted.
'400':
$ref: '#/components/responses/BadRequestError'
@ -6080,7 +6076,7 @@ paths:
- Doesn't use the `org` parameter or `orgID` parameter.
- Queries the bucket in the organization associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or `orgID` parameter.
- Queries the bucket in the specified organization.
@ -6096,7 +6092,7 @@ paths:
- Doesn't use the `org` parameter or `orgID` parameter.
- Queries the bucket in the organization associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or `orgID` parameter.
- Queries the bucket in the specified organization.
@ -6160,7 +6156,7 @@ paths:
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization.
'401':
@ -6176,7 +6172,7 @@ paths:
[global limit](/influxdb/cloud/account-management/limits/#global-limits)
- returns `Retry-After` header that describes when to try the write again.
#### InfluxDB OSS:
#### InfluxDB OSS v2:
- doesn't return this error.
headers:
Retry-After:
@ -8512,7 +8508,7 @@ paths:
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter.
'401':
@ -9861,7 +9857,7 @@ paths:
- Always returns this error; doesn't support cancelling tasks.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't return this error.
'500':
@ -11188,7 +11184,7 @@ paths:
#### Related guides
- [InfluxDB Cloud - Change your password](/influxdb/cloud/account-management/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/latest/users/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/v2/users/change-password/)
operationId: PostUsersIDPassword
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -11226,7 +11222,7 @@ paths:
- Doesn't allow you to manage passwords through the API; always responds with this status.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't understand a value passed in the request.
default:
@ -11263,7 +11259,7 @@ paths:
#### Related guides
- [InfluxDB Cloud - Change your password](/influxdb/cloud/account-management/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/latest/users/change-password/)
- [InfluxDB OSS - Change your password](/influxdb/v2/users/change-password/)
operationId: PutUsersIDPassword
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -11301,7 +11297,7 @@ paths:
- Doesn't allow you to manage passwords through the API; always responds with this status.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't understand a value passed in the request.
default:
@ -11604,7 +11600,7 @@ paths:
Because writes and deletes are asynchronous, your change might not yet be readable
when you receive the response.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Validates the request and handles the write synchronously.
- If all points were written successfully, responds with HTTP `2xx` status code;
@ -11675,7 +11671,7 @@ paths:
- Returns only `application/json` for format and limit errors.
- Returns only `text/html` for some quota limit errors.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns only `application/json` for format and limit errors.
@ -11699,7 +11695,7 @@ paths:
- Writes data to the bucket in the organization
associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or the `orgID` parameter.
- If you pass both `orgID` and `org`, they must both be valid.
@ -11719,7 +11715,7 @@ paths:
- Writes data to the bucket in the organization
associated with the authorization (API token).
#### InfluxDB OSS
#### InfluxDB OSS v2
- Requires either the `org` parameter or the `orgID` parameter.
- If you pass both `orgID` and `org`, they must both be valid.
@ -11776,7 +11772,7 @@ paths:
- Validated and queued the request.
- Handles the write asynchronously - the write might not have completed yet.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Successfully wrote all points in the batch.
@ -11811,7 +11807,7 @@ paths:
- Returns this error for bucket schema conflicts.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization.
'401':
@ -11852,7 +11848,7 @@ paths:
- Returns this error if the payload exceeds the 50MB size limit.
- Returns `Content-Type: text/html` for this error.
#### InfluxDB OSS:
#### InfluxDB OSS v2:
- Returns this error only if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error.
- Returns `Content-Type: application/json` for this error.
@ -11870,7 +11866,7 @@ paths:
Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window.
Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't return this error.
headers:
@ -12190,7 +12186,7 @@ paths:
- description: |
The database to query data from.
This is mapped to an InfluxDB [bucket](/influxdb/cloud/reference/glossary/#bucket).
For more information, see [Database and retention policy mapping](/influxdb/cloud/api/influxdb-1x/dbrp/).
For more information, see [Database and retention policy mapping](/influxdb/cloud/api-guide/influxdb-1x/dbrp/).
in: query
name: db
required: true
@ -12199,7 +12195,7 @@ paths:
- description: |
The retention policy to query data from.
This is mapped to an InfluxDB [bucket](/influxdb/cloud/reference/glossary/#bucket).
For more information, see [Database and retention policy mapping](/influxdb/cloud/api/influxdb-1x/dbrp/).
For more information, see [Database and retention policy mapping](/influxdb/cloud/api-guide/influxdb-1x/dbrp/).
in: query
name: rp
schema:
@ -12275,7 +12271,7 @@ paths:
[global limit](/influxdb/cloud/account-management/limits/#global-limits)
- returns `Retry-After` header that describes when to try the write again.
#### InfluxDB OSS:
#### InfluxDB OSS v2:
- doesn't return this error.
headers:
Retry-After:
@ -12554,7 +12550,7 @@ components:
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter.
GeneralServerError:
@ -16001,7 +15997,7 @@ components:
- Doesn't use `shardGroupDurationsSeconds`.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Default value depends on the [bucket retention period](/influxdb/cloud/reference/internals/shards/#shard-group-duration).
@ -16151,7 +16147,7 @@ components:
- Use `explicit` to enforce column names, tags, fields, and data types for
your data.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Doesn't support `explicit` bucket schemas.
required:
@ -16444,7 +16440,7 @@ components:
- Does not use `shardGroupDurationsSeconds`.
#### InfluxDB OSS
#### InfluxDB OSS v2
- Default value depends on the
[bucket retention period](/influxdb/cloud/reference/internals/shards/#shard-group-duration).
@ -16467,7 +16463,7 @@ components:
- `retentionRules` is required.
#### InfluxDB OSS
#### InfluxDB OSS v2
- `retentionRules` isn't required.
items:
@ -19160,9 +19156,6 @@ x-tagGroups:
- Headers
- Pagination
- Response codes
- Data I/O endpoints
- Security and access endpoints
- System information endpoints
- name: All endpoints
tags:
- Authorizations (API tokens)

File diff suppressed because it is too large Load Diff

View File

@ -2143,7 +2143,6 @@ x-tagGroups:
- Headers
- Pagination
- Response codes
- System information endpoints
- name: All endpoints
tags:
- Ping

View File

@ -126,8 +126,8 @@ tags:
|:------------------------ |:--------------------- |:-------------------------------------------|
| `bucket` | string | The bucket name or ID ([find your bucket](/influxdb3/cloud-serverless/admin/buckets/view-buckets/). |
| `bucketID` | string | The bucket ID ([find your bucket](/influxdb3/cloud-serverless/admin/buckets/view-buckets/). |
| `org` | string | The organization name or ID ([find your organization](/influxdb3/cloud-serverless/organizations/view-orgs/). |
| `orgID` | 16-byte string | The organization ID ([find your organization](/influxdb3/cloud-serverless/organizations/view-orgs/). |
| `org` | string | The organization name or ID ([find your organization](/influxdb3/cloud-serverless/admin/organizations/view-orgs/). |
| `orgID` | 16-byte string | The organization ID ([find your organization](/influxdb3/cloud-serverless/admin/organizations/view-orgs/). |
name: Common parameters
x-traitTag: true
- name: Config
@ -443,11 +443,6 @@ paths:
Specifies an authorization by its `token` property value
and returns the authorization.
#### InfluxDB OSS
- Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter,
applies other parameters, and then returns the result.
#### Limitations
- The parameter is non-repeatable. If you specify more than one,
@ -469,13 +464,6 @@ paths:
If the response body is missing authorizations that you expect, check that the API
token used in the request has `read-user` permission for the users (`userID` property value)
in those authorizations.
#### InfluxDB OSS
- **Warning**: The response body contains authorizations with their
[API token](/influxdb3/cloud-serverless/reference/glossary/#token) values in clear text.
- If the request uses an _[operator token](/influxdb/latest/security/tokens/#operator-token)_,
InfluxDB OSS returns authorizations for all organizations in the instance.
'400':
$ref: '#/components/responses/GeneralServerError'
description: Invalid request
@ -625,14 +613,6 @@ paths:
Use this endpoint to retrieve information about an API token, including
the token's permissions and the user that the token is scoped to.
#### InfluxDB OSS
- InfluxDB OSS returns
[API token](/influxdb3/cloud-serverless/reference/glossary/#token) values in authorizations.
- If the request uses an _[operator token](/influxdb/latest/security/tokens/#operator-token)_,
InfluxDB OSS returns authorizations for all organizations in the instance.
#### Related guides
- [View tokens](/influxdb3/cloud-serverless/security/tokens/view-tokens/)
@ -740,14 +720,6 @@ paths:
If no query parameters are passed, InfluxDB returns all buckets up to the
default `limit`.
#### InfluxDB OSS
- If you use an _[operator token](/influxdb3/cloud-serverless/security/tokens/#operator-token)_
to authenticate your request, InfluxDB retrieves resources for _all
organizations_ in the instance.
To retrieve resources for only a specific organization, use the
`org` parameter or the `orgID` parameter to specify the organization.
#### Required permissions
| Action | Permission required |
@ -863,13 +835,6 @@ paths:
[retention period](/influxdb3/cloud-serverless/reference/glossary/#retention-period)
is 30 days.
#### InfluxDB OSS
- A single InfluxDB OSS instance supports active writes or queries for
approximately 20 buckets across all organizations at a given time.
Reading or writing to more than 20 buckets at a time can adversely affect
performance.
#### Limitations
- InfluxDB Cloud Free Plan allows users to create up to two buckets.
@ -2855,10 +2820,6 @@ paths:
description: |
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
- Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization.
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
@ -2910,7 +2871,7 @@ paths:
#### Related guides
- [View organizations](/influxdb3/cloud-serverless/organizations/view-orgs/)
- [View organizations](/influxdb3/cloud-serverless/admin/organizations/view-orgs/)
operationId: GetOrgs
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -3075,11 +3036,6 @@ paths:
2. Returns an HTTP `204` status code if queued; _error_ otherwise.
3. Handles the delete asynchronously.
#### InfluxDB OSS
- Validates the request, handles the delete synchronously,
and then responds with success or failure.
#### Limitations
- Only one organization can be deleted per request.
@ -3104,9 +3060,6 @@ paths:
#### InfluxDB Cloud
- The organization is queued for deletion.
#### InfluxDB OSS
- The organization is deleted.
'400':
$ref: '#/components/responses/BadRequestError'
'401':
@ -3145,7 +3098,7 @@ paths:
#### Related guides
- [View organizations](/influxdb3/cloud-serverless/organizations/view-orgs/)
- [View organizations](/influxdb3/cloud-serverless/admin/organizations/view-orgs/)
operationId: GetOrgsID
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -3909,10 +3862,6 @@ paths:
description: |
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
- Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization.
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
@ -4894,10 +4843,6 @@ paths:
description: |
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
- Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter.
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
@ -6234,10 +6179,6 @@ paths:
#### InfluxDB Cloud
- Always returns this error; doesn't support cancelling tasks.
#### InfluxDB OSS
- Doesn't return this error.
'500':
$ref: '#/components/responses/InternalServerError'
default:
@ -8233,10 +8174,6 @@ components:
description: |
Bad request.
The response body contains detail about the error.
#### InfluxDB OSS
- Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter.
GeneralServerError:
content:
application/json:
@ -11681,10 +11618,6 @@ components:
- Doesn't use `shardGroupDurationsSeconds`.
#### InfluxDB OSS
- Default value depends on the [bucket retention period](/influxdb3/cloud-serverless/reference/internals/shards/#shard-group-duration).
#### Related guides
- InfluxDB [shards and shard groups](/influxdb3/cloud-serverless/reference/internals/shards/)
@ -12132,10 +12065,6 @@ components:
#### InfluxDB 3 Cloud Serverless
- `retentionRules` is required.
#### InfluxDB OSS
- `retentionRules` isn't required.
items:
$ref: '#/components/schemas/RetentionRule'
type: array
@ -13400,7 +13329,7 @@ components:
The organization owns all resources created by the template.
To find your organization, see how to
[view organizations](/influxdb3/cloud-serverless/organizations/view-orgs/).
[view organizations](/influxdb3/cloud-serverless/admin/organizations/view-orgs/).
type: string
remotes:
description: |
@ -14817,9 +14746,6 @@ x-tagGroups:
- Headers
- Pagination
- Response codes
- Data I/O endpoints
- Security and access endpoints
- System information endpoints
- name: All endpoints
tags:
- Authorizations (API tokens)

View File

@ -417,16 +417,6 @@ paths:
'429':
description: |
Too many requests.
#### InfluxDB Cloud
- Returns this error if a **read** or **write** request exceeds your plan's [adjustable service quotas](/influxdb3/clustered/account-management/limits/#adjustable-service-quotas)
or if a **delete** request exceeds the maximum [global limit](/influxdb3/clustered/account-management/limits/#global-limits).
- For rate limits that reset automatically, returns a `Retry-After` header that describes when to try the write again.
- For limits that can't reset (for example, **cardinality limit**), doesn't return a `Retry-After` header.
Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window.
Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets.
headers:
Retry-After:
description: Non-negative decimal integer indicating seconds to wait before retrying the request.
@ -578,12 +568,7 @@ paths:
type: string
'429':
description: |
#### InfluxDB Cloud:
- returns this error if a **read** or **write** request exceeds your
plan's [adjustable service quotas](/influxdb3/clustered/account-management/limits/#adjustable-service-quotas)
or if a **delete** request exceeds the maximum
[global limit](/influxdb3/clustered/account-management/limits/#global-limits)
- returns `Retry-After` header that describes when to try the write again.
Token is temporarily over quota. The Retry-After header describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
@ -2134,7 +2119,6 @@ x-tagGroups:
- Headers
- Pagination
- Response codes
- System information endpoints
- name: All endpoints
tags:
- Ping

View File

@ -1,27 +0,0 @@
/// <reference types="cypress" />
describe('Article links', () => {
const subjects = Cypress.env('test_subjects').split(',');
subjects.forEach((subject) => {
it('contains valid internal links', function () {
cy.visit(`${subject}`);
cy.get('article a[href^="/"]') //.filter('[href^="/"]')
.each(($a) => {
cy.log(`** Testing internal link ${$a.attr('href')} **`);
// cy.request doesn't show in your browser's Developer Tools
// because the request comes from Node, not from the browser.
cy.request($a.attr('href')).its('status').should('eq', 200);
});
});
it('contains valid external links', function () {
cy.visit(`${subject}`);
cy.get('article a[href^="http"]')
.each(($a) => {
// cy.request doesn't show in your browser's Developer Tools
cy.log(`** Testing external link ${$a.attr('href')} **`);
// because the request comes from Node, not from the browser.
cy.request($a.attr('href')).its('status').should('eq', 200);
});
});
});
});

View File

@ -37,21 +37,36 @@ describe('API reference content', () => {
'/influxdb3/enterprise/api/',
];
subjects.forEach((subject) => {
describe(subject, () => {
it(`has API info`, function () {
beforeEach(() => {
// Intercept and modify the page HTML before it loads
cy.intercept('GET', '**', (req) => {
req.continue((res) => {
if (res.headers['content-type']?.includes('text/html')) {
// Modify the Kapa widget script attributes
// Avoid socket errors from fpjs in tests by disabling fingerprinting
res.body = res.body.replace(
/data-user-analytics-fingerprint-enabled="true"/,
'data-user-analytics-fingerprint-enabled="false"'
);
}
});
});
cy.visit(subject);
window.fcdsc = fakeGoogleTagManager;
cy.stub(window.fcdsc, 'trackingOptIn').as('trackingOptIn');
cy.stub(window.fcdsc, 'trackingOptOut').as('trackingOptOut');
});
it(`has API info`, function () {
cy.get('script[data-user-analytics-fingerprint-enabled=false]').should('have.length', 1);
cy.get('h1').first().should('have.length', 1);
cy.get('[data-role$=description]').should('have.length', 1);
});
it('links back to the version home page', function () {
cy.visit(`${subject}`);
window.fcdsc = fakeGoogleTagManager;
cy.stub(window.fcdsc, 'trackingOptIn').as('trackingOptIn');
cy.stub(window.fcdsc, 'trackingOptOut').as('trackingOptOut');
cy.get('a.back').contains('Docs')
.should('have.length', 1)
.click();
@ -61,10 +76,6 @@ describe('API reference content', () => {
cy.get('h1').should('have.length', 1);
});
it('contains valid internal links', function () {
cy.visit(subject);
window.fcdsc = fakeGoogleTagManager;
cy.stub(window.fcdsc, 'trackingOptIn').as('trackingOptIn');
cy.stub(window.fcdsc, 'trackingOptOut').as('trackingOptOut');
// The following conditional test isn't the cypress way, but the doc might not have internal links.
cy.get('body').then(($body) => {
if ($body.find('p a[href^="/"]').length === 0) {
@ -82,10 +93,6 @@ describe('API reference content', () => {
});
});
it('contains valid external links', function () {
cy.visit(subject);
window.fcdsc = fakeGoogleTagManager;
cy.stub(window.fcdsc, 'trackingOptIn').as('trackingOptIn');
cy.stub(window.fcdsc, 'trackingOptOut').as('trackingOptOut');
// The following conditional test isn't the cypress way, but the doc might not have external links.
cy.get('body').then(($body) => {
if ($body.find('p a[href^="http"]').length === 0) {