Skip to content

bamanczak/microsoft-graph-api-tests

Repository files navigation

Continuous Integration tests

Microsoft Graph API Tests

This is a Proof of Concept for Microsoft 365 test automation using Graph

Mocha, Chai, and Typescript

Test Automation framework designed using Mocha, Chai, and Typescript. It is based on framework developed by qaloop

Framework Structure

├───images
├───page-objects
├───test-suites
├───.gitignore
├───package.json
├───README.md
└───tslint.json

To Get Started

Pre-requisites

Setup Scripts

  • Clone the repository into a folder
  • Go to Project root directory and install Dependency: npm install
  • All the dependencies from package.json and ambient typings would be installed in node_modules folder.

Setup Test Accounts and App

Setup Environment Variables

For security reasons, the data required to authenticate to the Microsoft Graph are stored as environment variables (and github secrets for CI). The following Environment variables are needed for tests to run correctly:

  • CLIENT_ID - ID of your OAuth App
  • CLIENT_SECRET - Secret key for your OAuth App
  • USER1_EMAIL - email (and login) for 1st test user
  • USER1_PASSWORD- password for 1st test user
  • USER2_EMAIL - email (and login) for 2nd test user
  • USER2_PASSWORD- password for 2nd test user

How to Run Test

  • Run complete Test Suite: npm test

Test results in Console

How to Update local npm packages

  • Go to Project root directory and run command: npm update

Sample HTML Report With Test Results

Mocha, Chai, and Typescript Test Result

Continuous Integration

CI was configured using GitHub Actions. The configuration file is stored in .github/workflows/ci.yml. CI job is triggered after each commit. CI stores test artifacts in GitHub, which can be accessed in the Actions tab for individual test runs.

To see a failing CI build you can see it on a Sample Pull Request in this repository. Sample failing CI build

About

PoC of Microsoft 365 tests using Graph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published