1
- import { test , expect } from '@playwright/test ' ;
1
+ import { test , expect } from '../lib/fixtures/screenshot ' ;
2
2
import { config } from 'dotenv' ;
3
3
import path = require( 'path' ) ;
4
4
config ( { path : path . resolve ( __dirname , '..' , '.env' ) } ) ;
5
5
6
- const date = new Date ( ) ;
7
-
8
- test . beforeEach ( async ( { page } ) => {
9
- await page . goto ( '/' ) ;
10
- await page . getByRole ( 'button' , { name : 'Continue With Email' } ) . click ( ) ;
11
- await page . getByPlaceholder ( 'Email' ) . fill ( process . env . DEFAULT_LOGIN ) ;
12
- await page . getByRole ( 'button' , { name : 'Continue' , exact : true } ) . click ( ) ;
13
- await page . getByPlaceholder ( 'Password' ) . fill ( process . env . DEFAULT_PASSWORD ) ;
14
- await page . getByRole ( 'button' , { name : 'Sign in' } ) . click ( ) ;
15
- await expect ( page . getByText ( 'Welcome to Twenty' ) ) . not . toBeVisible ( ) ;
16
- } ) ;
17
-
18
- test . afterEach ( async ( { page, browserName } , workerInfo ) => {
19
- await page . screenshot ( {
20
- path : path . resolve (
21
- __dirname ,
22
- '..' ,
23
- 'results' ,
24
- 'screenshots' ,
25
- browserName ,
26
- `${ workerInfo . project . name } ` ,
27
- `${ date . toISOString ( ) } .png` ,
28
- ) ,
29
- } ) ;
30
- } ) ;
31
-
32
6
test . describe ( 'Basic check' , ( ) => {
33
7
test ( 'Checking if table in Companies is visible' , async ( { page } ) => {
34
8
await expect ( page . getByTestId ( 'tooltip' ) . nth ( 0 ) ) . toHaveText ( 'Companies' ) ;
@@ -37,4 +11,9 @@ test.describe('Basic check', () => {
37
11
await expect ( page . locator ( 'table' ) ) . toBeVisible ( ) ;
38
12
await expect ( page . locator ( 'tbody > tr' ) ) . toHaveCount ( 13 ) ; // shouldn't be hardcoded in case of tests on demo
39
13
} ) ;
14
+
15
+ test ( '' , async ( { page } ) => {
16
+ await page . getByRole ( 'link' , { name : 'Opportunities' } ) . click ( ) ;
17
+ await expect ( page . locator ( 'table' ) ) . toBeVisible ( ) ;
18
+ } ) ;
40
19
} ) ;
0 commit comments