Skip to content

Commit

Permalink
Merge pull request #17381 from newrelic/translations-e48944ee
Browse files Browse the repository at this point in the history
Updated translations -  (machine translation)
  • Loading branch information
jmiraNR committed May 21, 2024
2 parents af48bca + 7e8cfd5 commit dbef0fb
Show file tree
Hide file tree
Showing 42 changed files with 15,944 additions and 1,831 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Con el monitoreo sintético, puede monitor y probar sus aplicaciones y abordar p

Esta opción verifica la validez de la cadena del certificado SSL. Se puede duplicar ejecutando la siguiente sintaxis:

```sh
openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApath /etc/ssl/certs > /dev/null
```
```sh
openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApath /etc/ssl/certs > /dev/null
```

* <DoNotTranslate>**Bypass HEAD request (for ping monitors).**</DoNotTranslate>

Expand Down Expand Up @@ -166,9 +166,9 @@ openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApat
</Step>

<Step>
## Configurar y desarrollar una prueba browser con script [#scripted-test]
## Configurar y desarrollar un browser con script o una prueba API con script [#scripted-test]

Al utilizar un navegador con secuencias de comandos, puede crear un flujo de trabajo de monitoreo complejo con los enlaces de Selenium JavaScript Webdriver. Por ejemplo, puede log sesión en la aplicación, navegar a un enlace en particular y esperar a que se cargue un elemento de página y agregue una afirmación. Para hacer esto, usted:
Empleando el script monitor de browser con, puede crear fácilmente un monitoreo de flujo de trabajo con Selenium JavaScript Webdriver. Por ejemplo, puede navegar a una página en individua, buscar un elemento en la página, verificar que se encuentre el texto esperado y tomar una captura de pantalla. Para hacer esto, usted:

1. Vaya a

Expand All @@ -182,141 +182,144 @@ openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApat

.

3. Ingrese el nombre y los detalles de su monitor. Por ejemplo, `sitename.com` browser con secuencias de comandos.
3. Elija el tipo de monitor

<DoNotTranslate>**Scripted browser**</DoNotTranslate>

4. Seleccione las ubicaciones desde donde desea que se ejecute su monitor. Por ejemplo, Mumbai, Seúl, Columbus o Montreal.
.

5. Elija una frecuencia para determinar con qué frecuencia su monitor funcionará desde esto. Por ejemplo, cinco minutos.
4. Ingrese un nombre, seleccione un tiempo de ejecución y seleccione un periodo para su monitor.

6. Establezca un método de notificación para alertar a su equipo cuando ocurra un incidente de desempeño.
5. Seleccione las ubicaciones desde donde desea que se ejecute su monitor. Por ejemplo, Mumbai, Seúl, Columbus o Montreal.

7. Ahora está listo para escribir su script. Consulte este script de ejemplo para probar el rendimiento de `newrelic.com` y verificar que ciertos elementos se hayan cargado.
6. Ahora está listo para escribir su script. Vea este script de ejemplo que prueba el rendimiento de `newrelic.com` y verifica que ciertos elementos se cargaron.

