aboutsummaryrefslogtreecommitdiffstats
path: root/tests/selenium/docs/Stack/specs/expect.js
diff options
context:
space:
mode:
authorŽeljko Filipin <zeljko.filipin@gmail.com>2024-09-16 12:22:51 +0200
committerŽeljko Filipin <zeljko.filipin@gmail.com>2024-09-19 10:57:35 +0200
commite5ce705de7253ecfc23a1a019c7e376d77ec3b58 (patch)
treef16ad10de2a262094891b6696f502a0fedea46d6 /tests/selenium/docs/Stack/specs/expect.js
parent5d95b85c16ad391bdfac78eecbccb2b92ca154f4 (diff)
downloadmediawikicore-e5ce705de7253ecfc23a1a019c7e376d77ec3b58.tar.gz
mediawikicore-e5ce705de7253ecfc23a1a019c7e376d77ec3b58.zip
selenium: Replace Node.js Assert library with WebdriverIO Expect library
Assertions from Expect library are more readable that assertions from Assert library. Bug: T325740 Change-Id: I686f39d7ef08085037bc34219c6f55eba9da8dd1
Diffstat (limited to 'tests/selenium/docs/Stack/specs/expect.js')
-rw-r--r--tests/selenium/docs/Stack/specs/expect.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/selenium/docs/Stack/specs/expect.js b/tests/selenium/docs/Stack/specs/expect.js
new file mode 100644
index 000000000000..12f22e4257e6
--- /dev/null
+++ b/tests/selenium/docs/Stack/specs/expect.js
@@ -0,0 +1,17 @@
+// Example code for Selenium/Explanation/Stack
+// https://www.mediawiki.org/wiki/Selenium/Explanation/Stack
+
+'use strict';
+
+// baseUrl is required for our continuous integration.
+// If you don't have MW_SERVER and MW_SCRIPT_PATH environment variables set
+// you can probably hardcode it to something like this:
+// const baseUrl = 'http://localhost:8080/wiki/';
+const baseUrl = `${ process.env.MW_SERVER }${ process.env.MW_SCRIPT_PATH }/index.php?title=`;
+
+describe( 'Main page', () => {
+ it( 'should have "Log in" link when using expect', async () => {
+ await browser.url( `${ baseUrl }Main_Page` );
+ await expect( await $( 'li#pt-login-2 a' ) ).toExist();
+ } );
+} );