MCPcopy
hub / github.com/vercel/next.js / tests

Function tests

test/integration/css/test/css-modules.test.ts:41–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 let app, appPort
40
41 function tests() {
42 async function checkGreenButton(browser) {
43 await browser.waitForElementByCss('#link-other')
44 const titleColor = await browser.eval(
45 `window.getComputedStyle(document.querySelector('#link-other')).backgroundColor`
46 )
47 expect(titleColor).toBe('rgb(0, 255, 0)')
48 }
49 async function checkPinkButton(browser) {
50 await browser.waitForElementByCss('#link-index')
51 const titleColor = await browser.eval(
52 `window.getComputedStyle(document.querySelector('#link-index')).backgroundColor`
53 )
54 expect(titleColor).toBe('rgb(255, 105, 180)')
55 }
56
57 it('should have correct color on index page (on load)', async () => {
58 const browser = await webdriver(appPort, '/')
59 try {
60 await checkGreenButton(browser)
61 } finally {
62 await browser.close()
63 }
64 })
65
66 it('should have correct color on index page (on hover)', async () => {
67 const browser = await webdriver(appPort, '/')
68 try {
69 await checkGreenButton(browser)
70 await browser.waitForElementByCss('#link-other').moveTo()
71 await waitFor(2000)
72 await checkGreenButton(browser)
73 } finally {
74 await browser.close()
75 }
76 })
77
78 it('should have correct color on index page (on nav)', async () => {
79 const browser = await webdriver(appPort, '/')
80 try {
81 await checkGreenButton(browser)
82 await browser.waitForElementByCss('#link-other').click()
83
84 // Wait for navigation:
85 await browser.waitForElementByCss('#link-index')
86 await checkPinkButton(browser)
87
88 // Navigate back to index:
89 await browser.waitForElementByCss('#link-index').click()
90 await checkGreenButton(browser)
91 } finally {
92 await browser.close()
93 }
94 })
95 }
96
97 ;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
98 'Development Mode',

Callers 1

Calls 13

waitForFunction · 0.90
webdriverFunction · 0.85
checkGreenButtonFunction · 0.85
checkPinkButtonFunction · 0.85
moveToMethod · 0.80
waitForElementByCssMethod · 0.80
clickMethod · 0.80
evalMethod · 0.80
checkBlackTitleFunction · 0.70
checkRedTitleFunction · 0.70
closeMethod · 0.65
itFunction · 0.50

Tested by

no test coverage detected