fix(api-docs): simplify Cypress API reference tests
Remove fingerprint interception workaround and fake GTM stubs. Replace back-link navigation test with sidebar link assertion.clean-squash
parent
22e8c94d05
commit
76ee94e8ec
|
|
@ -1,8 +1,49 @@
|
|||
---
|
||||
title: API compatibility
|
||||
description: >-
|
||||
Overview of the InfluxDB v1 and v2 compatible write and query endpoints
|
||||
available in InfluxDB 3 Cloud Serverless.
|
||||
### Write data
|
||||
|
||||
|
||||
InfluxDB 3 Cloud Serverless provides the following HTTP API endpoints for
|
||||
writing data:
|
||||
|
||||
|
||||
- **Recommended**: `/api/v2/write` endpoint
|
||||
for new write workloads or for bringing existing InfluxDB v2 write workloads to InfluxDB 3.
|
||||
- `/write` endpoint for bringing existing InfluxDB v1 write workloads to
|
||||
InfluxDB 3.
|
||||
|
||||
|
||||
Both endpoints accept the same line protocol format and process data in the
|
||||
same way.
|
||||
|
||||
|
||||
### Query data
|
||||
|
||||
|
||||
InfluxDB 3 Cloud Serverless provides the following protocols for executing a
|
||||
query:
|
||||
|
||||
|
||||
- **Recommended**: _Flight+gRPC_ request that contains an SQL or InfluxQL
|
||||
query.
|
||||
|
||||
- HTTP API `/query` request that contains an InfluxQL query.
|
||||
Use this protocol when bringing existing InfluxDB v1 query workloads to InfluxDB 3.
|
||||
|
||||
### InfluxDB v2 compatibility
|
||||
|
||||
|
||||
The HTTP API `/api/v2/write` endpoint works with the `Token` authentication
|
||||
scheme and existing InfluxDB 2.x tools and code.
|
||||
|
||||
|
||||
### InfluxDB v1 compatibility
|
||||
|
||||
|
||||
The HTTP API `/write` endpoint and `/query` endpoint work with InfluxDB 1.x
|
||||
username/password authentication schemes and existing InfluxDB 1.x tools and
|
||||
code.
|
||||
type: api
|
||||
layout: single
|
||||
staticFilePath: >-
|
||||
|
|
@ -15,8 +56,58 @@ specDownloadPath: /openapi/influxdb3-cloud-serverless.yml
|
|||
articleDataKey: influxdb3-cloud-serverless
|
||||
articleSection: api
|
||||
tagDescription: >-
|
||||
Overview of the InfluxDB v1 and v2 compatible write and query endpoints
|
||||
available in InfluxDB 3 Cloud Serverless.
|
||||
### Write data
|
||||
|
||||
|
||||
InfluxDB 3 Cloud Serverless provides the following HTTP API endpoints for
|
||||
writing data:
|
||||
|
||||
|
||||
- **Recommended**: `/api/v2/write` endpoint
|
||||
for new write workloads or for bringing existing InfluxDB v2 write workloads to InfluxDB 3.
|
||||
- `/write` endpoint for bringing existing InfluxDB v1 write workloads to
|
||||
InfluxDB 3.
|
||||
|
||||
|
||||
Both endpoints accept the same line protocol format and process data in the
|
||||
same way.
|
||||
|
||||
|
||||
### Query data
|
||||
|
||||
|
||||
InfluxDB 3 Cloud Serverless provides the following protocols for executing a
|
||||
query:
|
||||
|
||||
|
||||
- **Recommended**: _Flight+gRPC_ request that contains an SQL or InfluxQL
|
||||
query.
|
||||
|
||||
- HTTP API `/query` request that contains an InfluxQL query.
|
||||
Use this protocol when bringing existing InfluxDB v1 query workloads to InfluxDB 3.
|
||||
|
||||
### InfluxDB v2 compatibility
|
||||
|
||||
|
||||
The HTTP API `/api/v2/write` endpoint works with the `Token` authentication
|
||||
scheme and existing InfluxDB 2.x tools and code.
|
||||
|
||||
|
||||
### InfluxDB v1 compatibility
|
||||
|
||||
|
||||
The HTTP API `/write` endpoint and `/query` endpoint work with InfluxDB 1.x
|
||||
username/password authentication schemes and existing InfluxDB 1.x tools and
|
||||
code.
|
||||
related:
|
||||
- title: Get started querying InfluxDB
|
||||
href: /influxdb3/cloud-serverless/get-started/query/
|
||||
- title: Write data
|
||||
href: /influxdb3/cloud-serverless/write-data/
|
||||
- title: Use the v2 HTTP API with Cloud Serverless
|
||||
href: /influxdb3/cloud-serverless/guides/api-compatibility/v2/
|
||||
- title: Use the v1 HTTP API with Cloud Serverless
|
||||
href: /influxdb3/cloud-serverless/guides/api-compatibility/v1/
|
||||
alt_links:
|
||||
core: /influxdb3/core/api/
|
||||
enterprise: /influxdb3/enterprise/api/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,23 @@
|
|||
---
|
||||
title: Supported operations
|
||||
description: >-
|
||||
Overview of the common CRUD operations supported by the InfluxDB 3 Cloud
|
||||
Serverless API.
|
||||
The InfluxDB 3 Cloud Serverless API supports create, read, update, and delete
|
||||
|
||||
operations on resources. Most endpoints follow standard HTTP method
|
||||
conventions:
|
||||
|
||||
|
||||
| Operation | HTTP Method | Description |
|
||||
|
||||
|:----------|:------------|:------------|
|
||||
|
||||
| **Write** | `POST` | Send data or create a resource. |
|
||||
|
||||
| **Read** | `GET` | Retrieve a resource or list resources. |
|
||||
|
||||
| **Update** | `PUT`, `PATCH` | Replace or modify an existing resource. |
|
||||
|
||||
| **Delete** | `DELETE` | Remove a resource. |
|
||||
type: api
|
||||
layout: single
|
||||
staticFilePath: >-
|
||||
|
|
@ -15,8 +30,23 @@ specDownloadPath: /openapi/influxdb3-cloud-serverless.yml
|
|||
articleDataKey: influxdb3-cloud-serverless
|
||||
articleSection: api
|
||||
tagDescription: >-
|
||||
Overview of the common CRUD operations supported by the InfluxDB 3 Cloud
|
||||
Serverless API.
|
||||
The InfluxDB 3 Cloud Serverless API supports create, read, update, and delete
|
||||
|
||||
operations on resources. Most endpoints follow standard HTTP method
|
||||
conventions:
|
||||
|
||||
|
||||
| Operation | HTTP Method | Description |
|
||||
|
||||
|:----------|:------------|:------------|
|
||||
|
||||
| **Write** | `POST` | Send data or create a resource. |
|
||||
|
||||
| **Read** | `GET` | Retrieve a resource or list resources. |
|
||||
|
||||
| **Update** | `PUT`, `PATCH` | Replace or modify an existing resource. |
|
||||
|
||||
| **Delete** | `DELETE` | Remove a resource. |
|
||||
alt_links:
|
||||
core: /influxdb3/core/api/
|
||||
enterprise: /influxdb3/enterprise/api/
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@
|
|||
* node cypress/support/run-e2e-specs.js --spec "cypress/e2e/content/api-reference.cy.js" content/influxdb3/core/reference/api/_index.md
|
||||
*/
|
||||
|
||||
const fakeGoogleTagManager = {
|
||||
trackingOptIn: () => {},
|
||||
trackingOptOut: () => {},
|
||||
};
|
||||
|
||||
describe('API reference content', () => {
|
||||
// API section index pages (generated from article data)
|
||||
const subjects = [
|
||||
|
|
@ -33,30 +28,9 @@ describe('API reference content', () => {
|
|||
subjects.forEach((subject) => {
|
||||
describe(subject, () => {
|
||||
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');
|
||||
cy.visit(subject, { timeout: 30000 });
|
||||
});
|
||||
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);
|
||||
// Check for description element (either article--description class or data-role attribute)
|
||||
cy.get('.article--description, [data-role$=description]').should(
|
||||
|
|
@ -64,14 +38,12 @@ describe('API reference content', () => {
|
|||
1
|
||||
);
|
||||
});
|
||||
it('links back to the version home page', function () {
|
||||
cy.get('a.back').contains('Docs').should('have.length', 1).click();
|
||||
// Path should be the first two segments and trailing slash in $subject
|
||||
cy.location('pathname').should(
|
||||
'eq',
|
||||
subject.replace(/^(\/[^/]+\/[^/]+\/).*/, '$1')
|
||||
);
|
||||
cy.get('h1').should('have.length', 1);
|
||||
it('has a sidebar link to the product home', function () {
|
||||
// The sidebar contains a link to the product root page
|
||||
cy.get('.sidebar a')
|
||||
.first()
|
||||
.should('have.attr', 'href')
|
||||
.and('match', /^\/[^/]+\/[^/]+\/$/);
|
||||
});
|
||||
it('contains valid internal links', function () {
|
||||
// The following conditional test isn't the cypress way, but the doc might not have internal links.
|
||||
|
|
|
|||
Loading…
Reference in New Issue