lukdur
(Lukas Durec)
15 April 2024 11:56
1
I have a question in my project, like what is the good practice for page objects in case of - method of creating a new object, instead of using static
?
2 Likes
ipstefan
(Stefan Papusoi)
16 April 2024 08:21
2
Hi,
Can you develop the question and add a piece of code where you have an issue?
Cypress documentation refers to two pieces of info regarding POM:
2 Likes
Hi @lukdur , welcome to the MOT community.
I have not used Cypress myself, and your question seems to indicate you need to learn about factory pattern as well still, because the generic factory-pattern will partialy answer that question I suspect, but it is fairly advanced to start.
But there are some MOT threads about the pageobject problem-space.
In our Slack Ask Me Anything with @marie.drake and Filip Hric, @ziad_tawfeek asked
Have you tried to migrate test suites from a Selenium-based framework to Cypress? How easy it is to do so, any insights also on obstacles faced on that road?
@jainkat responded with
The code organization is pretty different. Selenium test suites are usually organized into the Page-Object Model, and Cypress warns against using that. Conditional waiting and such is very different, too. I think you’d probabl…
I am rewriting a Selenium project I have previously written in Java. I am really a beginner, but I am upgrading it and am using Maven as well as using the Page Object Model for my project.
I have created two packages as src/main/java/tests and src/main/java/pages. Is it standard practice to initialise the WebDriver within the src/main/java/tests package or should you place it src/main/java or even entirely separately? The code for Initializing the WebDriver and passing the users data to login u…
If enough people ask for background, I’ll make a separate explainer thread about page objects and fluent test writing style. But for clarity I’m wanting to stick to the meat of it.
In POM (Page Object Model) speak a page object is an object that can be used to manipulate the UI of an app, where named instances of the object represent each of the possible dialogs in the app. The model is the way we can work with app dialogs as if they are interchangeable and each object to represent a page is b…
One thing that still baffles me to this day is, should we implement the methods to check our assertions conditions exclusively in Page Objects, or should we do those in our Tests?
In other words, given a method:
boolean isPlayButtonDisplayed()
return driver.findElementByID(“play-btn”).isDisplayed();
(I’m erasing this as it probably isn’t a good example,
so please refer to the example below)
boolean doesDataTableCellTextEquals(int row, int column, string text)
return driver.findElementByLoc…