Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

New: Cypress task log added, cypress commands file added, cypress get… #3489

Merged
merged 11 commits into from
Jan 11, 2024

Conversation

joe-allen-89
Copy link
Contributor

@joe-allen-89 joe-allen-89 commented Dec 4, 2023

…Data command added.

Part 3 of the issue #3472

Description

  • Automatically Loads a /test/e2e/commands.js file if available through the supportFile directive in the cypress config
  • Adds cypress globals to eslint so that the linter doesn't warn unnecessarily on cypress test files
  • Allowed the outputdir to be the fixtures root for cypress, such that any file can be loaded from the outputdir into the cypress environment
  • Expose cy.getBuild() to return the adapt/js/build.min.js json
  • Expose cy.getConfig() to return the {build.coursedir}/config.json
  • Expose cy.getData(languagecode) to return an array of all the data from {build.coursedir}/{languagecode}/
  • Expose the array this.data inside tests, containing all of the data items from the adapt course language folder
  • Expose this.build, this.config, this.data.course, this.data.contentObjects, this.data.articles, this.data.blocks, this.data.components as shorthands as they are in adapt
  • Expose cy.getBuild().then(build => {}), cy.getConfig().then(config => {}), cy.getData('en').then(data=> {})

New

  • Cypress tasks added to config to log messages
  • Single commands file added to e2e
  • getBuild, getConfig and getData command added to load data using outputDir

Fix

  • grunt language loader to fail silently on non-language subfolders in coursedir

Update

  • Added cypress globals to eslint

@joe-allen-89 joe-allen-89 linked an issue Dec 4, 2023 that may be closed by this pull request
Co-authored-by: Cahir O'Doherty <41006337+cahirodoherty-learningpool@users.noreply.github.com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member

@oliverfoster oliverfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to put the commands.js contents at the bottom of cypress.config.js?

test/e2e/commands.js Outdated Show resolved Hide resolved
@oliverfoster
Copy link
Member

oliverfoster commented Dec 20, 2023

I have improved a bit. Removing the need to import the commands file. Merging with Cahir's latest pr. Made the fixturesFolder the outputdir directly, to account for being able to load any other data from the outputdir. Moved the issue of language selection and coursedir into the commands file so that we can consider them. Simplified the data access in the tests so that this.data is an array of all the objects and that instead of this.courseData, this.articlesData etc, we have this.data.course, this.data.contentObjects etc.

These two issues probably need fixing:

  • If the course folder name is changed then the data won't load as it's hard coded here
  • If the language is changed in the tests the test data will only be in the language specified as the _defaultLanguage in the config.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@oliverfoster
Copy link
Member

oliverfoster commented Dec 21, 2023

These two issues probably need fixing:

  • If the course folder name is changed then the data won't load as it's hard coded here
  • If the language is changed in the tests the test data will only be in the language specified as the _defaultLanguage in the config.json

The above are fixed.

  • Added getBuild to be able to use the availableLanguageNames and coursedir from adapt/js/build.min.js
  • Added getConfig to be able to load the {coursedir}/config.json
  • Allowed getData(languagecode = null) to load a specified or the default language
  • Removed the menuPage test
  • Added tests for config, languages and trackingIds

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job 👌

@cahirodoherty-learningpool
Copy link
Contributor

@oliverfoster @joe-allen-89
You both have contributed to this, so not sure what our approval process should be. Are you both happy with it in it's current form?

@oliverfoster Once this is merged, are there any more blockers outstanding or can the currently existing testing PRS be moved to their relevant plugins instead and reviewed there?

@oliverfoster
Copy link
Member

I'm happy if @joe-allen-89 is.

The only other blocker is to provide a similar interface for the unit testing. e2e tests can proceed after this pr is merged I think.

I'm sure we'll see what other issues arise thereafter.

Copy link
Contributor Author

@joe-allen-89 joe-allen-89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joe-allen-89 joe-allen-89 merged commit ac5f28e into master Jan 11, 2024
2 checks passed
@joe-allen-89 joe-allen-89 deleted the issue/3472_3 branch January 11, 2024 09:19
@cahirodoherty-learningpool
Copy link
Contributor

Thank you both!
🙌

github-actions bot pushed a commit that referenced this pull request Jan 11, 2024
# [5.34.0](v5.33.13...v5.34.0) (2024-01-11)

### New

* Cypress task log added, cypress commands file added, cypress get… (#3489) ([ac5f28e](ac5f28e)), closes [#3489](#3489)
Copy link

🎉 This PR is included in version 5.34.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Testing bugs
5 participants