Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions e2e/components/datetime-format.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/components/datetime-format.html`
url(`/examples/${pattern}/components/datetime-format.html`)
)
})

test('rendering', async () => {
console.log(new Date())
expect(await getText(page, '#app p.p1')).toMatch(
/([1-9]|1[0-2])\/([1-9]|[12]\d|3[01])\/([12]\d{3})/
)
Expand Down
6 changes: 2 additions & 4 deletions e2e/components/number-format.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/components/number-format.html`
)
await page.goto(url(`/examples/${pattern}/components/number-format.html`))
})

test('rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/components/translation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/components/translation.html`
)
await page.goto(url(`/examples/${pattern}/components/translation.html`))
})

test('rendering', async () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/datetime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getText } from './helper'
import { getText, url } from './helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(`http://localhost:8080/examples/${pattern}/datetime.html`)
await page.goto(url(`/examples/${pattern}/datetime.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/directive/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/directive/basic.html`
)
await page.goto(url(`/examples/${pattern}/directive/basic.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/directive/object.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/directive/object.html`
)
await page.goto(url(`/examples/${pattern}/directive/object.html`))
})

test('rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/directive/plural.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/directive/plural.html`
)
await page.goto(url(`/examples/${pattern}/directive/plural.html`))
})

test('rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/directive/preserve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText, sleep } from '../helper'
import { getText, sleep, url } from '../helper'
;['composition', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/directive/preserve.html`
)
await page.goto(url(`/examples/${pattern}/directive/preserve.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/basic.html`
)
await page.goto(url(`/examples/${pattern}/fallback/basic.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/component.html`
)
await page.goto(url(`/examples/${pattern}/fallback/component.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/default-format.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -8,9 +8,7 @@ import { getText } from '../helper'
warnings.push(msg.text())
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/default-format.html`
)
await page.goto(url(`/examples/${pattern}/fallback/default-format.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/format.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/format.html`
)
await page.goto(url(`/examples/${pattern}/fallback/format.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/option.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/option.html`
)
await page.goto(url(`/examples/${pattern}/fallback/option.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/fallback/suppress.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/fallback/suppress.html`
)
await page.goto(url(`/examples/${pattern}/fallback/suppress.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/formatting/linked.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/formatting/linked.html`
)
await page.goto(url(`/examples/${pattern}/formatting/linked.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/formatting/list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/formatting/list.html`
)
await page.goto(url(`/examples/${pattern}/formatting/list.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/formatting/literal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/formatting/literal.html`
)
await page.goto(url(`/examples/${pattern}/formatting/literal.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/formatting/named.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/formatting/named.html`
)
await page.goto(url(`/examples/${pattern}/formatting/named.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/functions/linked.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/functions/linked.html`
)
await page.goto(url(`/examples/${pattern}/functions/linked.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/functions/list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/functions/list.html`
)
await page.goto(url(`/examples/${pattern}/functions/list.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/functions/named.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/functions/named.html`
)
await page.goto(url(`/examples/${pattern}/functions/named.html`))
})

test('initial rendering', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/functions/plural.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
beforeAll(async () => {
await page.goto(
`http://localhost:8080/examples/${pattern}/functions/plural.html`
)
await page.goto(url(`/examples/${pattern}/functions/plural.html`))
})

test('initial rendering', async () => {
Expand Down
15 changes: 15 additions & 0 deletions e2e/helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { JSDOM } from 'jsdom'
import { useTestContext } from '../scripts/test-utils'

import type { Page } from 'playwright-core'

Expand Down Expand Up @@ -73,3 +74,17 @@ export function assertLocaleHeadWithDom(dom: Document, headSelector: string) {
}
}
}

export function url(path: string) {
const ctx = useTestContext()

if (!ctx.url) {
throw new Error('url is not available (is server option enabled?)')
}

if (path.startsWith(ctx.url)) {
return path
}

return ctx.url + path
}
4 changes: 2 additions & 2 deletions e2e/hotfix.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getText } from './helper'
import { getText, url } from './helper'

describe('CVE-2024-52809', () => {
beforeAll(async () => {
await page.goto(`http://localhost:8080/e2e/hotfix/CVE-2024-52809.html`)
await page.goto(url(`/e2e/hotfix/CVE-2024-52809.html`))
})

test('fix', async () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/missing/handler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/missing/handler.html`
)
await page.goto(url(`/examples/${pattern}/missing/handler.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/missing/option.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/missing/option.html`
)
await page.goto(url(`/examples/${pattern}/missing/option.html`))
})

test('warning', () => {
Expand Down
6 changes: 2 additions & 4 deletions e2e/missing/suppress.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getText } from '../helper'
import { getText, url } from '../helper'
;['composition', 'petite', 'legacy'].forEach(pattern => {
describe(`${pattern}`, () => {
const warnings: string[] = []
Expand All @@ -11,9 +11,7 @@ import { getText } from '../helper'
}
}
})
await page.goto(
`http://localhost:8080/examples/${pattern}/missing/suppress.html`
)
await page.goto(url(`/examples/${pattern}/missing/suppress.html`))
})

test('warning', () => {
Expand Down
Loading