flat-addition-70667
05/15/2023, 10:26 PMadventurous-whale-33899
05/16/2023, 5:44 AMcy.get("#cdk-drop-list-0 div:first-child").drag("#cdk-drop-list-1", {force: true})
cy.get('#cdk-drop-list-0 div:first-child').realMouseDown({ button: "left" })
cy.get("#cdk-drop-list-1").realMouseMove(50, 50, { position: "center" })
cy.get("#cdk-drop-list-1").realMouseUp(50, 50, { position: "center" })
cy.get("#cdk-drop-list-0 div:first-child")
.trigger("mousedown", { button: 0, force: true })
.trigger("mousemove", 48, 586, { force: true })
.trigger("mouseup", 48, 586, { force: true })
})
On the debug window i can see the element being dragged but will not be dropped.billowy-petabyte-65450
05/16/2023, 10:50 AMstocky-grass-9933
05/16/2023, 2:18 PMhttps://cdn.discordapp.com/attachments/1108035631130607807/1108035631449391214/image.png▾
silly-egg-91335
05/16/2023, 3:21 PMsquare-toothbrush-32850
05/16/2023, 6:16 PMproud-answer-20715
05/16/2023, 11:13 PMpurple-hairdresser-80317
05/17/2023, 1:19 AMCypress.Commands.addQuery('findPrimeNgDialog', function(header) {
return subject => subject.findByRole('dialog')
})
I have to use the subject, as I cannot just return subject => cy.findByRole('dialog')
. So, when I try to call the query, similar to cy.get()
, like this cy.getPrimeNgDialog('HeaderText').as('Dialog')
, I expected it to work like get()
, however subject
is undefined. However calling it with cy.get('body').getPrimeNgDialog('HeaderText').as('Dialog')
results in getting a jquery.fn.init
object, but I don't really know what to do with that object. I thought I could simply chain the queries together, but it does not work.
Sadly, I haven't found much information or examples about addQuery, therefore I really don't know what to try next. I'm fairly certain I misunderstood how addQuery is supposed to work, can someone explain this to me, or point to a ressource where I could learn more about that?
The only thing I got to work is
Cypress.Commands.addQuery('findPrimeNgDialog', function(header) {
const getFn = cy.now('contains', '[role="dialog"]', header) as any
return subject => getFn(subject) // However not chainable inside here
})
But since cy.now()
is not chainable, therefore I have to use contains
instead of get
to be able to search for the text inside. And at this point i'm questioning myself, if what i'm trying is actually meaningful.clever-night-39043
05/17/2023, 1:53 AMrich-pharmacist-74804
05/17/2023, 7:22 AMbaseUrl
in cypress.config.js and another URL to env
as url
. For some reason, I have to visit cy.visit('url')
. However, frequently it fails to load and throws an error as Timed out retrying after 15000ms
. I added a debug()
but it's empty.
cy.visit('/') - (baseUrl)
works very well and cy.visit('url')
also works sometimes.
Did anyone face such error?important-noon-13871
05/17/2023, 8:35 AMlet count = {
interest: 0,
};
cy.fixture('campaign_interest.json').then((mockAPIInterest) => {
cy.fixture('campaign_interest_empty.json').then((mockEmptyAPIInterest) => {
cy.intercept('GET', '/api/v2/dmp-light/campaign/interest/default*', (req) => {
count.interest++;
if (count.interest <= 1) {
req.reply({
statusCode: 200,
body: [mockAPIInterest]
});
} else {
req.reply({
statusCode: 200,
body: [mockEmptyAPIInterest],
});
}
}).as('getInterest');
});
});
steep-furniture-84934
05/17/2023, 11:11 AMfresh-van-73810
05/17/2023, 11:20 AMhttps://cdn.discordapp.com/attachments/1108353364288348191/1108353364393214082/Bildschirmfoto_2023-05-17_um_13.17.19.png▾
shy-park-96196
05/17/2023, 1:22 PMable-twilight-99822
05/17/2023, 2:26 PM[label="${sideMenu}"]
);
},
},
};
export default adminPage;
`able-twilight-99822
05/17/2023, 2:34 PM[label="Admin"]
selector.
Additional Information:
- The relevant code snippet used to select the menu item is as follows:
testFile.js
javascript
import { When } from 'cypress-cucumber-preprocessor/steps';
import { adminPageDefinitions } from './adminPageDefinitions';
When('I select the {string} Menu', (sideMenu) => {
adminPageDefinitions.selectMenu(sideMenu);
});
adminPageDefinitions.js
javascript
import adminPage from './adminPage';
export const adminPageDefinitions = {
selectMenu(sideMenu) {
cy.get(adminPage.pageElements.sideMenu(sideMenu))
.should('be.visible')
.click();
},
};
adminPage.js
javascript
const adminPage = {
pageElements: {
sideMenu(sideMenu) {
return cy.get(`[label="${sideMenu}"]`);
},
},
};
export default adminPage;
- The error occurs at the line cy.get(adminPage.pageElements.sideMenu(sideMenu)).should('be.visible').click();
in the adminPageDefinitions.js
file.
- The error suggests that the sideMenu
parameter is undefined or does not match any elements on the page.
- Manually inspecting the page confirms that the menu item with the label "Admin" exists and is visible.
- The timeout error indicates that the menu item is not being located within the specified timeframe.bumpy-insurance-8581
05/17/2023, 2:34 PMhttps://cdn.discordapp.com/attachments/1108402084925149235/1108402085269090384/IMG_4181.png▾
delightful-magician-24840
05/17/2023, 3:00 PMts
//tsconfig.json from screen
{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "../../built/local/tsc.js",
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
https://cdn.discordapp.com/attachments/1108408611404775545/1108408611631276032/image.png▾
https://cdn.discordapp.com/attachments/1108408611404775545/1108408611937472542/image.png▾
calm-cartoon-89224
05/17/2023, 3:18 PMbusy-tailor-13324
05/17/2023, 10:10 PMable-twilight-99822
05/18/2023, 9:45 AMFeature: Admin Menu Navigation
Scenario: Navigate to the Admin Levels
When I select the 'Admin' Menu
2. Observe the Cypress Test Runner GUI.
Expected Result:
The 'Admin' menu item should be successfully selected without any errors, allowing navigation to the Admin levels.
Actual Result:
The test fails with a timeout error, indicating that properties of undefined cannot be read. This issue occurs when trying to locate the 'Admin' menu item using the [label="Admin"]
selector.
Additional Information:
- The test code consists of the following files:
- **testFile.js**:
javascript
When('I select the {string} Menu', (sideMenu) => {
adminPageDefinitions.selectMenu(sideMenu);
});
- **adminPageDefinitions.js**:
javascript
import adminPage from './adminPage';
export const adminPageDefinitions = {
selectMenu(sideMenu) {
cy.get(adminPage.pageElements.sideMenu(sideMenu))
.should('be.visible')
.click();
},
};
- **adminPage.js**:
javascript
const adminPage = {
pageElements: {
sideMenu(sideMenu) {
return cy.get(`[label="${sideMenu}"]`);
},
},
};
- The error occurs at the line cy.get(adminPage.pageElements.sideMenu(sideMenu)).should('be.visible').click();
in the adminPageDefinitions.js
file.
- Manually inspecting the page confirms that the menu item with the label "Admin" exists and is visible.plain-potato-68806
05/18/2023, 10:04 AMjavascript
cy.get('#sliderButton > button')
.trigger('mousedown', { button: 0, position: 'center' })
.trigger('mousemove', { clientX: 1000, clientY: 0 })
.trigger('mouseup', { force: true });
https://cdn.discordapp.com/attachments/1108696607832158329/1108696608012505088/Screenshot_2023-05-18_at_10.59.40.png▾
flaky-gold-17986
05/18/2023, 10:40 AMfull-helmet-93291
05/18/2023, 1:23 PMfast-branch-64525
05/18/2023, 2:40 PMfierce-intern-71272
05/18/2023, 2:59 PMnutritious-article-48038
05/19/2023, 3:09 PMhttps://cdn.discordapp.com/attachments/1109135709807329371/1109135709937340456/Capture.PNG▾
flat-addition-70667
05/19/2023, 4:43 PMbest-dog-89508
05/19/2023, 4:49 PMhttps://cdn.discordapp.com/attachments/1109160794505084989/1109160794635129003/image.png▾
chilly-truck-14848
05/19/2023, 7:36 PM