```js
/**
* Script Name: Best Practices - Chrome 100
* Author: New Relic
* Version: 1.5
* Purpose: best practices example
* Reference: https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/synthetic-scripted-browser-reference-monitor-versions-chrome-100/
*/

// -------------------- CONSTANTS
const SCRIPT_NAME = "Best Practices - Chrome 100" // name to record in script log
const IMPLICIT_TIMEOUT = 3000 // default implicit timeout is 10 seconds, 3 seconds x 8 findElement operations = 24 seconds, assuming all operations time out
const PAGE_LOAD_TIMEOUT = 60000 // default page load timeout is 60 seconds, fail early to prevent long duration timeouts
const SCRIPT_TIMEOUT = 20000 // default script timeout is 30 seconds
const USER_AGENT = "default" // set the user agent for Chrome
const PROTOCOL = "https://" // set the protocol
const USERNAME = "" // username:
const PASSWORD = "" // password@
const DOMAIN = "docs.newrelic.com" // your domain
const PATH = "/docs/new-relic-solutions/get-started/intro-new-relic/" // path to main page
const CHECK = "Need some inspiration first? Check out this intro video." // text to match on page
const AUTH = USERNAME + PASSWORD
const MAIN_URL = PROTOCOL + AUTH + DOMAIN + PATH
* Script Name: Best Practices Example - Chrome 100+
* Author: New Relic
* Version: 1.0
* Purpose: A simple New Relic Synthetics scripted browser monitor to navigate to a page, find an element, and assert on expected text.
*/
// -------------------- DEPENDENCIES
var assert = require("assert")
const assert = require("assert")
// -------------------- CONFIGURATION
const PAGE_URL = "https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/synthetic-scripted-browser-reference-monitor-versions-chrome-100/"
const TEXT_TO_CHECK = "Synthetic scripted browser reference (Chrome 100 and higher)"
// Set timeouts for page load and element finding
await $webDriver.manage().setTimeouts({
implicit: IMPLICIT_TIMEOUT, // sets element load timeout
pageLoad: PAGE_LOAD_TIMEOUT, // sets page load timeout
script: SCRIPT_TIMEOUT // sets script timeout
pageLoad: 30000, // 30 seconds for page load timeout
implicit: 5000, // 5 seconds for element finding timeout
})
// -------------------- VARIABLES
var By = $selenium.By
var loc = {
video: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > article > div > div > div:nth-child(1) > div > p:nth-child(2)"),
start: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > h1"),
e: [
{ step: 'signup', selector: By.css("#sign-up-for-new-relic-if-you-havent-already") },
{ step: 'ingest', selector: By.css("#ingest-some-data") },
{ step: 'dashboards', selector: By.css("#check-out-some-dashboards") },
{ step: 'data', selector: By.css("#add-more-data") },
{ step: 'alerting', selector: By.css("#set-up-alerting") },
{ step: 'users', selector: By.css("#add-users") }
]
}
// -------------------- START OF SCRIPT
console.log("Starting simplified synthetics script")
// -------------------- FUNCTIONS
// for backwards compatibility with legacy runtimes
async function waitForAndFindElement(locator, timeout) {
const element = await $webDriver.wait(
$selenium.until.elementLocated(locator),
timeout,
"Timed-out waiting for element to be located using: " + locator
)
await $webDriver.wait(
$selenium.until.elementIsVisible(element),
timeout,
"Timed-out waiting for element to be visible using ${element}"
)
return await $webDriver.findElement(locator)
}
// Navigate to the page
console.log("Navigating to: " + PAGE_URL)
await $webDriver.get(PAGE_URL)
// -------------------- START OF SCRIPT
// Start logging
var start_time = new Date()
console.log("Starting synthetics script: " + SCRIPT_NAME)

// confirm timeouts are set
const {implicit, pageLoad, script} = await $webDriver.manage().getTimeouts()
console.log("Timeouts are set to:")
console.log(" IMPLICIT: " + implicit / 1000 + "s")
console.log(" PAGE LOAD: " + pageLoad / 1000 + "s")
console.log(" SCRIPT: " + script / 1000 + "s")

// Setting User Agent is not then-able, so we do this first (if defined and not default)
if (USER_AGENT && 0 !== USER_AGENT.trim().length && USER_AGENT != "default") {
$headers.add("User-Agent", USER_AGENT)
console.log("Setting User-Agent to " + USER_AGENT)
}
// Find the element with the specified text
const By = $selenium.By
const textElement = By.className("css-v50zng")
console.log("Checking for presence of element with text: " + TEXT_TO_CHECK)
const element = await $webDriver.findElement(textElement)
const text = await element.getText()
// Assert the text is present
console.log("Found text: " + text)
assert.equal(text, TEXT_TO_CHECK, "Expected text not found on the page")
// if an error happens at any step, script execution is halted and a failed result is returned
console.log("1. get: " + MAIN_URL)
await $webDriver.get(MAIN_URL)
// Take a screenshot
console.log("Taking screenshot")
await $webDriver.takeScreenshot()
console.log("2. waitForAndFindElement: " + loc.video)
const textBlock = await waitForAndFindElement(loc.video, IMPLICIT_TIMEOUT)
console.log("Script completed successfully")
```

