add e2e test using playwright (#44)

This commit is contained in:
depa panjie purnama
2022-10-25 02:12:53 +07:00
committed by GitHub
parent 0fceaf6918
commit dc68d511bd
6 changed files with 227 additions and 1 deletions

34
tests/home.spec.js Normal file
View File

@ -0,0 +1,34 @@
const { test, expect } = require('@playwright/test');
const { HomePage } = require('../tests/pages/home.page');
test.describe('bruno e2e test', () => {
let homePage;
test.beforeEach(async ({ page }) => {
homePage = new HomePage(page);
await homePage.open();
await expect(page).toHaveURL('/');
await expect(page).toHaveTitle(/bruno/);
});
test('user should be able to load & use sample collection', async () => {
await homePage.loadSampleCollection();
await homePage.getUsers();
await expect(homePage.statusRequestSuccess).toBeVisible();
await homePage.getSingleUser();
await expect(homePage.statusRequestSuccess).toBeVisible();
await homePage.getUserNotFound();
await expect(homePage.statusRequestNotFound).toBeVisible();
await homePage.createUser();
await expect(homePage.statusRequestCreated).toBeVisible();
await homePage.updateUser();
await expect(homePage.statusRequestSuccess).toBeVisible();
});
});