2022-10-24 21:12:53 +02:00
|
|
|
const { test, expect } = require('@playwright/test');
|
2022-10-27 19:53:04 +02:00
|
|
|
const { faker } = require('@faker-js/faker');
|
2022-10-24 21:12:53 +02:00
|
|
|
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();
|
2022-10-26 18:29:37 +02:00
|
|
|
await expect(homePage.loadSampleCollectionToastSuccess).toBeVisible();
|
2022-10-24 21:12:53 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2022-10-26 18:29:37 +02:00
|
|
|
test('user should be able to create new collection', async () => {
|
2022-10-27 19:53:04 +02:00
|
|
|
await homePage.createCollection(faker.random.words());
|
2022-10-26 18:29:37 +02:00
|
|
|
await expect(homePage.createCollectionToastSuccess).toBeVisible();
|
|
|
|
})
|
|
|
|
|
2022-10-24 21:12:53 +02:00
|
|
|
});
|