import { test, expect } from '@playwright/test'

//Primeiro teste  para verificar se o título da página é Creative Discovery
test('Has Title About Creative Discovery', async ({page})=>{
    await page.goto('http://localhost:3000');
    await expect(page).toHaveTitle(/Creative Discovery/)
})

// Verifica se o logo foi carregado
test('Has The logo', async ({page}) => { 
    await page.goto('http://localhost:3000/');
    await page.getByAltText('creative discovery logo').screenshot({path:'./../test-results/logoss.png'});
 })

 // It will navigate through all pages .
 test('Menu is working', async ({page})=>{
    await page.goto('http://localhost:3000');
    await page.getByText('Sobre Nós').click();
    await page.goBack();
    await page.getByText('Serviços').click();
    await page.goBack();
    await page.getByText('Parceiros').click();
    await page.goBack();
 })


 //Projects is not finished, This test must fail 
 test('Projects throw 404',async ({page})=>{
    await page.goto('http://localhost:3000');
    await page.getByText('Projetos').click();
    test.fail()
 })

 test('Found Text from the API',async ({page})=>{
   await page.goto('http://localhost:3000/aboutus');
   await page.getByText('Projetos').click();
})

