acceptable-journalist-55984
02/02/2022, 11:44 AMselectFile()
API. Despite me being on 9.4.1, neither cy.document().selectFile
nor cy.get('input[type=file]').selectFile
are defined. Did I miss some config?ancient-minister-75558
02/02/2022, 2:38 PMCypress.Commands.add('getAccessToken', () => {
const options = {
method: "POST",
url: '/token.json',
form: true,
body: {
grant_type: "password",
username: Cypress.env('username'),
password: Cypress.env('pass'),
client_id: Cypress.env('client_id')
}
};
cy.request(options)
.then(response => {
expect(response.body).to.have.property('access_token');
Cypress.env('accessToken', response.body.access_token);
});
}
handsome-cartoon-58565
02/02/2022, 2:54 PMCypress.env
appears to only set/change env variables for one spec file
https://docs.cypress.io/api/cypress-api/env#Why-is-it-Cypress-env-and-not-cy-envhandsome-cartoon-58565
02/02/2022, 2:54 PMCyress.env('accessToken')
handsome-cartoon-58565
02/02/2022, 2:55 PMancient-minister-75558
02/02/2022, 3:15 PMCypress.env
is set as a global variable which could be updated in env file... Thanks @User
As my token expires, ideally, I was thinking to get it once and use it for whole test session...handsome-cartoon-58565
02/02/2022, 3:17 PMprocess.env
, but that would require to use Cypress plugin (not command)
https://docs.cypress.io/api/plugins/writing-a-pluginancient-minister-75558
02/02/2022, 3:27 PMgorgeous-insurance-13289
02/02/2022, 8:35 PMcy.get('#element').click()
, what's happening in the background?
We're encountering an error which only happens when the cypress test runs. If we mimic its behavior manually we don't have any issues.
Here is [the test](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/pull/8174/files#diff-a00eb0a05c99c0a2bdfd49f3f79145e86aeeb09e909c68c3c8c42f3cbda2841dR52-R71)
Here is the page of the deploy environment that has [the component being tested](https://ibmdotcom-web-components-experimental.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/8174/iframe.html?id=components-cloud-masthead--default)
The failure:
dds-masthead | cloud platform (desktop)
✓ should have url for IBM logo (3613ms)
✓ should have cloud platform name (4120ms)
✓ should load top-nav with no more than one active item (4079ms)
(Attempt 1 of 3) should have tabbed-interface megamenus
(Attempt 2 of 3) should have tabbed-interface megamenus
1) should have tabbed-interface megamenus
✓ should have functioning search bar with typeahead (7118ms)
✓ should have contact, login, and create-account CTAs (5095ms)
1) dds-masthead | cloud platform (desktop)
should have tabbed-interface megamenus:
AssertionError: Timed out retrying after 90000ms: expected '<div#panel-0-0>' to be 'visible'
This element `<div#panel-0-0>` is not visible because its parent `<dds-cloud-megamenu-right-navigation>` has CSS property: `visibility: hidden`
at Context.eval (http://localhost:8081/__cypress/tests?p=tests/e2e-storybook/cypress/integration/masthead/cloud/cloud-masthead.e2e.js:150:33)
adventurous-dream-20049
02/02/2022, 11:21 PMacceptable-journalist-55984
02/03/2022, 3:44 PMnumerous-gpu-95965
02/03/2022, 4:38 PMnumerous-gpu-95965
02/03/2022, 4:38 PMnumerous-gpu-95965
02/03/2022, 4:38 PMnumerous-gpu-95965
02/03/2022, 4:38 PMgorgeous-insurance-13289
02/03/2022, 6:28 PMbreezy-oyster-69258
02/03/2022, 7:45 PMError: Webpack Compilation Error
./src/resources/custom-attributes/after-render.js
Module build failed (from C:/Users/xxxxx/AppData/Local/Cypress/Cache/9.4.1/Cypress/resources/app/node_modules/babel-loader/lib/index.js):
SyntaxError: E:\xxxxx\form-builder\src\resources\custom-attributes\after-render.js: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (3:1):
1 | import { INode, bindable, BindingMode, customAttribute } from 'aurelia';
2 |
> 3 | @customAttribute({
| ^
4 | name: 'after-render'
5 | })
6 | export class AfterRender {
@ ./src/resources/custom-attributes/index.js 21:19-44
@ ./src/start.js
@ ./src/FormVersion.spec.js
It looks like Webpack is trying to load in my file but complains about decorators with babel (note, I'm not using webpack in our application, so this is a Cypress error).
I have a babel.config.json with this configuration
{
"presets": [
[
"@babel/preset-env",
{
"loose": true,
"exclude": [
"@babel/plugin-proposal-dynamic-import"
]
}
]
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
"@babel/plugin-syntax-dynamic-import"
]
}
So it should definitely be working with the decorators. Anybody have any clues? I'm about to open a bug with it, but wanted to run it here first.adventurous-dream-20049
02/03/2022, 9:14 PMgorgeous-insurance-13289
02/03/2022, 9:24 PMhandsome-cartoon-58565
02/04/2022, 12:16 AMadventurous-dream-20049
02/04/2022, 3:52 AMcy.get('[data-cy="my-data-cy"]').should('exist').and('has.value', 'MyValue')
numerous-gpu-95965
02/04/2022, 7:56 AMnumerous-gpu-95965
02/04/2022, 7:57 AMnumerous-gpu-95965
02/04/2022, 7:58 AMmany-dinner-79149
02/04/2022, 6:05 PMmany-dinner-79149
02/04/2022, 6:07 PMadventurous-dream-20049
02/04/2022, 6:40 PMadventurous-dream-20049
02/04/2022, 6:53 PMsilly-horse-70115
02/04/2022, 11:16 PMnumerous-gpu-95965
02/05/2022, 12:07 PM