Skip to content
New issue

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

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

Already on GitHub? # to your account

Add ability to configure playwright in test file #233

Merged
merged 6 commits into from
Jul 22, 2020

Conversation

mmarkelov
Copy link
Member

@mmarkelov mmarkelov commented Jul 18, 2020

#216

Seems to be a bit challenging to implement this in a nice way. IDK if it will be helpful to configure playwright for just one test. The only founded solution was to use isolation playwright configuration.
It will be smth like that:

describe('Simple tests',  () => {
    beforeAll(async () => {
        await page.goto('https://google.com/')
    })

    test('test1', async () => {
        await jestPlaywright.config({
            browser: 'chromium',
            launchType: "LAUNCH",
            launchOptions: {
                headless: false,
                devtools: true,
            }
        }, async ({page}) => {
            // page is coming from function params
            await page.goto('https://github.com/')
            const title = await page.title()
            expect(title).toBe('Google')
        })
    })

    test('test2', async () => {
        const title = await page.title()
        expect(title).toBe('Google')
    })

    afterAll(async () => {
        await page.close()
    });
})

Also IDK the way of passing config. Should we merge jest-playwright config or we should use only config, passed throw jestPlaywright.config function

@github-actions
Copy link

Pull Request Test Coverage Report for Build 174589989

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.568%

Totals Coverage Status
Change from base Build 172400152: 0.0%
Covered Lines: 89
Relevant Lines: 94

💛 - Coveralls

@mmarkelov mmarkelov marked this pull request as ready for review July 22, 2020 13:46
@mmarkelov mmarkelov requested a review from mxschmitt as a code owner July 22, 2020 13:46
@mmarkelov mmarkelov merged commit 07c4d72 into master Jul 22, 2020
@mmarkelov mmarkelov deleted the Add-ability-to-configurate-playwright-in-test-file branch July 22, 2020 18:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant