Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify test checks #14094

Merged
merged 2 commits into from
Jun 11, 2020
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
59 changes: 12 additions & 47 deletions test/integration/config/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ describe('Configuration', () => {

await check(
() => browser.elementByCss('.hello-world').getComputedCss('font-size'),
{
test(content) {
return content === '100px'
},
}
'100px'
)
} finally {
if (browser) {
Expand All @@ -75,11 +71,7 @@ describe('Configuration', () => {
browser
.elementByCss('.hello-world')
.getComputedCss('background-color'),
{
test(content) {
return content === 'rgba(0, 0, 255, 1)'
},
}
'rgba(0, 0, 255, 1)'
)
} finally {
if (browser) {
Expand Down Expand Up @@ -128,18 +120,11 @@ describe('Configuration', () => {
try {
browser = await webdriver(context.appPort, '/webpack-css')

await check(
async () => {
const pTag = await browser.elementByCss('.hello-world')
const initialFontSize = await pTag.getComputedCss('font-size')
return initialFontSize
},
{
test(content) {
return content === '100px'
},
}
)
await check(async () => {
const pTag = await browser.elementByCss('.hello-world')
const initialFontSize = await pTag.getComputedCss('font-size')
return initialFontSize
}, '100px')

const pagePath = join(
__dirname,
Expand All @@ -159,11 +144,7 @@ describe('Configuration', () => {
await check(
() =>
browser.elementByCss('.hello-world').getComputedCss('font-size'),
{
test(content) {
return content === '200px'
},
}
'200px'
)
} finally {
// Finally is used so that we revert the content back to the original regardless of the test outcome
Expand All @@ -173,11 +154,7 @@ describe('Configuration', () => {
await check(
() =>
browser.elementByCss('.hello-world').getComputedCss('font-size'),
{
test(content) {
return content === '100px'
},
}
'100px'
)
}
} finally {
Expand All @@ -196,32 +173,20 @@ describe('Configuration', () => {
browser = await webdriver(context.appPort, '/webpack-css')
await check(
() => browser.elementByCss('.hello-world').getComputedCss('color'),
{
test(content) {
return content === 'rgba(255, 255, 0, 1)'
},
}
'rgba(255, 255, 0, 1)'
)

try {
file.replace('yellow', 'red')
await check(
() => browser.elementByCss('.hello-world').getComputedCss('color'),
{
test(content) {
return content === 'rgba(255, 0, 0, 1)'
},
}
'rgba(255, 0, 0, 1)'
)
} finally {
file.restore()
await check(
() => browser.elementByCss('.hello-world').getComputedCss('color'),
{
test(content) {
return content === 'rgba(255, 255, 0, 1)'
},
}
'rgba(255, 255, 0, 1)'
)
}
} finally {
Expand Down
6 changes: 1 addition & 5 deletions test/integration/css/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,7 @@ describe('CSS Support', () => {
browser.eval(
`window.getComputedStyle(document.querySelector('.red-text')).color`
),
{
test(content) {
return content === 'rgb(128, 0, 128)'
},
}
'rgb(128, 0, 128)'
)

// ensure text remained
Expand Down