Skip to content

Commit

Permalink
try url explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed May 26, 2024
1 parent d79db2e commit d334f55
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/e2e/tests/scoutcloud/ScoutCloud.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import winston from "winston"

const logLevel = `info`

const url = process.env.SCOUTCLOUD_URL

const l = winston.createLogger({
level: logLevel,
format: winston.format.simple(),
Expand All @@ -25,7 +27,7 @@ const l = winston.createLogger({
test.describe.configure({ mode: `parallel` })

const createInstance = async (r, cfg) => {
const response = await r.post(`/api/v1/instances`, {
const response = await r.post(`${url}/api/v1/instances`, {
data: cfg,
})
const bodyJSON = await response.json()
Expand All @@ -36,7 +38,7 @@ const createInstance = async (r, cfg) => {
}

const getInstances = async (r) => {
const response = await r.get(`/api/v1/instances`)
const response = await r.get(`${url}/api/v1/instances`)
const bodyJSON = await response.json()
l.info(`url requested: ${response.url()}`)
l.info(`body: ${await response.body()}`)
Expand All @@ -45,7 +47,7 @@ const getInstances = async (r) => {
}

const getInstance = async (r, instance) => {
const resp = await r.get(`/api/v1/instances/${instance}`)
const resp = await r.get(`${url}/api/v1/instances/${instance}`)
const body = await resp.body()
l.debug(`url requested: ${resp.url()}`)
l.debug(`body: ${body}`)
Expand All @@ -55,7 +57,7 @@ const deleteInstances = async (r, instances) => {
for (const i of instances[`items`]) {
l.info(`Removing instance: ${i[`instance_id`]}`)
// eslint-disable-next-line no-await-in-loop
const resp = await r.delete(`/api/v1/instances/${i[`instance_id`]}`)
const resp = await r.delete(`${url}/api/v1/instances/${i[`instance_id`]}`)
// eslint-disable-next-line no-await-in-loop
const body = await resp.body()
l.debug(`url requested: ${resp.url()}`)
Expand All @@ -64,7 +66,7 @@ const deleteInstances = async (r, instances) => {
}

const updateStatus = async (r, instance, cfg) => {
const resp = await r.post(`/api/v1/instances/${instance}/status:update`, {
const resp = await r.post(`${url}/api/v1/instances/${instance}/status:update`, {
data: cfg,
})
const body = await resp.body()
Expand All @@ -75,7 +77,7 @@ const updateStatus = async (r, instance, cfg) => {
}

const getDeployment = async (r, deployment) => {
const resp = await r.get(`/api/v1/deployments/${deployment}`)
const resp = await r.get(`${url}/api/v1/deployments/${deployment}`)
const body = await resp.body()
const bodyJSON = await resp.json()
l.debug(`url requested: ${resp.url()}`)
Expand Down Expand Up @@ -103,7 +105,7 @@ const waitForStatus = async (r, deployment, requiredStatus, waitMillis, retries)
}

const getInstanceDeployments = async (r, instance) => {
const resp = await r.get(`/api/v1/instances/${instance}/deployments`)
const resp = await r.get(`${url}/api/v1/instances/${instance}/deployments`)
const body = await resp.body()
l.debug(`url requested: ${resp.url()}`)
l.debug(`body: ${body}`)
Expand All @@ -117,7 +119,7 @@ const getInstanceDeployments = async (r, instance) => {
// expect(response.ok()).toBeTruthy()
// })

// test(`@ScoutCloud Clean up all instances`, async ({ request }) => {
// test.only(`@ScoutCloud Clean up all instances`, async ({ request }) => {
// const instances = await getInstances(request)
// l.info(`Instances: ${JSON.stringify(instances, null, 2)}`)
// await deleteInstances(request, instances)
Expand Down Expand Up @@ -147,9 +149,9 @@ test(`@ScoutCloud Create New Instance, check UI, delete it`, async ({ request, n
const deploymentID = await updateStatus(request, instanceID, { action: `START` })
await waitForStatus(request, deploymentID, `RUNNING`, 10000, 50)
const status = await getDeployment(request, deploymentID)
const url = status[`blockscout_url`]
const bsURL = status[`blockscout_url`]
l.info(`Blockscout URL: ${status[`blockscout_url`]}`)
await newHomePage.open_custom(url)
await newHomePage.open_custom(bsURL)
await newHomePage.checkIndexing()
await newHomePage.checkHeader()
await newHomePage.checkBlocksWidget()
Expand Down

0 comments on commit d334f55

Please sign in to comment.