console.log("3. getText: " + CHECK)
const text = await textBlock.getText()
Al emplear el monitor API con script, puede crear fácilmente un monitoreo de flujo de trabajo con Node.js y el módulo `got`. Por ejemplo, puede autenticar con una API y hacer valer el código de respuesta.

console.log("4. assert.equal: " + text)
assert.equal(text, CHECK, "validation text not found")
1. Vaya a

console.log("5. waitForAndFindElement: " + loc.start)
const platformMenu = await waitForAndFindElement(loc.start, IMPLICIT_TIMEOUT)
<DoNotTranslate>**[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Synthetic Monitoring**</DoNotTranslate>

console.log("6. takeScreenshot")
await $webDriver.takeScreenshot()
.

console.log("7. findElement")
loc.e.forEach(async function (nr, i) {
let n = i + 1
try{
// verify each asset has loaded
console.log(" " + n + ". " + nr.step + ": " + nr.selector)
await $webDriver.findElement(nr.selector)
}catch(exception){
console.error("Failure in Step 7." + n)
throw exception
}
})
2. Haga clic en el botón

// End logging
var end_time = new Date()
<DoNotTranslate>**Create monitor**</DoNotTranslate>

.

// Calculate the duration
var script_duration = end_time - start_time
3. Elija el tipo de monitor

// Log the times
console.log("Start time: " + start_time)
console.log("End time: " + end_time)
console.log("Duration: " + script_duration)
<DoNotTranslate>**Scripted API**</DoNotTranslate>

.

4. Ingrese un nombre, seleccione un tiempo de ejecución y seleccione un periodo para su monitor.

5. Seleccione las ubicaciones desde donde desea que se ejecute su monitor. Por ejemplo, Mumbai, Seúl, Columbus o Montreal.

6. Ahora está listo para escribir su script. Vea este script de ejemplo que realiza una solicitud de API y procesa la respuesta.

```js
/**
* Script Name: Best Practices Example - Node 16.10.0
* Author: New Relic
* Version: 1.0
* Purpose: A simple New Relic Synthetics scripted API monitor to make a GET request and assert on statusCode.
*/
const assert = require("assert")
// Get secure credentials
const applicationId = $secure.APP_ID
const apiKey = $secure.API_KEY
// The URL for the API endpoint to get information about a specific application
const URL = `https://api.newrelic.com/v2/applications/${applicationId}.json`
// Define headers, including the API key for authentication
const headers = {
"X-Api-Key": apiKey,
}
// Make a GET request
$http.get({ url: URL, headers: headers }, function (error, response, body) {
// If error handling is needed, check if an error occurred during the request
// if (error) {
// console.error("An error occurred:", error);
// Handle the error as needed, or rethrow to fail the monitor
// throw error;
// }
// Assert the response status code is 200
assert.equal(response.statusCode, 200, "Expected HTTP status code 200")
// Log the status code to the console
console.log("Request Status Code:", response.statusCode)
// If further processing of the response body is needed, it can be done here
// For example, parsing JSON response (if response is in JSON format)
// const jsonData =
// typeof body === "string"
// ? JSON.parse(body)
// : body
// Log the parsed JSON to the console
// console.log("Parsed JSON data:", jsonData)
// Check the application's health status
// const healthStatus = jsonData.application.health_status
// assert.equal(healthStatus, "green", "Expected the application's health status to be 'green'")
// If the assertion passes, the script will continue; otherwise, it will fail the monitor
})
```
</Step>
</Steps>
Loading

0 comments on commit dbef0fb

Please sign in to comment.