Comments (10)
@dgozman Can you please update your code example for playwright/test 0.1102.0 ?
At
import { PlaywrightEnv, newTestType, setConfig, TestInfo } from "@playwright/test";
the three imports PlaywrightEnv
, newTestType
, setConfig
no longer exist.
Would like to follow you on the way to 1.0 by adjusting what we already have.
from playwright-test.
We have changed the underlying Folio from fixtures to environments. Sorry for the temporary hiatus - we'll become stable with v1.0 release. Let me write a snippet for you for now, and we'll update documentation soon. Following the write a configuration file section, here is an example config that gives you POM:
// config.ts
import { PlaywrightEnv, newTestType, setConfig, TestInfo } from "@playwright/test";
setConfig({
testDir: __dirname, // Search for tests in this directory.
timeout: 30000, // Each test is given 30 seconds.
});
// Extend the default environment to add any test arguments, for example POMs.
class MyEnv extends PlaywrightEnv {
async beforeEach(testInfo: TestInfo) {
// Get all default arguments, including Page.
const result = await super.beforeEach(testInfo);
// Create your POM.
const indexPage = new IndexPage(result.page, baseURL);
// Return default arguments and new POM.
return { ...result, indexPage };
}
}
// Declare "indexPage" test argument for types in IDE.
export const test = newTestType<{ indexPage: IndexPage }>();
export { expect } from "@playwright/test";
// Run tests in three browsers.
const options = {
headless: true, // Run tests in headless browsers.
viewport: { width: 1280, height: 720 },
};
test.runWith(new MyEnv('chromium', options), { tag: 'chromium' });
test.runWith(new MyEnv('firefox', options), { tag: 'firefox' });
test.runWith(new MyEnv('webkit', options), { tag: 'webkit' });
Now you can use the test
from the configuration file:
// foo.spec.ts
import { test, expect } from './config';
test('my test', async ({ indexPage }) => {
});
Let me know whether this works for you. Note that we are open for suggestions and work on improving test ergonomics.
from playwright-test.
@dgozman Do I understand correctly if one wants to use one's own class MyEnv extends PlaywrightEnv
then one must not use ChromiumEnv
, FirefoxEnv
, and WebKitEnv
currently mentioned in the README.md
? Maybe those three browser-named Env
as they exist today effectively are class hierarchy cul-de-sacs that shouldn't exist because it will be a perplexing situation for anyone who tries figuring how to build on top of them?
from playwright-test.
@dgozman Thank you for sending that over. Took a while to figure out fixtures properly so I was a bit worried that work was for naught.
The new config process looks promising. I wasn't clear what the TestInfo was but your comments make it more clear. I'm looking forward to the refreshed documentation down the road!
Thanks again. I'm working a lot with Playwright so I'll send some more info down the road as they come. Great stuff so far.
from playwright-test.
@srguiwiz Thank you for the feedback, we'll look into it.
from playwright-test.
@dgozman Can you please update your code example for playwright/test 0.1102.0 ?
At
import { PlaywrightEnv, newTestType, setConfig, TestInfo } from "@playwright/test";the three imports
PlaywrightEnv
,newTestType
,setConfig
no longer exist.Would like to follow you on the way to 1.0 by adjusting what we already have.
I second it.
from playwright-test.
I haven't checked myself but it seems from the comments that the config for v0.1102.0 is different from v0.1101.0. I understand the project is still in development though.
I'm working on a project to use playwright-test in a larger organization. Is there a roadmap I can follow / estimated time frame that the stable v1.0 might be available? This timeline affects the stakeholders of my project so any info would be appreciated, (instead of refactoring during this time).
from playwright-test.
@BillyBolton As original reporter of this issue you can reopen it.
from playwright-test.
Reopening due to popular demand 😉
(With hesitation -- I understand we're still in unstable versions.)
from playwright-test.
We now have an official example for using the POM pattern with the new test-runner which got released yesterday. See here for the example.
from playwright-test.
Related Issues (20)
- How to reference types? HOT 2
- No more fixtures mentioned in README, no more baseFolio HOT 4
- Error: Configuration file not found. Either pass --config, or create folio.config.(js|ts) file HOT 2
- Bug(?): Webkit support on Ubuntu HOT 3
- Issue when creating tests at runtime
- PlaywrightEnv subclasses HOT 1
- Release notes/changelog? HOT 1
- Add example how to use it with device emulation HOT 1
- When there are failed tests test execution process as a whole is marked as failed with status 1 HOT 1
- screenshot not working while setting up options HOT 1
- Add option to set devtools flag to true HOT 1
- Support proxy in param HOT 14
- npx folio --help first reads files HOT 2
- Support for specific Browser flavour HOT 1
- 0.1110.0 has breaking changes with no migration guide? HOT 2
- browser.newContext: options.isMobile is not supported in Firefox HOT 1
- Target Closed HOT 1
- QUESTION: Is there any roadmap for 1.0 playwright-test release? HOT 2
- The "it is not a function" error HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playwright-test.