File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const theme = useThemeVars();
9
9
</script >
10
10
11
11
<template >
12
- <router-link :to =" tool.path" class =" decoration-none" >
12
+ <router-link :to =" tool.path" class =" it-tool-link decoration-none" >
13
13
<c-card class =" h-full transition transition-duration-0.5s !border-2px !hover:border-primary" >
14
14
<div flex items-center justify-between >
15
15
<n-icon class =" text-neutral-400 dark:text-neutral-600" size =" 40" :component =" tool.icon" />
Original file line number Diff line number Diff line change
1
+ import { expect , test } from '@playwright/test' ;
2
+
3
+ const ignoredHrefs = new Set ( [ '/camera-recorder' ] ) ;
4
+
5
+ test . describe ( 'IT Tool' , ( ) => {
6
+ test ( 'Loads all tools correctly' , async ( { page } ) => {
7
+ test . slow ( ) ;
8
+
9
+ const allTools : string [ ] = [ ] ;
10
+
11
+ await page . goto ( '/' ) ;
12
+ await page . waitForSelector ( '.it-tool-link' ) ;
13
+ const allLinks = await page . locator ( '.it-tool-link' ) . all ( ) ;
14
+ for ( const a of allLinks ) {
15
+ allTools . push ( ( await a . getAttribute ( 'href' ) ) || '/' ) ;
16
+ }
17
+
18
+ expect ( allTools . length ) . toBeGreaterThan ( 0 ) ;
19
+
20
+ const errors : Array < Error > = [ ] ;
21
+
22
+ page . on ( 'pageerror' , ( error ) => {
23
+ // ignore errors related to physical devices (ie camera recorder)
24
+ if ( error . message . match ( / R e q u e s t e d d e v i c e n o t f o u n d / ) ) {
25
+ return ;
26
+ }
27
+ errors . push ( error ) ;
28
+ } ) ;
29
+
30
+ for ( const toolHref of allTools ) {
31
+ if ( ignoredHrefs . has ( toolHref ) ) {
32
+ continue ;
33
+ }
34
+ await test . step ( toolHref , async ( ) => {
35
+ errors . splice ( 0 , errors . length ) ;
36
+
37
+ await page . goto ( toolHref ) ;
38
+ await page . waitForSelector ( '.tool-header' ) ;
39
+
40
+ await expect ( page ) . toHaveTitle ( / .+ - I T T o o l s / ) ;
41
+
42
+ expect ( errors , `${ toolHref } to have no JS error` ) . toHaveLength ( 0 ) ;
43
+ } ) ;
44
+ }
45
+ } ) ;
46
+ } ) ;
You can’t perform that action at this time.
0 commit comments