Skip to content

Instantly share code, notes, and snippets.

@adikuntjara
Last active February 22, 2021 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adikuntjara/3c99914f66356c61fe7dcd92b4ef0103 to your computer and use it in GitHub Desktop.
Save adikuntjara/3c99914f66356c61fe7dcd92b4ef0103 to your computer and use it in GitHub Desktop.
get_movie_list_test.js
const assert = require('chai').expect;
const code = require('../../../qa_test/api/helper/reponse_code_message.json')
const data = require('../../../qa_test/api/data/get_movie_list_data.json')
const page = require('../../../qa_test/api/page/get_movie_list_page.js');
const testCase = {
"positive": {
"getList": "As a User, I want to be able to get OMDB Movie list",
},
"negative": {
"noSearch": "As a User, I should got error message when I send request without key of search",
"invalidApiKey": "As a User, I should got error 401 when I send request with invalid API Key"
}
}
describe(`OMDB Movie List`, () => {
it(`@get ${testCase.positive.getList}`, async () => {
const response = await page.getMovieList(data.apiKey, data.keySearch);
assert(response.status).to.equal(code.successOk, response.body.message);
}),
it(`@get ${testCase.negative.noSearch}`, async () => {
const response = await page.getMovieList(data.apiKey, '');
assert(response.status).to.equal(code.successOk, response.body.message);
assert(response.body.Response).to.equal('False');
assert(response.body.Error).to.equal('Incorrect IMDb ID.');
}),
it(`@get ${testCase.negative.invalidApiKey}`, async () => {
const response = await page.getMovieList(data.invalidApiKey, data.keySearch);
assert(response.status).to.equal(code.failedUnauthorized.codeNumber, response.body.message);
assert(response.body.Response).to.equal('False');
assert(response.body.Error).to.equal('Invalid API key!');
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment