mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
110 lines
4.5 KiB
TypeScript
110 lines
4.5 KiB
TypeScript
import { environment } from '../src/environments/environment'
|
|
import { loginTest } from './login.spec'
|
|
import * as faker from 'faker';
|
|
|
|
faker.locale = "pt_PT";
|
|
|
|
function sleep(milliseconds) {
|
|
const date = Date.now();
|
|
let currentDate = null;
|
|
do {
|
|
currentDate = Date.now();
|
|
} while (currentDate - date < milliseconds);
|
|
}
|
|
|
|
|
|
describe('Puppeteer tests', () => {
|
|
|
|
beforeAll(async () => {
|
|
// await page.goto(process.env.PUPPETEER_HOST)
|
|
})
|
|
|
|
// test('Login', async()=> {
|
|
// await loginTest(page)
|
|
// },30000)
|
|
|
|
// test('[table] Open create event component', async () => {
|
|
|
|
// await page.setViewport({width: 1200, height: 720});
|
|
// await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
|
// await page.waitForSelector('ion-app')
|
|
|
|
// // wait for footer button
|
|
// await page.click('ion-tab-bar ion-tab-button:nth-child(2)')
|
|
// await page.waitForSelector('app-agenda')
|
|
|
|
// // click add event
|
|
// await page.click('ion-content ion-row .cy-add-event')
|
|
// // wait for component
|
|
// await page.waitForSelector('app-new-event')
|
|
|
|
// expect(3 + 2).toBe(5);
|
|
// },30000);
|
|
|
|
|
|
// test('[table] Create Event', async () => {
|
|
|
|
// await page.setViewport({width: 1200, height: 720});
|
|
// await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
|
// await page.waitForSelector('ion-app')
|
|
|
|
// // wait for footer button
|
|
// await page.click('ion-tab-bar ion-tab-button:nth-child(2)')
|
|
// await page.waitForSelector('app-agenda')
|
|
// // click add event
|
|
// await page.click('ion-content ion-row .cy-add-event')
|
|
// // wait for component
|
|
// await page.waitForSelector('app-new-event')
|
|
|
|
// // subject
|
|
// await page.type('app-new-event .ion-item-container input', faker.commerce.productDescription() )
|
|
// // Location
|
|
// await page.type('app-new-event .container-div:nth-child(2) input', faker.address.state()+" "+faker.address.city() )
|
|
// // Select Calendar
|
|
// // await page.click('app-new-event .container-div:nth-child(3) .mat-form-field-flex')
|
|
// // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
|
|
// // await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
|
|
// // select event type
|
|
// // await page.click('app-new-event .container-div:nth-child(4) .mat-form-field-flex')
|
|
// // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
|
|
// // await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
|
|
|
|
// // select start day
|
|
// // await page.click('app-new-event .container-div:nth-child(5) button')
|
|
// // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
|
|
// // await page.click('.mat-calendar-next-button')
|
|
// // let selectedFDay = Math.floor(Math.random()*(25-1+1)+1);
|
|
// // let days = await page.$$(` .mat-calendar-body-cell `)
|
|
// // await days[selectedFDay].click()
|
|
// // await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
|
|
|
|
// // select end day
|
|
// // await page.click('app-new-event .container-div:nth-child(6) button')
|
|
// // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
|
|
// // await page.click('.mat-calendar-next-button')
|
|
// // days = await page.$$(` .mat-calendar-body-cell `)
|
|
// // await days[selectedFDay+1].click()
|
|
// // await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
|
|
|
|
// // await page.click('app-new-event .container-div:nth-child(7) .mat-form-field-flex')
|
|
// // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
|
|
// // await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
|
|
|
|
// await page.click('app-new-event .container-div:nth-child(8) .add-people')
|
|
// await page.waitForSelector('app-attendee-modal .ng-star-inserted:nth-child(2)')
|
|
// await page.click('app-attendee-modal .ng-star-inserted:nth-child(2)')
|
|
// // save
|
|
// await page.click('app-attendee-modal ion-footer ion-buttons:nth-child(2)')
|
|
// // save
|
|
// let buttons = await page.$$('app-new-event ion-footer ion-buttons')
|
|
// buttons[1].click()
|
|
|
|
// await page.waitForSelector('.notification .success')
|
|
|
|
|
|
// expect(3 + 2).toBe(5);
|
|
// },60000);
|
|
|
|
});
|
|
|