-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated nightly.yml; code formattting
- Loading branch information
Showing
5 changed files
with
101 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
name: Doc-AI Test Automation (Nightly) | ||
name: Test Execution (Nightly) | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Scheduled to execute at 10:00 PM in UTC which means 12:00 AM in CEST (Day-light Saving) | ||
- cron: 0 9 * * 1,2,3,4,5 | ||
|
||
env: | ||
ENV_NAME: "stg" | ||
TAGS: "@login" | ||
ENV_NAME: "qa" | ||
TAGS: "@all" | ||
|
||
jobs: | ||
nightly_run: | ||
|
@@ -30,14 +30,14 @@ jobs: | |
run: npm install | ||
|
||
# Execute automated tests nightly and send execution summary to cypress cloud dashboard | ||
- name: Doc-AI Test Automation Nightly Execution | ||
- name: Test Execution Nightly Execution | ||
id: run_step | ||
uses: cypress-io/[email protected] | ||
continue-on-error: true | ||
with: | ||
install: false | ||
record: true | ||
command: node runner.js cypress run --e2e --env envFile=${{ env.ENV_NAME }},TAGS=${{ env.TAGS }} --record --key ${{ secrets.DOC_AI_TESTING_CYPRESS_RECORD_KEY }} --tag "nightly" | ||
command: node runner.js cypress run --e2e --env envFile=${{ env.ENV_NAME }},TAGS=${{ env.TAGS }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --tag "nightly" | ||
|
||
# Cypress Test Result Details | ||
- name: Print Cypress Cloud URL | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
Given('As a user I want to execute Pokemon GET api for Pokemon {string}', (pokename) => { | ||
cy.request({ | ||
method: 'GET', | ||
url: 'https://pokeapi.co/api/v2/pokemon/' + pokename, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
failOnStatusCode:false | ||
}).as('get_pokemon_data') | ||
}); | ||
Then('Verify {string} response status code is {int}', (requestAliasName, statusCode) => { | ||
cy.get(`${requestAliasName}`).should((response)=> { | ||
expect(response.status).to.eq(statusCode); | ||
}) | ||
}); | ||
|
||
Then('Verify response details for Pokemon {string}', (pokename) => { | ||
cy.get('@get_pokemon_data').then((response)=> { | ||
expect(response.body).to.have.property('abilities'); | ||
//Different ways of validating nested properties | ||
//1st Way | ||
expect(response.body).to.have.nested.property('forms[0].name','pikachu'); | ||
//2nd Way | ||
expect(response.body.forms[0]).to.have.property('name','pikachu'); | ||
//3rd Way | ||
const name = response.body.forms[0].name; | ||
assert.equal(name, pokename.toLowerCase()); | ||
expect(response).to.have.property('headers'); | ||
|
||
}) | ||
}); | ||
|
||
When('I save the user id in Test Store', () => { | ||
cy.get('@get_pokemon_data').then((response)=> { | ||
//save pokemon id | ||
cy.saveState("PokemonData>PokemonID", response.body.id) | ||
}) | ||
}); | ||
|
||
When('I make a GET request on {string} endpoint with the stored id', () => { | ||
cy.getState("PokemonData>PokemonID").then(pokeID => { | ||
cy.request({ | ||
method: 'GET', | ||
url: 'https://pokeapi.co/api/v2/pokemon/' + pokeID, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
failOnStatusCode:false | ||
}).as('get_pokemon_data_by_id') | ||
}) | ||
}); | ||
cy.request({ | ||
method: 'GET', | ||
url: 'https://pokeapi.co/api/v2/pokemon/' + pokename, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
failOnStatusCode: false | ||
}).as('get_pokemon_data') | ||
|
||
}) | ||
|
||
Then('Verify {string} response status code is {int}', (requestAliasName, statusCode) => { | ||
cy.get(`${requestAliasName}`).should((response) => { | ||
expect(response.status).to.eq(statusCode) | ||
|
||
}) | ||
}) | ||
|
||
Then('Verify response details for Pokemon {string}', (pokename) => { | ||
cy.get('@get_pokemon_data').then((response) => { | ||
|
||
expect(response.body).to.have.property('abilities') | ||
//Different ways of validating nested properties | ||
//1st Way | ||
expect(response.body).to.have.nested.property('forms[0].name', 'pikachu') | ||
//2nd Way | ||
expect(response.body.forms[0]).to.have.property('name', 'pikachu') | ||
//3rd Way | ||
const name = response.body.forms[0].name; | ||
assert.equal(name, pokename.toLowerCase()) | ||
|
||
expect(response).to.have.property('headers') | ||
|
||
|
||
}) | ||
}) | ||
|
||
When('I save the user id in Test Store', () => { | ||
cy.get('@get_pokemon_data').then((response) => { | ||
//save pokemon id | ||
cy.saveState("PokemonData>PokemonID", response.body.id) | ||
}) | ||
|
||
}) | ||
|
||
When('I make a GET request on {string} endpoint with the stored id', () => { | ||
cy.getState("PokemonData>PokemonID").then(pokeID => { | ||
cy.request({ | ||
method: 'GET', | ||
url: 'https://pokeapi.co/api/v2/pokemon/' + pokeID, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
failOnStatusCode: false | ||
}).as('get_pokemon_data_by_id') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
Given('I execute select all query on pokemon DB',() => { | ||
cy.task("DATABASE", { | ||
dbConfig: Cypress.env("DB"), | ||
sql: ` | ||
Given('I execute select all query on pokemon DB', () => { | ||
cy.task("DATABASE", { | ||
dbConfig: Cypress.env("DB"), | ||
sql: ` | ||
select * from pokemon | ||
` | ||
}).then((result) => { | ||
console.log(result.rows) | ||
}); | ||
}); | ||
}).then((result) => { | ||
console.log(result.rows) | ||
}) | ||
}) | ||
|
||
When('I execute selet query on pokemon DB, where name equals {string}',(pokemonName) => { | ||
cy.task("DATABASE", { | ||
dbConfig: Cypress.env("DB"), | ||
sql: ` | ||
When('I execute selet query on pokemon DB, where name equals {string}', (pokemonName) => { | ||
cy.task("DATABASE", { | ||
dbConfig: Cypress.env("DB"), | ||
sql: ` | ||
select * from pokemon where Poke_Name = '${pokemonName}' | ||
` | ||
}).then((result) => { | ||
console.log(result.rows[0]); | ||
expect(result.rows[0].Poke_Name).to.have.string(`${pokemonName}`); | ||
}); | ||
}); | ||
}).then((result) => { | ||
console.log(result.rows[0]) | ||
expect(result.rows[0].Poke_Name).to.have.string(`${pokemonName}`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters